Skip to content
This repository was archived by the owner on Dec 27, 2019. It is now read-only.

Commit 0e8c293

Browse files
committed
netns: add test for failing 5.3 FIB changes
Reference: https://lore.kernel.org/netdev/[email protected]/
1 parent 1ab4849 commit 0e8c293

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/tests/netns.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ ip2 link del wg0
241241
# │ ┌─────┐ ┌─────┐ │ │ ┌──────┐ ┌──────┐ │ │ ┌─────┐ ┌─────┐ │
242242
# │ │ wg0 │─────────────│vethc│───────────┼────┼────│vethrc│ │vethrs│──────────────┼─────┼──│veths│────────────│ wg0 │ │
243243
# │ ├─────┴──────────┐ ├─────┴──────────┐│ │ ├──────┴─────────┐ ├──────┴────────────┐ │ │ ├─────┴──────────┐ ├─────┴──────────┐ │
244-
# │ │192.168.241.1/24│ │192.168.1.100/24││ │ │192.168.1.100/24│ │10.0.0.1/24 │ │ │ │10.0.0.100/24 │ │192.168.241.2/24│ │
244+
# │ │192.168.241.1/24│ │192.168.1.100/24││ │ │192.168.1.1/24 │ │10.0.0.1/24 │ │ │ │10.0.0.100/24 │ │192.168.241.2/24│ │
245245
# │ │fd00::1/24 │ │ ││ │ │ │ │SNAT:192.168.1.0/24│ │ │ │ │ │fd00::2/24 │ │
246246
# │ └────────────────┘ └────────────────┘│ │ └────────────────┘ └───────────────────┘ │ │ └────────────────┘ └────────────────┘ │
247247
# └────────────────────────────────────────┘ └────────────────────────────────────────────────┘ └────────────────────────────────────────┘
@@ -280,6 +280,26 @@ n2 ping -W 1 -c 1 192.168.241.1
280280
# Demonstrate n2 can still send packets to n1, since persistent-keepalive will prevent connection tracking entry from expiring (to see entries: `n0 conntrack -L`).
281281
pp sleep 3
282282
n2 ping -W 1 -c 1 192.168.241.1
283+
n1 wg set wg0 peer "$pub2" persistent-keepalive 0
284+
285+
# Do a wg-quick(8)-style policy routing for the default route, making sure vethc has a v6 address to tease out bugs.
286+
ip1 -6 addr add fc00::9/96 dev vethc
287+
ip1 -6 route add default via fc00::1
288+
ip2 -4 addr add 192.168.99.7/32 dev wg0
289+
ip2 -6 addr add abab::1111/128 dev wg0
290+
n1 wg set wg0 fwmark 51820 peer "$pub2" allowed-ips 192.168.99.7,abab::1111
291+
ip1 -6 route add default dev wg0 table 51820
292+
ip1 -6 rule add not fwmark 51820 table 51820
293+
ip1 -6 rule add table main suppress_prefixlength 0
294+
ip1 -4 route add default dev wg0 table 51820
295+
ip1 -4 rule add not fwmark 51820 table 51820
296+
ip1 -4 rule add table main suppress_prefixlength 0
297+
# suppress_prefixlength only got added in 3.12, and we want to support 3.10+.
298+
if [[ $(ip1 -4 rule show all) == *suppress_prefixlength* ]]; then
299+
# Flood the pings instead of sending just one, to trigger routing table reference counting bugs.
300+
n1 ping -W 1 -c 100 -f 192.168.99.7
301+
n1 ping -W 1 -c 100 -f abab::1111
302+
fi
283303

284304
n0 iptables -t nat -F
285305
ip0 link del vethrc

src/tests/qemu/kernel.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ CONFIG_NF_NAT_IPV4=y
2222
CONFIG_IP_NF_IPTABLES=y
2323
CONFIG_IP_NF_FILTER=y
2424
CONFIG_IP_NF_NAT=y
25+
CONFIG_IP_ADVANCED_ROUTER=y
26+
CONFIG_IP_MULTIPLE_TABLES=y
27+
CONFIG_IPV6_MULTIPLE_TABLES=y
2528
CONFIG_TTY=y
2629
CONFIG_BINFMT_ELF=y
2730
CONFIG_BINFMT_SCRIPT=y

0 commit comments

Comments
 (0)