]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: netfilter: remove rp_filter configuration
authorHangbin Liu <liuhangbin@gmail.com>
Thu, 8 May 2025 08:19:09 +0000 (08:19 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 13 May 2025 01:10:56 +0000 (18:10 -0700)
Remove the rp_filter configuration in netfilter lib, as setup_ns already
sets it appropriately by default

Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/20250508081910.84216-6-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/netfilter/br_netfilter.sh
tools/testing/selftests/net/netfilter/bridge_brouter.sh
tools/testing/selftests/net/netfilter/conntrack_vrf.sh
tools/testing/selftests/net/netfilter/ipvs.sh
tools/testing/selftests/net/netfilter/nft_fib.sh
tools/testing/selftests/net/netfilter/nft_nat_zones.sh
tools/testing/selftests/net/netfilter/rpath.sh

index 1559ba275105edc9795c79cb7b1e63d5d6dd41f7..011de876309405806b439d8be2f2c15e22034889 100755 (executable)
@@ -60,9 +60,6 @@ bcast_ping()
        done
 }
 
-ip netns exec "$ns0" sysctl -q net.ipv4.conf.all.rp_filter=0
-ip netns exec "$ns0" sysctl -q net.ipv4.conf.default.rp_filter=0
-
 if ! ip link add veth1 netns "$ns0" type veth peer name eth0 netns "$ns1"; then
        echo "SKIP: Can't create veth device"
        exit $ksft_skip
index 2549b65906931f1c3e1ce97b8f9eecccf75c17d5..ea76f2bc2f59cb295932465f8895205bc06d4d7d 100755 (executable)
@@ -22,8 +22,6 @@ trap cleanup EXIT
 
 setup_ns nsbr ns1 ns2
 
-ip netns exec "$nsbr" sysctl -q net.ipv4.conf.default.rp_filter=0
-ip netns exec "$nsbr" sysctl -q net.ipv4.conf.all.rp_filter=0
 if ! ip link add veth0 netns "$nsbr" type veth peer name eth0 netns "$ns1"; then
        echo "SKIP: Can't create veth device"
        exit $ksft_skip
index e95ecb37c2b145712e0e1f20267d0789f9ccb5c0..025b58f2ae913291e5455ba495a6e788ba4eaf85 100755 (executable)
@@ -52,9 +52,6 @@ trap cleanup EXIT
 
 setup_ns ns0 ns1
 
-ip netns exec "$ns0" sysctl -q -w net.ipv4.conf.default.rp_filter=0
-ip netns exec "$ns0" sysctl -q -w net.ipv4.conf.all.rp_filter=0
-ip netns exec "$ns0" sysctl -q -w net.ipv4.conf.all.rp_filter=0
 ip netns exec "$ns0" sysctl -q -w net.ipv4.conf.all.forwarding=1
 
 if ! ip link add veth0 netns "$ns0" type veth peer name veth0 netns "$ns1" > /dev/null 2>&1; then
index d3edb16cd4b3f6a69297db9699b28a85be229e6e..6af2ea3ad6b82012ca714fd5db762d90435219a3 100755 (executable)
@@ -129,9 +129,6 @@ test_dr() {
        # avoid incorrect arp response
        ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.all.arp_ignore=1
        ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.all.arp_announce=2
-       # avoid reverse route lookup
-       ip netns exec "${ns2}" sysctl -qw  net.ipv4.conf.all.rp_filter=0
-       ip netns exec "${ns2}" sysctl -qw  net.ipv4.conf.veth21.rp_filter=0
        ip netns exec "${ns2}" ip addr add "${vip_v4}/32" dev lo:1
 
        test_service
@@ -167,9 +164,6 @@ test_tun() {
        ip netns exec "${ns2}" ip link set tunl0 up
        ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.all.arp_ignore=1
        ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.all.arp_announce=2
-       ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.all.rp_filter=0
-       ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.tunl0.rp_filter=0
-       ip netns exec "${ns2}" sysctl -qw net.ipv4.conf.veth21.rp_filter=0
        ip netns exec "${ns2}" ip addr add "${vip_v4}/32" dev lo:1
 
        test_service
index ea47dd246a083312547c115b62ad5af4c22c2e70..82780b39277c5dba05f5eed173f924bcd01950e5 100755 (executable)
@@ -167,8 +167,6 @@ test_ping() {
 ip netns exec "$nsrouter" sysctl net.ipv6.conf.all.forwarding=1 > /dev/null
 ip netns exec "$nsrouter" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
 ip netns exec "$nsrouter" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
-ip netns exec "$nsrouter" sysctl net.ipv4.conf.all.rp_filter=0 > /dev/null
-ip netns exec "$nsrouter" sysctl net.ipv4.conf.veth0.rp_filter=0 > /dev/null
 
 test_ping 10.0.2.1 dead:2::1 || exit 1
 check_drops || exit 1
index 3b81d88bdde35b6181c37a07a75e5fe88120cb14..9f200f80253a7565c996ff8ad58288fd421b9648 100755 (executable)
@@ -88,7 +88,6 @@ for i in $(seq 1 "$maxclients");do
   echo netns exec "$cl" sysctl -q net.ipv4.tcp_syn_retries=2
   echo netns exec "$gw" ip link set "veth$i" up
   echo netns exec "$gw" sysctl -q net.ipv4.conf.veth"$i".arp_ignore=2
-  echo netns exec "$gw" sysctl -q net.ipv4.conf.veth"$i".rp_filter=0
 
   # clients have same IP addresses.
   echo netns exec "$cl" ip addr add 10.1.0.3/24 dev eth0
@@ -178,7 +177,6 @@ fi
 
 ip netns exec "$gw" sysctl -q net.ipv4.conf.all.forwarding=1 > /dev/null
 ip netns exec "$gw" sysctl -q net.ipv6.conf.all.forwarding=1 > /dev/null
-ip netns exec "$gw" sysctl -q net.ipv4.conf.all.rp_filter=0 >/dev/null
 
 # useful for debugging: allows to use 'ping' from clients to gateway.
 ip netns exec "$gw" sysctl -q net.ipv4.fwmark_reflect=1 > /dev/null
index 86ec4e68594dc34705ac6c911ebb013d6ab3d2c6..24ad41d526d993a91afded87fd905f69d48799d0 100755 (executable)
@@ -1,8 +1,7 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
-# return code to signal skipped test
-ksft_skip=4
+source lib.sh
 
 # search for legacy iptables (it uses the xtables extensions
 if iptables-legacy --version >/dev/null 2>&1; then
@@ -32,17 +31,10 @@ if [ -z "$iptables$ip6tables$nft" ]; then
        exit $ksft_skip
 fi
 
-sfx=$(mktemp -u "XXXXXXXX")
-ns1="ns1-$sfx"
-ns2="ns2-$sfx"
-trap "ip netns del $ns1; ip netns del $ns2" EXIT
-
-# create two netns, disable rp_filter in ns2 and
-# keep IPv6 address when moving into VRF
-ip netns add "$ns1"
-ip netns add "$ns2"
-ip netns exec "$ns2" sysctl -q net.ipv4.conf.all.rp_filter=0
-ip netns exec "$ns2" sysctl -q net.ipv4.conf.default.rp_filter=0
+trap cleanup_all_ns EXIT
+
+# create two netns, keep IPv6 address when moving into VRF
+setup_ns ns1 ns2
 ip netns exec "$ns2" sysctl -q net.ipv6.conf.all.keep_addr_on_down=1
 
 # a standard connection between the netns, should not trigger rp filter