chiark / gitweb /
test: Fix names of stunt pipes
[secnet.git] / test / invoke
index 24e8fcabc75f795057e9e1b15f3a2085b801f912..2f8835e7742c9119adebf63fdc80c30dabb44f2f 100755 (executable)
@@ -26,9 +26,29 @@ proc mkconf {which} {
     global netlink
     global ports
     global extra
+    global netlinkfh
+    set pipefp test/$which.netlink
+    foreach tr {t r} {
+       file delete $pipefp.$tr
+       exec mkfifo -m600 $pipefp.$tr
+       set netlinkfh($which.$tr) [set fh [open $pipefp.$tr r+]]
+       fconfigure $fh -blocking 0 -buffering none -translation binary
+    }
+    fileevent $netlinkfh($which.r) readable [list netlink-readable $which]
+    set fakeuf test/$which.fake-userv
+    set fakeuh [open $fakeuf w 0755]
+    puts $fakeuh "#!/bin/sh
+set -e
+cat >$pipefp.r &
+exec 3<>$pipefp.t
+exec <$pipefp.t
+exec 3<&-
+exec cat
+"
     set cfg "
-       netlink tun {
-           name \"netlink-tun\";
+       netlink userv-ipif {
+           name \"netlink\";
+            userv-path \"$fakeuf\";
        $netlink($which)
            mtu 1400;
            buffer sysbuffer(2048);
@@ -51,9 +71,21 @@ proc mkconf {which} {
        local-key rsa-private(\"test-example/$which.key\");
 "
     append cfg $extra($which)
-    append cfg "
-       include test-example/common.conf
-    "
+    append cfg {
+       log logfile {
+           filename "/dev/tty";
+           class "info","notice","warning","error","security","fatal";
+       };
+       system {
+       };
+       resolver adns {
+       };
+       log-events "all";
+       random randomfile("/dev/urandom",no);
+       transform eax-serpent { }, serpent256-cbc { };
+       include test-example/sites.conf
+       sites map(site,vpn/test-example/all-sites);
+    }
     return $cfg
 }
 
@@ -63,10 +95,10 @@ proc spawn-secnet {which} {
     set ch [open $cf w]
     puts $ch [mkconf $which]
     close $ch
-    set argl [list ./secnet -dvnc $cf]
+    set argl [list -dvnc $cf]
     set pid [fork]
     if {!$pid} {
-       execl really $argl
+       execl ./secnet $argl
     }
 }