path: root/src/tests
diff options
authorJason A. Donenfeld <Jason@zx2c4.com>2016-11-15 02:42:40 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-11-15 02:45:56 +0100
commit51fdefb522cd41583689558b474db680ae95e94b (patch)
treebf26f96071dd87a5d4007a8d8843189825de59d2 /src/tests
parentcompat: rearrange (diff)
socket: ensure that saddr routing can deal with interface removal
Diffstat (limited to '')
1 files changed, 32 insertions, 0 deletions
diff --git a/src/tests/netns.sh b/src/tests/netns.sh
index 1c638d4..4ee8cd1 100755
--- a/src/tests/netns.sh
+++ b/src/tests/netns.sh
@@ -247,3 +247,35 @@ n2 wg
# Demonstrate n2 can still send packets to n1, since persistent-keepalive will prevent connection tracking entry from expiring (to see entries: `n0 conntrack -L`).
pp sleep 3
n2 ping -W 1 -c 1
+n0 iptables -t nat -F
+ip0 link del vethrc
+ip0 link del vethrs
+ip1 link del wg0
+ip2 link del wg0
+# Test that saddr routing isn't overly sticky
+ip1 link add dev wg0 type wireguard
+ip2 link add dev wg0 type wireguard
+ip1 link add veth1 type veth peer name veth2
+ip1 link set veth2 netns $netns2
+n1 bash -c 'echo 0 > /proc/sys/net/ipv6/conf/veth1/accept_dad'
+n2 bash -c 'echo 0 > /proc/sys/net/ipv6/conf/veth2/accept_dad'
+n1 bash -c 'echo 1 > /proc/sys/net/ipv4/conf/veth1/promote_secondaries'
+ip1 addr add dev veth1
+ip1 addr add dead::1/96 dev veth1
+ip2 addr add dev veth2
+ip2 addr add dead::2/96 dev veth2
+ip1 link set veth1 up
+ip2 link set veth2 up
+n1 wg set wg0 peer "$pub2" endpoint
+n1 ping -W 1 -c 1
+ip1 addr add dev veth1
+ip1 addr del dev veth1
+n1 ping -W 1 -c 1
+n1 wg set wg0 peer "$pub2" endpoint [dead::2]:2
+n1 ping -W 1 -c 1
+ip1 addr add dead::10/96 dev veth1
+ip1 addr del dead::1/96 dev veth1
+n1 ping -W 1 -c 1