]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests: netfilter: ipvs.sh: Explicity disable rp_filter on interface tunl0
authorYi Chen <yiche@redhat.com>
Thu, 24 Jul 2025 08:06:53 +0000 (16:06 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 25 Jul 2025 16:41:04 +0000 (18:41 +0200)
Although setup_ns() set net.ipv4.conf.default.rp_filter=0,
loading certain module such as ipip will automatically create a tunl0 interface
in all netns including new created ones. In the script, this is before than
default.rp_filter=0 applied, as a result tunl0.rp_filter remains set to 1
which causes the test report FAIL when ipip module is preloaded.

Before fix:
Testing DR mode...
Testing NAT mode...
Testing Tunnel mode...
ipvs.sh: FAIL

After fix:
Testing DR mode...
Testing NAT mode...
Testing Tunnel mode...
ipvs.sh: PASS

Fixes: 7c8b89ec506e ("selftests: netfilter: remove rp_filter configuration")
Signed-off-by: Yi Chen <yiche@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tools/testing/selftests/net/netfilter/ipvs.sh

index 6af2ea3ad6b82012ca714fd5db762d90435219a3..9c9d5b38ab71229e9cbefc066aa453e9a076d6d6 100755 (executable)
@@ -151,7 +151,7 @@ test_nat() {
 test_tun() {
        ip netns exec "${ns0}" ip route add "${vip_v4}" via "${gip_v4}" dev br0
 
-       ip netns exec "${ns1}" modprobe -q ipip
+       modprobe -q ipip
        ip netns exec "${ns1}" ip link set tunl0 up
        ip netns exec "${ns1}" sysctl -qw net.ipv4.ip_forward=0
        ip netns exec "${ns1}" sysctl -qw net.ipv4.conf.all.send_redirects=0
@@ -160,10 +160,10 @@ test_tun() {
        ip netns exec "${ns1}" ipvsadm -a -i -t "${vip_v4}:${port}" -r ${rip_v4}:${port}
        ip netns exec "${ns1}" ip addr add ${vip_v4}/32 dev lo:1
 
-       ip netns exec "${ns2}" modprobe -q ipip
        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.tunl0.rp_filter=0
        ip netns exec "${ns2}" ip addr add "${vip_v4}/32" dev lo:1
 
        test_service