[SRU][N][PATCH 1/1] selftests: net: disable rp_filter after namespace initialization
Ian Whitfield
ian.whitfield at canonical.com
Thu Oct 1 20:40:01 UTC 2026
From: Hangbin Liu <liuhangbin at gmail.com>
BugLink: https://bugs.launchpad.net/bugs/2055473
Some distributions enable rp_filter globally by default. To ensure consistent
behavior across environments, we explicitly disable it in several test cases.
This patch moves the rp_filter disabling logic to immediately after the
network namespace is initialized. With this change, individual test cases
with creating namespace via setup_ns no longer need to disable rp_filter
again.
This helps avoid redundancy and ensures test consistency.
Signed-off-by: Hangbin Liu <liuhangbin at gmail.com>
Reviewed-by: Simon Horman <horms at kernel.org>
Link: https://patch.msgid.link/20250508081910.84216-2-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba at kernel.org>
(backported from commit ce17831f8e970cadaba88605b4b1b1a8b2b50808)
[ijwhitfield: Adjusted context due to missing unrelated commits:
f8a2d2f874b71 ("selftests: net: lib: remove 'ns' var in setup_ns")
92fe5670271a5 ("selftests: net: lib: remove ns from list after clean-up")]
Signed-off-by: Ian Whitfield <ian.whitfield at canonical.com>
---
tools/testing/selftests/net/lib.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
index 01a18cc04782e..25a9b93082972 100644
--- a/tools/testing/selftests/net/lib.sh
+++ b/tools/testing/selftests/net/lib.sh
@@ -199,6 +199,8 @@ setup_ns()
return $ksft_skip
fi
ip -n "$ns" link set lo up
+ ip netns exec "${!ns_name}" sysctl -wq net.ipv4.conf.all.rp_filter=0
+ ip netns exec "${!ns_name}" sysctl -wq net.ipv4.conf.default.rp_filter=0
! $ns_exist && ns_list+=("$ns")
done
NS_LIST+=("${ns_list[@]}")
--
2.43.0
More information about the kernel-team
mailing list