Message ID | 20250508081910.84216-2-liuhangbin@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | selftests: net: configure rp_filter in setup_ns | expand |
On Thu, May 08, 2025 at 08:19:05AM +0000, Hangbin Liu wrote: > 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@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org>
diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 7e1e56318625..7962da06f816 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -217,6 +217,8 @@ setup_ns() return $ksft_skip fi ip -n "${!ns_name}" 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_list+=("${!ns_name}") done NS_LIST+=("${ns_list[@]}")
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@gmail.com> --- tools/testing/selftests/net/lib.sh | 2 ++ 1 file changed, 2 insertions(+)