From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Subject: [Devel] [PATCH vz10 1/4] selftests: netfilter: do not inherit forwarding and redirects
Date: Fri, 21 Aug 2026 18:18:44 +0300 [thread overview]
Message-ID: <20260821151850.796438-1-eva.kurchatova@virtuozzo.com> (raw)
A new namespace takes ip_forward and send_redirects from the host, so
two tests depend on how the machine outside them is configured.
On a host that forwards, which any hypervisor does, nft_fib's ns1 and
ns2 send the test packets back at the router until their TTL runs out,
and the fib counters end at 31 or 62 packets instead of 1:
FAIL: fibif4 not empty
elements = { "veth1" . 10.0.1.99 . "veth0" counter packets 62 ...
Only nsrouter is meant to forward, so turn forwarding off in the
endpoints. conntrack_icmp_related needs the opposite: images routinely
turn send_redirects off, and the router then never sends the redirect
the test waits for:
ERROR: counter redir4 in nsclient1 has unexpected value
Set both where the test needs them rather than relying on the host.
https://virtuozzo.atlassian.net/browse/VSTOR-139651
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../selftests/net/netfilter/conntrack_icmp_related.sh | 6 ++++++
tools/testing/selftests/net/netfilter/nft_fib.sh | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/tools/testing/selftests/net/netfilter/conntrack_icmp_related.sh b/tools/testing/selftests/net/netfilter/conntrack_icmp_related.sh
index c63d840ead61..44a98c53d085 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
diff --git a/tools/testing/selftests/net/netfilter/nft_fib.sh b/tools/testing/selftests/net/netfilter/nft_fib.sh
index 9929a9ffef65..c818b544e57b 100755
--- a/tools/testing/selftests/net/netfilter/nft_fib.sh
+++ b/tools/testing/selftests/net/netfilter/nft_fib.sh
@@ -29,6 +29,14 @@ setup_ns nsrouter ns1 ns2
trap cleanup EXIT
+# A new namespace inherits ip_forward from the host, and on a host that
+# forwards, ns1 and ns2 bounce the test packets back at the router until
+# their TTL runs out. Only nsrouter is meant to forward here.
+for ns in "$ns1" "$ns2"; do
+ ip netns exec "$ns" sysctl -q net.ipv4.ip_forward=0
+ ip netns exec "$ns" sysctl -q net.ipv6.conf.all.forwarding=0
+done
+
if dmesg | grep -q ' nft_rpfilter: ';then
dmesg -c | grep ' nft_rpfilter: '
echo "WARN: a previous test run has failed" 1>&2
--
2.55.0
next reply other threads:[~2026-08-21 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 15:18 Eva Kurchatova [this message]
2026-08-21 15:18 ` [Devel] [PATCH vz10 2/4] selftests: netfilter: add the veth pair from inside the namespace Eva Kurchatova
2026-08-21 15:18 ` [Devel] [PATCH vz10 3/4] selftests: netfilter: skip rpath.sh without the nft tool Eva Kurchatova
2026-08-21 15:18 ` [Devel] [PATCH vz10 4/4] selftests: netfilter: nf_conntrack_expect_max is pernet here Eva Kurchatova
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821151850.796438-1-eva.kurchatova@virtuozzo.com \
--to=eva.kurchatova@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.