[Devel] [PATCH hci-8.1 v3 2/5] selftests: netfilter: let the router send redirects
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Sep 24 14:06:07 MSK 2026
From: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
The icmp_redirect part of conntrack_icmp_related.sh waits for the router
to send an ICMP redirect, but a new namespace takes send_redirects from
init_net, and it is commonly turned off there:
# ip netns exec "$nsrouter1" \
# cat /proc/sys/net/ipv4/conf/all/send_redirects
0
with nothing sent, the test times out waiting. Ask for it on the router
that is supposed to send them.
https://virtuozzo.atlassian.net/browse/VSTOR-139651
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Reviewed-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
v3: say the value is copied from init_net rather than from the
creating namespace.
---
tools/testing/selftests/net/netfilter/conntrack_icmp_related.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/testing/selftests/net/netfilter/conntrack_icmp_related.sh b/tools/testing/selftests/net/netfilter/conntrack_icmp_related.sh
index c63d840ead61f..44a98c53d085e 100755
--- a/tools/testing/selftests/net/netfilter/conntrack_icmp_related.sh
+++ b/tools/testing/selftests/net/netfilter/conntrack_icmp_related.sh
@@ -253,6 +253,12 @@ else
fi
# add 'bad' route, expect icmp REDIRECT to be generated
+# A new namespace inherits send_redirects from the host, where it is
+# often turned off; without it the router never sends the redirect this
+# part of the test waits for.
+ip netns exec "$nsrouter1" sysctl -q net.ipv4.conf.all.send_redirects=1
+ip netns exec "$nsrouter1" sysctl -q net.ipv4.conf.default.send_redirects=1
+
ip netns exec "${nsclient1}" ip route add 192.168.1.42 via 192.168.1.1
ip netns exec "${nsclient1}" ip route add dead:1::42 via dead:1::1
--
2.43.0
More information about the Devel
mailing list