chiark / gitweb /
Works at least without crypto.
[userv-utils.git] / ipif / udptunnel
index c2da428f9a2a5d020cc4875fa66383650b574103..08b75a35e2d49f175cf1961434782cc4a660e0ac 100755 (executable)
@@ -8,6 +8,7 @@
 #        | -m   (`masquerade support': subcommand gets `Wait' instead of our addr/port)
 #        | -d   (`dump keys': when no subcmd, spew keys rather than reading them;
 #                we always send keys to our subcmd if there is one)
+#        | -Dcrypto  (debug crypto - use with care, prints keys, packets &c on screen!)
 #        | -f<path-to-udptunnel-forwarder>
 #          ...
 #        ]
@@ -172,6 +173,7 @@ $|=1;
 $masq= 0;
 $dump= 0;
 $fcmd= 'udptunnel-forwarder';
+$xfwdopts= '';
 
 while ($ARGV[0] =~ m/^-/) {
     $_= shift @ARGV;
@@ -191,6 +193,8 @@ while ($ARGV[0] =~ m/^-/) {
            $masq= 1;
        } elsif (s/^-d/-/) {
            $dump= 1;
+       } elsif (s/^-Dcrypto$/-/) {
+           $xfwdopts.= 'K';
        } else {
            quit("unknown option \`$_'");
        }
@@ -345,11 +349,12 @@ if (!$c_lcmd) {
 close UW;
 close DR;
 
-@fcmd= ($fcmd,
-       fileno(L), fileno(DW), fileno(UR),
+$xfwdopts.= 'w' if $dump;
+
+@fcmd= ($fcmd, $xfwdopts,
+       fileno(L), fileno(DW), fileno(UR), fileno(DUMPKEYS),
        $mtu, $keepalive, $timeout,
        @rapf,
-       fileno(DUMPKEYS), $dump ? 'y' : '',
        @encryption);
 debug("forwarding command @fcmd.");