Subject: Re: [PATCH net] selftests: net: forwarding: fix IPv6 address leak in cleanup

From: Ido Schimmel <[email-masked]>
Date: Sun, 1 Mar 2026 14:40:52 +0200

On Sun, Mar 01, 2026 at 01:47:06AM +0000, Aleksei Oladko wrote:
> 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 adding the missing IPv6 argument to simple_if_fini in
> all affected tests.
> 
> Fixes: fed926d4f64c ("selftests: forwarding: Add IP tunneling lib")
> Fixes: 902280cacc03 ("selftests: forwarding: Add resilient multipath tunneling nexthop test")
> Fixes: 54818c4c4b93 ("selftests: forwarding: Test multipath tunneling")
> Fixes: e035146d6560 ("selftests: forwarding: Add multipath tunneling nexthop test")
> 

Please remove the blank line

> Signed-off-by: Aleksei Oladko <[email-masked]>
> ---
>  tools/testing/selftests/net/forwarding/gre_multipath.sh        | 2 +-
>  tools/testing/selftests/net/forwarding/gre_multipath_nh.sh     | 2 +-
>  tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh | 2 +-
>  tools/testing/selftests/net/forwarding/ipip_lib.sh             | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/forwarding/gre_multipath.sh b/tools/testing/selftests/net/forwarding/gre_multipath.sh
> index 57531c1d884d..397422cd5aea 100755
> --- a/tools/testing/selftests/net/forwarding/gre_multipath.sh
> +++ b/tools/testing/selftests/net/forwarding/gre_multipath.sh
> @@ -72,7 +72,7 @@ h1_create()
>  h1_destroy()
>  {
>  	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

The test only runs IPv4 traffic in the overlay, so I believe the IPv6
address can be removed from h1 (h2 doesn't have one as well):

diff --git a/tools/testing/selftests/net/forwarding/gre_multipath.sh b/tools/testing/selftests/net/forwarding/gre_multipath.sh
index 57531c1d884d..ce4ae74843d9 100755
--- a/tools/testing/selftests/net/forwarding/gre_multipath.sh
+++ b/tools/testing/selftests/net/forwarding/gre_multipath.sh
@@ -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
 }

>  }
>  
>  sw1_create()
> diff --git a/tools/testing/selftests/net/forwarding/gre_multipath_nh.sh b/tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
> index 7d5b2b9cc133..c667b81da37f 100755
> --- a/tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
> +++ b/tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
> @@ -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()
> diff --git a/tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh b/tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
> index 370f9925302d..d04bad58a96a 100755
> --- a/tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
> +++ b/tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
> @@ -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()
> diff --git a/tools/testing/selftests/net/forwarding/ipip_lib.sh b/tools/testing/selftests/net/forwarding/ipip_lib.sh
> index 01e62c4ac94d..a5c23a28d50e 100644
> --- a/tools/testing/selftests/net/forwarding/ipip_lib.sh
> +++ b/tools/testing/selftests/net/forwarding/ipip_lib.sh
> @@ -151,7 +151,7 @@ h1_create()
>  h1_destroy()
>  {
>  	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

Let's remove the IPv6 address in this case as well. Looks like it was
added by mistake:

diff --git a/tools/testing/selftests/net/forwarding/ipip_lib.sh b/tools/testing/selftests/net/forwarding/ipip_lib.sh
index 01e62c4ac94d..b255646b737a 100644
--- a/tools/testing/selftests/net/forwarding/ipip_lib.sh
+++ b/tools/testing/selftests/net/forwarding/ipip_lib.sh
@@ -144,7 +144,7 @@
 
 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
 }

>  }
>  h2_create()
> -- 
> 2.43.0