chiark / gitweb /
test: send an initial ping packet
[secnet.git] / test / invoke
index fb9ce2ca1b389673765f631f45956c065cc7a895..7182d13336286ec8f93afd42c2feb66cc137859a 100755 (executable)
@@ -2,6 +2,8 @@
 
 package require Tclx
 
+load chiark_tcl_hbytes-1.so
+
 set netlink(inside) {
     local-address "172.18.232.9";
     secnet-address "172.18.232.10";
@@ -103,7 +105,7 @@ proc spawn-secnet {which} {
     if {!$pid} {
        execl ./secnet $argl
     }
-    puts -nonewline $netlinkfh($which.t) "\xc0"
+    puts -nonewline $netlinkfh($which.t) [hbytes h2raw c0]
 }
 
 proc netlink-readable {which} {
@@ -137,7 +139,24 @@ $message
     exit 1
 }
 
+proc sendpkt {} {
+    global netlinkfh
+    set p {
+        4500 0054 ed9d 4000 4001 24da ac12 e809
+        ac12 e802 0800 1de4 2d96 0001 f1d4 a05d
+        0000 0000 507f 0b00 0000 0000 1011 1213
+        1415 1617 1819 1a1b 1c1d 1e1f 2021 2223
+        2425 2627 2829 2a2b 2c2d 2e2f 3031 3233
+        3435 3637
+    }
+    puts -nonewline $netlinkfh(inside.t) \
+       [hbytes h2raw c0[join $p ""]c0]
+}
+
 spawn-secnet inside
 spawn-secnet outside
 
+after 500 sendpkt
+after 1000 sendpkt
+
 vwait ok