From 6f777f90a8ca72bbaf1b5115a972e6073e300479 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Fri, 27 May 2022 13:35:45 +0200 Subject: [PATCH] wireguard: test multiple peers at a time Extends the wg_reconfig run script to test that the WireGuard component is able to handle multiple peers at the same time if configured. Ref #4520 --- repos/dde_linux/run/wg_reconfig.run | 127 +++++++++++++++++++++------- 1 file changed, 96 insertions(+), 31 deletions(-) diff --git a/repos/dde_linux/run/wg_reconfig.run b/repos/dde_linux/run/wg_reconfig.run index ee85ec4263..8c3b41a493 100644 --- a/repos/dde_linux/run/wg_reconfig.run +++ b/repos/dde_linux/run/wg_reconfig.run @@ -1,14 +1,17 @@ # -# A ping (peer 1) and a fetchurl (peer 3) both try to reach a server at peer 2 -# through a WireGuard VNP (10.0.9.0/24) while the configuration of the server -# WireGuard changes. Each peer has its own WireGuard instance and talks -# to the other peers only through WireGuard. The server WireGuard (peer 2) -# initially accepts only peer 1. After some time it gets re-configured to -# accept only peer 3. Then, it gets re-configured to accept only peer 1 again -# and, in the end, an attempt is made to re-configure the private key, which -# should fail. Note that the peer 1 WireGuard has to be reconfigured as well, -# in order to be forced to redo the initiation handshake for the third -# configuration phase of the server WireGuard. +# Two pings (peer 1 and peer 4) and a fetchurl (peer 3) try to reach a server +# (peer 2) through a WireGuard VNP (10.0.9.0/24) while the configuration of +# the server WireGuard changes. Each peer has its own WireGuard instance and +# talks to the other peers only through WireGuard. +# +# In configuration step 1, the server WireGuard accepts only peer 1. In step 2 +# it gets re-configured to accept only peer 3. Then, in step 3, it gets +# re-configured to accept both peer 1 and peer 4 and, in the final step 4, an +# attempt is made to re-configure the private key, which should fail. +# +# Note that the peer 1 WireGuard has to be reconfigured as well, in order to +# be forced to redo the initiation handshake for configuration step 3 of the +# server WireGuard. # if {[expr ![have_spec arm_v8a] && ![have_spec x86_64]]} { @@ -33,7 +36,7 @@ proc peer_1_wg_config {peers} { } - if {$peers == "peer_3"} { + if {[lsearch $peers peer_3] != -1} { append result { } - switch $peers { - peer_1 { - append result { - - } + if {[lsearch $peers peer_1] != -1} { + append result { + } - peer_3 { - append result { - - } + } + if {[lsearch $peers peer_3] != -1} { + append result { + + } + } + if {[lsearch $peers peer_4] != -1} { + append result { + } } append result { @@ -116,26 +123,26 @@ append config { - + } [peer_2_wg_config peer_1 private_key_1] { - + } [peer_2_wg_config peer_3 private_key_1] { - - } [peer_2_wg_config peer_1 private_key_1] { + + } [peer_2_wg_config {peer_1 peer_4} private_key_1] { - + - - } [peer_2_wg_config peer_1 private_key_2] { + + } [peer_2_wg_config {peer_1 peer_4} private_key_2] { @@ -147,7 +154,7 @@ append config { - } [peer_1_wg_config no_peer] { + } [peer_1_wg_config { }] { @@ -192,6 +199,20 @@ append config { + + + + + + + + + + + + + + @@ -284,6 +305,29 @@ append config { + + + + + + + + + + + + + + + + + + + @@ -356,6 +400,27 @@ append config { + + + + + + + + + + + + + + + + + + + + + @@ -510,7 +575,7 @@ append output_pattern "peer_1_ping. 64 bytes from 10.0.9.2.*\n" append output_pattern ".*peer_1_ping. 64 bytes from 10.0.9.2.*\n" append output_pattern ".*child \"peer_3_fetchurl\" exited with exit value 0.*\n" append output_pattern ".*peer_1_ping. 64 bytes from 10.0.9.2.*\n" -append output_pattern ".*peer_1_ping. 64 bytes from 10.0.9.2.*\n" +append output_pattern ".*peer_4_ping. 64 bytes from 10.0.9.2.*\n" append output_pattern ".*peer_2_wg. .*Error: Uncaught exception of type .*Invalid_reconfiguration_attempt.*\n" run_genode_until $output_pattern 45