Module Name:    src
Committed By:   tih
Date:           Sat Aug 29 07:22:49 UTC 2020

Modified Files:
        src/tests/net/if_wg: t_misc.sh t_tunnel.sh

Log Message:
Update the if_wg tests for the human readable 'latest-handshake'
output of wgconfig.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_wg/t_misc.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_wg/t_tunnel.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/if_wg/t_misc.sh
diff -u src/tests/net/if_wg/t_misc.sh:1.3 src/tests/net/if_wg/t_misc.sh:1.4
--- src/tests/net/if_wg/t_misc.sh:1.3	Thu Aug 27 02:52:33 2020
+++ src/tests/net/if_wg/t_misc.sh	Sat Aug 29 07:22:49 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_misc.sh,v 1.3 2020/08/27 02:52:33 riastradh Exp $
+#	$NetBSD: t_misc.sh,v 1.4 2020/08/29 07:22:49 tih Exp $
 #
 # Copyright (c) 2018 Ryota Ozaki <[email protected]>
 # All rights reserved.
@@ -81,7 +81,7 @@ wg_rekey_body()
 	$ping $ip_wg_peer
 
 	latest_handshake=$($HIJACKING wgconfig wg0 show peer peer0 \
-	    | awk -F : '/latest-handshake/ {print $2;}')
+	    | awk -F ': ' '/latest-handshake/ {print $2;}')
 	$DEBUG && echo $latest_handshake
 
 	sleep 1
@@ -102,7 +102,7 @@ wg_rekey_body()
 	    $HIJACKING wgconfig wg0 show peer peer0
 
 	latest_handshake=$($HIJACKING wgconfig wg0 show peer peer0 \
-	    | awk -F : '/latest-handshake/ {print $2;}')
+	    | awk -F ': ' '/latest-handshake/ {print $2;}')
 	$DEBUG && echo $latest_handshake
 
 	# Wait for a reinitiation to be performed again
@@ -142,7 +142,6 @@ wg_handshake_timeout_body()
 	local ip_wg_peer=10.0.0.2
 	local port=51820
 	local rekey_after_time=3
-	local latest_handshake=
 	local outfile=./out
 	local rekey_timeout=3
 	local rekey_attempt_time=8
@@ -278,7 +277,7 @@ wg_cookie_body()
 	    cat $outfile
 
 	$DEBUG && $HIJACKING wgconfig wg0 show all
-	atf_check -s exit:0 -o match:"latest-handshake: 0" \
+	atf_check -s exit:0 -o match:"latest-handshake: \(never\)" \
 	    $HIJACKING wgconfig wg0
 
 	# Wait for restarting a session
@@ -289,7 +288,7 @@ wg_cookie_body()
 	$ping $ip_wg_peer
 
 	$DEBUG && $HIJACKING wgconfig wg0 show all
-	atf_check -s exit:0 -o not-match:"latest-handshake: 0" \
+	atf_check -s exit:0 -o not-match:"latest-handshake: \(never\)" \
 	    $HIJACKING wgconfig wg0
 
 	destroy_wg_interfaces

Index: src/tests/net/if_wg/t_tunnel.sh
diff -u src/tests/net/if_wg/t_tunnel.sh:1.1 src/tests/net/if_wg/t_tunnel.sh:1.2
--- src/tests/net/if_wg/t_tunnel.sh:1.1	Wed Aug 26 16:03:42 2020
+++ src/tests/net/if_wg/t_tunnel.sh	Sat Aug 29 07:22:49 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_tunnel.sh,v 1.1 2020/08/26 16:03:42 riastradh Exp $
+#	$NetBSD: t_tunnel.sh,v 1.2 2020/08/29 07:22:49 tih Exp $
 #
 # Copyright (c) 2018 Ryota Ozaki <[email protected]>
 # All rights reserved.
@@ -267,14 +267,14 @@ wg_tunnel_common()
 	    $ip_wg_local/$inner_prefixall,$subnet_local
 
 	export RUMP_SERVER=$SOCK_TUN_LOCAL
-	atf_check -s exit:0 -o match:"latest-handshake: 0" \
+	atf_check -s exit:0 -o match:"latest-handshake: \(never\)" \
 	    $HIJACKING wgconfig wg0 show peer peer0
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	check_ping $inner_proto $ip_peer
 
 	export RUMP_SERVER=$SOCK_TUN_LOCAL
-	atf_check -s exit:0 -o not-match:"latest-handshake: 0" \
+	atf_check -s exit:0 -o not-match:"latest-handshake: \(never\)" \
 	    $HIJACKING wgconfig wg0 show peer peer0
 
 	export RUMP_SERVER=$SOCK_LOCAL

Reply via email to