aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-08-03 14:55:51 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-08-03 14:55:51 +0200
commitbf44c07a805a5e40408059ac60dfc526196a3797 (patch)
treed64038cf98e40eb87e17a13ad3cf3855020f9871
parenttools: stricter userspace ipc parsing (diff)
downloadwireguard-monolithic-historical-bf44c07a805a5e40408059ac60dfc526196a3797.tar.xz
wireguard-monolithic-historical-bf44c07a805a5e40408059ac60dfc526196a3797.zip
netns: explictly test reply to sender routing
Diffstat (limited to '')
-rwxr-xr-xsrc/tests/netns.sh26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/tests/netns.sh b/src/tests/netns.sh
index 4c60e95..c799a48 100755
--- a/src/tests/netns.sh
+++ b/src/tests/netns.sh
@@ -253,7 +253,7 @@ ip0 link del vethrs
ip1 link del wg0
ip2 link del wg0
-# Test that saddr routing isn't overly sticky, changing to this topology:
+# Test that saddr routing is sticky but not too sticky, changing to this topology:
# ┌────────────────────────────────────────┐ ┌────────────────────────────────────────┐
# │ $ns1 namespace │ │ $ns2 namespace │
# │ │ │ │
@@ -273,6 +273,8 @@ ip1 link set veth2 netns $netns2
n1 bash -c 'printf 0 > /proc/sys/net/ipv6/conf/veth1/accept_dad'
n2 bash -c 'printf 0 > /proc/sys/net/ipv6/conf/veth2/accept_dad'
n1 bash -c 'printf 1 > /proc/sys/net/ipv4/conf/veth1/promote_secondaries'
+
+# First we check that we aren't overly sticky and can fall over to new IPs when old ones are removed
ip1 addr add 10.0.0.1/24 dev veth1
ip1 addr add fd00:aa::1/96 dev veth1
ip2 addr add 10.0.0.2/24 dev veth2
@@ -292,6 +294,28 @@ ip1 addr add fd00:aa::10/96 dev veth1
ip1 addr del fd00:aa::1/96 dev veth1
n1 ping -W 1 -c 1 192.168.241.2
+# Now we show that we can successfully do reply to sender routing
+ip1 addr flush dev veth1
+ip2 addr flush dev veth2
+ip1 addr add 10.0.0.1/24 dev veth1
+ip1 addr add 10.0.0.2/24 dev veth1
+ip1 addr add fd00:aa::1/96 dev veth1
+ip1 addr add fd00:aa::2/96 dev veth1
+ip2 addr add 10.0.0.3/24 dev veth2
+ip2 addr add fd00:aa::3/96 dev veth2
+n2 wg set wg0 peer "$pub1" endpoint 10.0.0.1:1
+n2 ping -W 1 -c 1 192.168.241.1
+[[ $(n2 wg show wg0 endpoints) == "$pub1 10.0.0.1:1" ]]
+n2 wg set wg0 peer "$pub1" endpoint [fd00:aa::1]:1
+n2 ping -W 1 -c 1 192.168.241.1
+[[ $(n2 wg show wg0 endpoints) == "$pub1 [fd00:aa::1]:1" ]]
+n2 wg set wg0 peer "$pub1" endpoint 10.0.0.2:1
+n2 ping -W 1 -c 1 192.168.241.1
+[[ $(n2 wg show wg0 endpoints) == "$pub1 10.0.0.2:1" ]]
+n2 wg set wg0 peer "$pub1" endpoint [fd00:aa::2]:1
+n2 ping -W 1 -c 1 192.168.241.1
+[[ $(n2 wg show wg0 endpoints) == "$pub1 [fd00:aa::2]:1" ]]
+
ip1 link del veth1
ip1 link del wg0
ip2 link del wg0