X-Git-Url: https://git.distorted.org.uk/~mdw/userv-utils/blobdiff_plain/40f7555063d5bd252bdde051baa13d082e17b610..fe112c0873d68ce9c23f9218593b0e23eab89e06:/ipif/udptunnel?ds=sidebyside diff --git a/ipif/udptunnel b/ipif/udptunnel index 7160cca..1b5031c 100755 --- a/ipif/udptunnel +++ b/ipif/udptunnel @@ -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) {