]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: net: forwarding: fix IPv6 address leak in cleanup
authorAleksei Oladko <aleksey.oladko@virtuozzo.com>
Thu, 5 Mar 2026 21:10:00 +0000 (21:10 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 7 Mar 2026 01:15:33 +0000 (17:15 -0800)
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>
tools/testing/selftests/net/forwarding/gre_multipath.sh
tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
tools/testing/selftests/net/forwarding/ipip_lib.sh

index 57531c1d884d9d72f97ec2dac8f8a54bd0facc72..ce4ae74843d9159b244f47addc2063e8efa1d5e3 100755 (executable)
@@ -65,7 +65,7 @@ source lib.sh
 
 h1_create()
 {
-       simple_if_init $h1 192.0.2.1/28 2001:db8:1::1/64
+       simple_if_init $h1 192.0.2.1/28
        ip route add vrf v$h1 192.0.2.16/28 via 192.0.2.2
 }
 
index 7d5b2b9cc1335933690e14ce3043a420461ced52..c667b81da37fe3521f33118608bd61444e6dab07 100755 (executable)
@@ -80,7 +80,7 @@ h1_destroy()
 {
        ip route del vrf v$h1 2001:db8:2::/64 via 2001:db8:1::2
        ip route del vrf v$h1 192.0.2.16/28 via 192.0.2.2
-       simple_if_fini $h1 192.0.2.1/28
+       simple_if_fini $h1 192.0.2.1/28 2001:db8:1::1/64
 }
 
 sw1_create()
index 370f9925302dd8449d48591d288cb911d816f38a..d04bad58a96a4b6aa559fa39f962347a005a967a 100755 (executable)
@@ -80,7 +80,7 @@ h1_destroy()
 {
        ip route del vrf v$h1 2001:db8:2::/64 via 2001:db8:1::2
        ip route del vrf v$h1 192.0.2.16/28 via 192.0.2.2
-       simple_if_fini $h1 192.0.2.1/28
+       simple_if_fini $h1 192.0.2.1/28 2001:db8:1::1/64
 }
 
 sw1_create()
index 01e62c4ac94ddc602317254e98a726544cede880..b255646b737a0806864ed7754bb676822d3273db 100644 (file)
 
 h1_create()
 {
-       simple_if_init $h1 192.0.2.1/28 2001:db8:1::1/64
+       simple_if_init $h1 192.0.2.1/28
        ip route add vrf v$h1 192.0.2.16/28 via 192.0.2.2
 }