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

Configure Feed

Select the types of activity you want to include in your feed.

selftests: net: forwarding: fix IPv6 address leak in cleanup

Several forwarding tests (e.g., gre_multipath.sh) initialize both IPv4
and IPv6 addresses using simple_if_init, but only clean up IPv4
in simple_if_fini. This leaves stale IPv6 addresses on the interfaces,
which causes subsequent tests to fail when they encounter unexpected
address configuration.

The issue can be reproduced by running tests in sequence:
# run_kselftest.sh -t net/forwarding:ipip_hier_gre.sh
# run_kselftest.sh -t net/forwarding:min_max_mtu.sh
TAP version 13
1..1
# timeout set to 0
# selftests: net/forwarding: min_max_mtu.sh
# TEST: ping [ OK ]
# TEST: ping6 [ OK ]
# TEST: Test maximum MTU configuration [ OK ]
# TEST: Test traffic, packet size is maximum MTU [FAIL]
# Ping6, packet size: 65487 succeeded, but should have failed
# TEST: Test minimum MTU configuration [ OK ]
# TEST: Test traffic, packet size is minimum MTU [ OK ]
not ok 1 selftests: net/forwarding: min_max_mtu.sh # exit=1

Fix this by removing the unused IPv6 argument from simple_if_init in
tests that don't use IPv6 (gre_multipath.sh, ipip_lib.sh), and by
adding the missing IPv6 argument to simple_if_fini in tests that
use IPv6 (gre_multipath_nh.sh, gre_multipath_nh_res.sh).

Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260305211000.515301-1-aleksey.oladko@virtuozzo.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Aleksei Oladko and committed by
Jakub Kicinski
21c0dc7c ad4c9559

+4 -4
+1 -1
tools/testing/selftests/net/forwarding/gre_multipath.sh
··· 65 65 66 66 h1_create() 67 67 { 68 - simple_if_init $h1 192.0.2.1/28 2001:db8:1::1/64 68 + simple_if_init $h1 192.0.2.1/28 69 69 ip route add vrf v$h1 192.0.2.16/28 via 192.0.2.2 70 70 } 71 71
+1 -1
tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
··· 80 80 { 81 81 ip route del vrf v$h1 2001:db8:2::/64 via 2001:db8:1::2 82 82 ip route del vrf v$h1 192.0.2.16/28 via 192.0.2.2 83 - simple_if_fini $h1 192.0.2.1/28 83 + simple_if_fini $h1 192.0.2.1/28 2001:db8:1::1/64 84 84 } 85 85 86 86 sw1_create()
+1 -1
tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
··· 80 80 { 81 81 ip route del vrf v$h1 2001:db8:2::/64 via 2001:db8:1::2 82 82 ip route del vrf v$h1 192.0.2.16/28 via 192.0.2.2 83 - simple_if_fini $h1 192.0.2.1/28 83 + simple_if_fini $h1 192.0.2.1/28 2001:db8:1::1/64 84 84 } 85 85 86 86 sw1_create()
+1 -1
tools/testing/selftests/net/forwarding/ipip_lib.sh
··· 144 144 145 145 h1_create() 146 146 { 147 - simple_if_init $h1 192.0.2.1/28 2001:db8:1::1/64 147 + simple_if_init $h1 192.0.2.1/28 148 148 ip route add vrf v$h1 192.0.2.16/28 via 192.0.2.2 149 149 } 150 150