Rework partial packet handling once more
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 13 Apr 2018 16:48:06 +0000 (18:48 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 13 Apr 2018 16:48:06 +0000 (18:48 +0200)
Address the concern that commit c53c2fec raised differently.

The original direction of the traffic is encoded in bit 0
of the flight number.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5923)

util/perl/TLSProxy/Proxy.pm
util/perl/TLSProxy/Record.pm

index 45d88bf..752b572 100644 (file)
@@ -479,7 +479,7 @@ sub process_packet
 
     print "\n";
 
-    if (scalar(@{$ret[0]}) == 0) {
+    if (scalar(@{$ret[0]}) == 0 or length($ret[2]) != 0) {
         return "";
     }
 
index acace36..49a0084 100644 (file)
@@ -279,7 +279,8 @@ sub reconstruct_record
     my $server = shift;
     my $data;
 
-    if ($self->{sent}) {
+    #We only replay the records in the same direction
+    if ($self->{sent} || ($self->flight & 1) != $server) {
         return "";
     }
     $self->{sent} = 1;