Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net/if_wg wg: Fix tests by sprinkling ifconfig -w 10



details:   https://anonhg.NetBSD.org/src/rev/379764dd16fa
branches:  trunk
changeset: 1015169:379764dd16fa
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Oct 16 16:17:23 2020 +0000

description:
wg: Fix tests by sprinkling ifconfig -w 10

So protocols have time to finish setup.

diffstat:

 tests/net/if_wg/t_basic.sh |  40 ++++++++++++-------------------
 tests/net/if_wg/t_misc.sh  |  58 +++++++++++++++++++--------------------------
 2 files changed, 41 insertions(+), 57 deletions(-)

diffs (261 lines):

diff -r bf42822250d4 -r 379764dd16fa tests/net/if_wg/t_basic.sh
--- a/tests/net/if_wg/t_basic.sh        Fri Oct 16 15:40:40 2020 +0000
+++ b/tests/net/if_wg/t_basic.sh        Fri Oct 16 16:17:23 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_basic.sh,v 1.1 2020/08/26 16:03:42 riastradh Exp $
+#      $NetBSD: t_basic.sh,v 1.2 2020/10/16 16:17:23 roy Exp $
 #
 # Copyright (c) 2018 Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
 # All rights reserved.
@@ -92,16 +92,14 @@
        export RUMP_SERVER=$SOCK_LOCAL
        setup_common shmif0 $outer_proto $ip_local $outer_prefix
        setup_wg_common wg0 $inner_proto $ip_wg_local $inner_prefix $port "$key_priv_local"
+       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 $outer_proto $ip_peer $outer_prefix
        setup_wg_common wg0 $inner_proto $ip_wg_peer $inner_prefix $port "$key_priv_peer"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall
-
-       export RUMP_SERVER=$SOCK_PEER
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/$inner_prefixall
+       $ifconfig -w 10
 
        if [ $type = basic ]; then
                export RUMP_SERVER=$SOCK_LOCAL
@@ -327,24 +325,21 @@
        setup_common shmif1 inet $ip_local2 24
        setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
        setup_wg_common wg1 inet $ip_wg_local2 24 $port2 "$key_priv_local"
+       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+       add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 inet $ip_peer 24
        setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
+       add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER2
        setup_common shmif0 inet $ip_peer2 24
        setup_wg_common wg0 inet $ip_wg_peer2 24 $port2 "$key_priv_peer2"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-       add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32
-
-       export RUMP_SERVER=$SOCK_PEER
-       add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
-
-       export RUMP_SERVER=$SOCK_PEER2
        add_peer wg0 peer0 $key_pub_local $ip_local2:$port2 $ip_wg_local2/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_LOCAL
 
@@ -415,24 +410,21 @@
        export RUMP_SERVER=$SOCK_LOCAL
        setup_common shmif0 inet $ip_local 24
        setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+       add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 inet $ip_peer 24
        setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
+       add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER2
        setup_common shmif0 inet $ip_peer2 24
        setup_wg_common wg0 inet $ip_wg_peer2 24 $port "$key_priv_peer2"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-       add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32
-
-       export RUMP_SERVER=$SOCK_PEER
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
-
-       export RUMP_SERVER=$SOCK_PEER2
-       add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_LOCAL
 
diff -r bf42822250d4 -r 379764dd16fa tests/net/if_wg/t_misc.sh
--- a/tests/net/if_wg/t_misc.sh Fri Oct 16 15:40:40 2020 +0000
+++ b/tests/net/if_wg/t_misc.sh Fri Oct 16 16:17:23 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_misc.sh,v 1.5 2020/08/31 20:32:58 riastradh Exp $
+#      $NetBSD: t_misc.sh,v 1.6 2020/10/16 16:17:23 roy Exp $
 #
 # Copyright (c) 2018 Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
 # All rights reserved.
@@ -65,16 +65,14 @@
        export RUMP_SERVER=$SOCK_LOCAL
        setup_common shmif0 inet $ip_local 24
        setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+       $fconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 inet $ip_peer 24
        setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-
-       export RUMP_SERVER=$SOCK_PEER
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_LOCAL
 
@@ -166,16 +164,14 @@
        export RUMP_SERVER=$SOCK_LOCAL
        setup_common shmif0 inet $ip_local 24
        setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 inet $ip_peer 24
        setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-
-       export RUMP_SERVER=$SOCK_PEER
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        # Resolve arp
        export RUMP_SERVER=$SOCK_LOCAL
@@ -244,16 +240,14 @@
        export RUMP_SERVER=$SOCK_LOCAL
        setup_common shmif0 inet $ip_local 24
        setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 inet $ip_peer 24
        setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-
-       export RUMP_SERVER=$SOCK_PEER
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        # Emulate load on the peer
@@ -330,17 +324,15 @@
        export RUMP_SERVER=$SOCK_LOCAL
        setup_common shmif0 inet $ip_local 24
        setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+       # Initially, the local doesn't know the endpoint of the peer
+       add_peer wg0 peer0 $key_pub_peer "" $ip_wg_peer/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 inet $ip_peer 24
        setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       # Initially, the local doesn't know the endpoint of the peer
-       add_peer wg0 peer0 $key_pub_peer "" $ip_wg_peer/32
-
-       export RUMP_SERVER=$SOCK_PEER
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        extract_new_packets $BUS > $outfile
        $DEBUG && cat $outfile
@@ -363,7 +355,7 @@
 
        # Change the IP address of the peer
        setup_common shmif0 inet $ip_peer_new 24
-       atf_check -s exit:0 rump.ifconfig -w 10
+       $ifconfig -w 10
 
        # Ping from the local to the peer doesn't work because the local
        # doesn't know the change of the IP address of the peer
@@ -427,16 +419,14 @@
        export RUMP_SERVER=$SOCK_LOCAL
        setup_common shmif0 inet $ip_local 24
        setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+       $ifconfg -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 inet $ip_peer 24
        setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-
-       export RUMP_SERVER=$SOCK_PEER
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        # Shorten keepalive_timeout of the peer
        atf_check -s exit:0 -o ignore \
@@ -529,11 +519,13 @@
        # The local always has the preshared key
        add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 \
            $pskfile "$key_psk"
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
 
        # First, try the peer without the preshared key
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_LOCAL
 
@@ -550,6 +542,7 @@
        delete_peer wg0 peer0
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 \
            $pskfile "$key_psk"
+       $ifconfig -w 10
 
        # Need a rekey
        atf_check -s exit:0 sleep $((rekey_after_time + 1))
@@ -568,6 +561,7 @@
        export RUMP_SERVER=$SOCK_PEER
        delete_peer wg0 peer0
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        # Need a rekey
        atf_check -s exit:0 sleep $((rekey_after_time + 1))
@@ -613,16 +607,14 @@
        export RUMP_SERVER=$SOCK_LOCAL
        setup_common shmif0 inet $ip_local 24
        setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
+       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_PEER
        setup_common shmif0 inet $ip_peer 24
        setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
-
-       export RUMP_SERVER=$SOCK_LOCAL
-       add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
-
-       export RUMP_SERVER=$SOCK_PEER
        add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
+       $ifconfig -w 10
 
        export RUMP_SERVER=$SOCK_LOCAL
 



Home | Main Index | Thread Index | Old Index