Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 753096c3 authored by Jiri Benc's avatar Jiri Benc Committed by Greg Kroah-Hartman
Browse files

selftests, bpf: test_lwt_ip_encap: Really disable rp_filter



[ Upstream commit 79e2c306667542b8ee2d9a9d947eadc7039f0a3c ]

It's not enough to set net.ipv4.conf.all.rp_filter=0, that does not override
a greater rp_filter value on the individual interfaces. We also need to set
net.ipv4.conf.default.rp_filter=0 before creating the interfaces. That way,
they'll also get their own rp_filter value of zero.

Fixes: 0fde56e4 ("selftests: bpf: add test_lwt_ip_encap selftest")
Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/b1cdd9d469f09ea6e01e9c89a6071c79b7380f89.1632386362.git.jbenc@redhat.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 897d1401
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -112,6 +112,14 @@ setup()
	ip netns add "${NS2}"
	ip netns add "${NS3}"

	# rp_filter gets confused by what these tests are doing, so disable it
	ip netns exec ${NS1} sysctl -wq net.ipv4.conf.all.rp_filter=0
	ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0
	ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0
	ip netns exec ${NS1} sysctl -wq net.ipv4.conf.default.rp_filter=0
	ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0
	ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0

	ip link add veth1 type veth peer name veth2
	ip link add veth3 type veth peer name veth4
	ip link add veth5 type veth peer name veth6
@@ -236,11 +244,6 @@ setup()
	ip -netns ${NS1} -6 route add ${IPv6_GRE}/128 dev veth5 via ${IPv6_6} ${VRF}
	ip -netns ${NS2} -6 route add ${IPv6_GRE}/128 dev veth7 via ${IPv6_8} ${VRF}

	# rp_filter gets confused by what these tests are doing, so disable it
	ip netns exec ${NS1} sysctl -wq net.ipv4.conf.all.rp_filter=0
	ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0
	ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0

	TMPFILE=$(mktemp /tmp/test_lwt_ip_encap.XXXXXX)

	sleep 1  # reduce flakiness