From e77612523bf4ad49049da75f5b24180e835ab105 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 5 Dec 2019 01:23:16 +0000 Subject: [PATCH] stest: Make it possible to have kex initiated by `outside' Introduce new `initiator' variable. No functional change (other than to messages) with existing tests. Signed-off-by: Ian Jackson --- stest/common.tcl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/stest/common.tcl b/stest/common.tcl index bc00d22..6ab275e 100644 --- a/stest/common.tcl +++ b/stest/common.tcl @@ -28,6 +28,8 @@ set extra(outside) {} set privkey(inside) test-example/inside.privkeys/ set privkey(outside) test-example/outside.privkeys/ +set initiator inside + proc sitesconf_hook {l} { return $l } proc oldsecnet {site} { @@ -225,9 +227,10 @@ proc netlink-readable {location site} { } proc netlink-got-packet {location site data} { + global initiator if {![hbytes length $data]} return - switch -exact $site { - inside { + switch -exact $site!$initiator { + inside!inside - outside!outside { switch -glob $data { 45000054ed9d4000fe0166d9ac12e802ac12e80900* { puts "OK $data" @@ -238,8 +241,8 @@ proc netlink-got-packet {location site data} { } } } - outside { - error "inside rx'd!" + default { + error "$site rx'd! (initiator $initiator)" } } } @@ -261,6 +264,7 @@ $message proc sendpkt {} { global netlinkfh + global initiator set p { 4500 0054 ed9d 4000 4001 24da ac12 e809 ac12 e802 0800 1de4 2d96 0001 f1d4 a05d @@ -269,7 +273,7 @@ proc sendpkt {} { 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233 3435 3637 } - puts -nonewline $netlinkfh(inside.t) \ + puts -nonewline $netlinkfh($initiator.t) \ [hbytes h2raw c0[join $p ""]c0] } -- 2.30.2