public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftests: net: forwarding: fix IPv6 address leak in cleanup
@ 2026-03-05 21:10 Aleksei Oladko
  2026-03-06 13:27 ` Ido Schimmel
  2026-03-07  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Aleksei Oladko @ 2026-03-05 21:10 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Ido Schimmel, Nir Dotan
  Cc: netdev, linux-kselftest, linux-kernel, Aleksei Oladko

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).

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")
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
---
Changes in v2:
- In gre_multipath.sh and ipip_lib.sh, remove the unused IPv6 address
  from simple_if_init instead of adding it to simple_if_fini, since
  these tests don't use IPv6
- Link to v1: https://lore.kernel.org/linux-kselftest/20260301124052.GA713428@shredder/T/
---
 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..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
 }
 
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..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
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] selftests: net: forwarding: fix IPv6 address leak in cleanup
  2026-03-05 21:10 [PATCH v2] selftests: net: forwarding: fix IPv6 address leak in cleanup Aleksei Oladko
@ 2026-03-06 13:27 ` Ido Schimmel
  2026-03-07  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2026-03-06 13:27 UTC (permalink / raw)
  To: Aleksei Oladko
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Petr Machata, Nir Dotan, netdev,
	linux-kselftest, linux-kernel

On Thu, Mar 05, 2026 at 09:10:00PM +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 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).
> 
> 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")
> Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] selftests: net: forwarding: fix IPv6 address leak in cleanup
  2026-03-05 21:10 [PATCH v2] selftests: net: forwarding: fix IPv6 address leak in cleanup Aleksei Oladko
  2026-03-06 13:27 ` Ido Schimmel
@ 2026-03-07  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-07  1:30 UTC (permalink / raw)
  To: Aleksei Oladko
  Cc: davem, edumazet, kuba, pabeni, horms, shuah, petrm, idosch, nird,
	netdev, linux-kselftest, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  5 Mar 2026 21:10:00 +0000 you 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
> 
> [...]

Here is the summary with links:
  - [v2] selftests: net: forwarding: fix IPv6 address leak in cleanup
    https://git.kernel.org/netdev/net-next/c/21c0dc7cdd07

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-07  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05 21:10 [PATCH v2] selftests: net: forwarding: fix IPv6 address leak in cleanup Aleksei Oladko
2026-03-06 13:27 ` Ido Schimmel
2026-03-07  1:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox