chiark / gitweb /
Do not send ENDs. Do not send empty packets.
authorian <ian>
Sat, 25 Sep 1999 10:11:57 +0000 (10:11 +0000)
committerian <ian>
Sat, 25 Sep 1999 10:11:57 +0000 (10:11 +0000)
ipif/udptunnel

index 7160cca33a9c55d19a8cc78f2d45ba7e7cc9836a..1b5031c7d2f1f2e3406e0a4bbb21a8ddaec865ff 100755 (executable)
@@ -215,7 +215,7 @@ for (;;) {
            quit "tunnel endpoint closed by system";
        }
        while (($p= index($upbuf,"\300")) >= 0) {
-           if (!defined(send L,substr($upbuf,0,$p+1),0,$rs)) {
+           if ($p && !defined(send L,substr($upbuf,0,$p),0,$rs)) {
                warning("transmit error: $!");
            } else {
                if (!$upyet) {
@@ -233,6 +233,7 @@ for (;;) {
            warning("got packet from incorrect peer $rsp_from");
            next;
        }
+       $downbuf= "\300".$downbuf."\300";
        if (!defined($r= syswrite(DW,$downbuf,length $downbuf))) {
            warning("tunnel endpoint write error: $!");
        } elsif ($r != length $downbuf) {