Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wireguard: selftests: actually test for routing loops

We previously removed the restriction on looping to self, and then added
a test to make sure the kernel didn't blow up during a routing loop. The
kernel didn't blow up, thankfully, but on certain architectures where
skb fragmentation is easier, such as ppc64, the skbs weren't actually
being discarded after a few rounds through. But the test wasn't catching
this. So actually test explicitly for massive increases in tx to see if
we have a routing loop. Note that the actual loop problem will need to
be addressed in a different commit.

Fixes: b673e24aad36 ("wireguard: socket: remove errant restriction on looping to self")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jason A. Donenfeld and committed by
Jakub Kicinski
782c72af 03ff1b1d

+5 -1
+5 -1
tools/testing/selftests/wireguard/netns.sh
··· 276 276 n1 wg set wg0 peer "$pub2" endpoint 192.168.241.2:7 277 277 ip2 link del wg0 278 278 ip2 link del wg1 279 - ! n0 ping -W 1 -c 10 -f 192.168.241.2 || false # Should not crash kernel 279 + read _ _ tx_bytes_before < <(n0 wg show wg1 transfer) 280 + ! n0 ping -W 1 -c 10 -f 192.168.241.2 || false 281 + sleep 1 282 + read _ _ tx_bytes_after < <(n0 wg show wg1 transfer) 283 + (( tx_bytes_after - tx_bytes_before < 70000 )) 280 284 281 285 ip0 link del wg1 282 286 ip1 link del wg0