Skip to content

Commit c7b1307

Browse files
zx2c4gregkh
authored andcommitted
wireguard: selftests: test multiple parallel streams
commit d5a49aa upstream. In order to test ndo_start_xmit being called in parallel, explicitly add separate tests, which should all run on different cores. This should help tease out bugs associated with queueing up packets from different cores in parallel. Currently, it hasn't found those types of bugs, but given future planned work, this is a useful regression to avoid. Fixes: e7096c1 ("net: WireGuard secure network tunnel") Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ce4feb0 commit c7b1307

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • tools/testing/selftests/wireguard

‎tools/testing/selftests/wireguard/netns.sh‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ip0() { pretty 0 "ip $*"; ip -n $netns0 "$@"; }
3939
ip1() { pretty 1 "ip $*"; ip -n $netns1 "$@"; }
4040
ip2() { pretty 2 "ip $*"; ip -n $netns2 "$@"; }
4141
sleep() { read -t "$1" -N 1 || true; }
42-
waitiperf() { pretty "${1//*-}" "wait for iperf:5201 pid $2"; while [[ $(ss -N "$1" -tlpH 'sport = 5201') != *\"iperf3\",pid=$2,fd=* ]]; do sleep 0.1; done; }
42+
waitiperf() { pretty "${1//*-}" "wait for iperf:${3:-5201} pid $2"; while [[ $(ss -N "$1" -tlpH "sport = ${3:-5201}") != *\"iperf3\",pid=$2,fd=* ]]; do sleep 0.1; done; }
4343
waitncatudp() { pretty "${1//*-}" "wait for udp:1111 pid $2"; while [[ $(ss -N "$1" -ulpH 'sport = 1111') != *\"ncat\",pid=$2,fd=* ]]; do sleep 0.1; done; }
4444
waitiface() { pretty "${1//*-}" "wait for $2 to come up"; ip netns exec "$1" bash -c "while [[ \$(< \"/sys/class/net/$2/operstate\") != up ]]; do read -t .1 -N 0 || true; done;"; }
4545

@@ -141,6 +141,19 @@ tests() {
141141
n2 iperf3 -s -1 -B fd00::2 &
142142
waitiperf $netns2 $!
143143
n1 iperf3 -Z -t 3 -b 0 -u -c fd00::2
144+
145+
# TCP over IPv4, in parallel
146+
for max in 4 5 50; do
147+
local pids=( )
148+
for ((i=0; i < max; ++i)) do
149+
n2 iperf3 -p $(( 5200 + i )) -s -1 -B 192.168.241.2 &
150+
pids+=( $! ); waitiperf $netns2 $! $(( 5200 + i ))
151+
done
152+
for ((i=0; i < max; ++i)) do
153+
n1 iperf3 -Z -t 3 -p $(( 5200 + i )) -c 192.168.241.2 &
154+
done
155+
wait "${pids[@]}"
156+
done
144157
}
145158

146159
[[ $(ip1 link show dev wg0) =~ mtu\ ([0-9]+) ]] && orig_mtu="${BASH_REMATCH[1]}"

0 commit comments

Comments
 (0)