From: Omar Ramadan <omar@blockcast.net>
To: Taehee Yoo <ap420073@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
AutonomousCodeSecurity@microsoft.com, Xiang Mei <xmei5@asu.edu>,
tgopinath@linux.microsoft.com, kys@microsoft.com,
Cen Zhang <cenzhang@linux.microsoft.com>
Subject: [PATCH net v4 2/2] selftests: net: amt: check that the relay's queries bypass the amt device
Date: Mon, 28 Sep 2026 23:23:12 +0300 [thread overview]
Message-ID: <20260928202312.74574-3-omar@blockcast.net> (raw)
In-Reply-To: <20260928202312.74574-1-omar@blockcast.net>
The relay used to hand its General Queries to dev_queue_xmit() on the
amt device, where a query could wait in a qdisc and outlive the tunnel
it pointed to. The previous patch sends them directly from the receive
path instead.
Count the IGMP and MLD queries that leave the relay through amtr with
tc flower filters on its egress, installed before the gateway comes
up, and check that there are none. The forwarding tests before it
already show that the gateway received its queries, since it cannot
join without one.
Without the previous patch the new test fails (one run counted 7 IGMP
and 6 MLD queries); with it, all of amt.sh passes.
Signed-off-by: Omar Ramadan <omar@blockcast.net>
---
tools/testing/selftests/net/amt.sh | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/tools/testing/selftests/net/amt.sh b/tools/testing/selftests/net/amt.sh
index 663744305..d13b20ccc 100755
--- a/tools/testing/selftests/net/amt.sh
+++ b/tools/testing/selftests/net/amt.sh
@@ -150,6 +150,13 @@ setup_interface()
ip netns exec "${RELAY}" ip a a 10.0.0.2/24 dev relay_gw
ip netns exec "${RELAY}" ip link add amtr type amt mode relay \
local 10.0.0.2 dev relay_gw relay_port 2268 max_tunnels 4
+ # Count the IGMP and MLD queries that leave the relay through its own
+ # amt device; test_query_egress expects none.
+ ip netns exec "${RELAY}" tc qdisc add dev amtr clsact
+ ip netns exec "${RELAY}" tc filter add dev amtr egress pref 1 \
+ protocol ip flower ip_proto 0x2 action pass
+ ip netns exec "${RELAY}" tc filter add dev amtr egress pref 2 \
+ protocol ipv6 flower ip_proto icmpv6 type 130 action pass
ip netns exec "${RELAY}" ip a a 172.17.0.1/24 dev relay_src
ip netns exec "${RELAY}" ip a a 2001:db8:3::1/64 dev relay_src
ip netns exec "${SOURCE}" ip a a 172.17.0.2/24 dev src_relay
@@ -246,6 +253,27 @@ test_ipv6_forward()
fi
}
+# The relay sends its General Queries straight from the receive path, in
+# the same context that found the tunnel. A query queued on the amt device
+# instead could outlive the tunnel it was built for. The forwarding tests
+# above show that the gateway got its queries.
+test_query_egress()
+{
+ local n4 n6
+
+ n4=$(ip netns exec "${RELAY}" tc -s -j filter show dev amtr egress \
+ pref 1 | jq '[.[].options.actions[0].stats.packets // empty] | add // 0')
+ n6=$(ip netns exec "${RELAY}" tc -s -j filter show dev amtr egress \
+ pref 2 | jq '[.[].options.actions[0].stats.packets // empty] | add // 0')
+ if [ "$n4" -eq 0 ] && [ "$n6" -eq 0 ]; then
+ printf "TEST: %-60s [ OK ]\n" "amt relay queries bypass the amt device"
+ else
+ printf "TEST: %-60s [FAIL]\n" "amt relay queries bypass the amt device"
+ echo "IGMP queries on amtr egress: $n4, MLD queries: $n6" >&2
+ ERR=1
+ fi
+}
+
send_mcast4()
{
sleep 5
@@ -287,6 +315,7 @@ wait $pid || err=$?
if [ $err -eq 1 ]; then
ERR=1
fi
+test_query_egress
printf "TEST: %-50s" "IPv4 amt traffic forwarding torture"
send_mcast_torture4
printf " [ OK ]\n"
--
2.47.3
prev parent reply other threads:[~2026-09-28 20:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 20:23 [PATCH net v4 0/2] amt: send the relay's General Query directly from the receive path Omar Ramadan
2026-09-28 20:23 ` [PATCH net v4 1/2] " Omar Ramadan
2026-09-28 20:23 ` Omar Ramadan [this message]
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=20260928202312.74574-3-omar@blockcast.net \
--to=omar@blockcast.net \
--cc=AutonomousCodeSecurity@microsoft.com \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=cenzhang@linux.microsoft.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=tgopinath@linux.microsoft.com \
--cc=xmei5@asu.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®