* [PATCH] selftests: net: local_termination: test link-local protocols
@ 2026-03-09 16:03 Daniel Golle
2026-03-10 9:08 ` Vladimir Oltean
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Golle @ 2026-03-09 16:03 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Alexander Sverdlin, Vladimir Oltean,
Daniel Golle, netdev, linux-kselftest, linux-kernel
Cc: Jonas Gorski
Add tests to local_termination.sh to verify that link-local frames
arrive. On some switches the DSA driver uses bridges to connect the
user ports to their CPU ports. More "intelligent" switches typically
don't forward link-local frames, but may trap them to an internal
microcontroller. The driver may have to change trapping rules, so
link-local frames end up on the DSA CPU ports instead of being
silently dropped or trapped to the internal microcontroller of the
switch.
Add two tests which help to validate this has been done correctly:
- Link-local STP BPDU should always arrive at the Linux netdev
- Link-local LLDP should arrive at standalone ports (and the test
should be skipped on bridged ports similar to how it is done
for the IEEE1588v2/PTP tests)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
.../net/forwarding/local_termination.sh | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/tools/testing/selftests/net/forwarding/local_termination.sh b/tools/testing/selftests/net/forwarding/local_termination.sh
index 1f2bf6e818477..9bc9d25e71368 100755
--- a/tools/testing/selftests/net/forwarding/local_termination.sh
+++ b/tools/testing/selftests/net/forwarding/local_termination.sh
@@ -100,6 +100,15 @@ PTP_1588_IPV6_PDELAY_REQ=" \
00 00 3e 37 63 ff fe cf 17 0e 00 01 00 01 05 7f \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
00 00 00 00 00 00"
+LINK_LOCAL_STP_BPDU=" \
+01:80:c2:00:00:00 00:00:de:ad:be:ef 00 26 42 42 03 \
+00 00 00 00 00 80 00 aa bb cc dd ee ff 00 00 00 00 \
+80 00 aa bb cc dd ee ff 80 01 00 00 14 00 02 00 \
+0f 00"
+LINK_LOCAL_LLDP=" \
+01:80:c2:00:00:0e 00:00:de:ad:be:ef 88:cc 02 07 04 \
+00 11 22 33 44 55 04 05 05 65 74 68 30 06 02 00 \
+78 00 00"
# Disable promisc to ensure we don't receive unknown MAC DA packets
export TCPDUMP_EXTRA_FLAGS="-pl"
@@ -213,7 +222,15 @@ run_test()
mc_route_destroy $rcv_if_name
mc_route_destroy $send_if_name
+ ip maddress add 01:80:c2:00:00:00 dev $rcv_if_name
+ send_raw $send_if_name "$LINK_LOCAL_STP_BPDU"
+ ip maddress del 01:80:c2:00:00:00 dev $rcv_if_name
+
if [ $skip_ptp = false ]; then
+ ip maddress add 01:80:c2:00:00:0e dev $rcv_if_name
+ send_raw $send_if_name "$LINK_LOCAL_LLDP"
+ ip maddress del 01:80:c2:00:00:0e dev $rcv_if_name
+
ip maddress add 01:1b:19:00:00:00 dev $rcv_if_name
send_raw $send_if_name "$PTP_1588_L2_SYNC"
send_raw $send_if_name "$PTP_1588_L2_FOLLOW_UP"
@@ -304,7 +321,15 @@ run_test()
"$smac > $UNKNOWN_MACV6_MC_ADDR3, ethertype IPv6 (0x86dd)" \
true "$test_name"
+ check_rcv $rcv_if_name "Link-local STP BPDU" \
+ "> 01:80:c2:00:00:00" \
+ true "$test_name"
+
if [ $skip_ptp = false ]; then
+ check_rcv $rcv_if_name "Link-local LLDP" \
+ "> 01:80:c2:00:00:0e" \
+ true "$test_name"
+
check_rcv $rcv_if_name "1588v2 over L2 transport, Sync" \
"ethertype PTP (0x88f7).* PTPv2.* msg type *: sync msg" \
true "$test_name"
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests: net: local_termination: test link-local protocols
2026-03-09 16:03 [PATCH] selftests: net: local_termination: test link-local protocols Daniel Golle
@ 2026-03-10 9:08 ` Vladimir Oltean
0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Oltean @ 2026-03-10 9:08 UTC (permalink / raw)
To: Daniel Golle
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Alexander Sverdlin, netdev,
linux-kselftest, linux-kernel, Jonas Gorski
On Mon, Mar 09, 2026 at 04:03:57PM +0000, Daniel Golle wrote:
> Add tests to local_termination.sh to verify that link-local frames
> arrive. On some switches the DSA driver uses bridges to connect the
> user ports to their CPU ports. More "intelligent" switches typically
> don't forward link-local frames, but may trap them to an internal
> microcontroller. The driver may have to change trapping rules, so
> link-local frames end up on the DSA CPU ports instead of being
> silently dropped or trapped to the internal microcontroller of the
> switch.
>
> Add two tests which help to validate this has been done correctly:
> - Link-local STP BPDU should always arrive at the Linux netdev
I don't really like the "always" comment here. The only reason why STP
is part of the forwarding plane and not the control plane is because the
bridge has stp_state=0. See br_handle_frame():
if (unlikely(is_link_local_ether_addr(dest))) {
u16 fwd_mask = p->br->group_fwd_mask_required;
/*
* See IEEE 802.1D Table 7-10 Reserved addresses
*
* Assignment Value
* Bridge Group Address 01-80-C2-00-00-00
* (MAC Control) 802.3 01-80-C2-00-00-01
* (Link Aggregation) 802.3 01-80-C2-00-00-02
* 802.1X PAE address 01-80-C2-00-00-03
*
* 802.1AB LLDP 01-80-C2-00-00-0E
*
* Others reserved for future standardization
*/
fwd_mask |= p->group_fwd_mask;
switch (dest[5]) {
case 0x00: /* Bridge Group Address */
/* If STP is turned off,
then must forward to keep loop detection */
if (p->br->stp_enabled == BR_NO_STP ||
fwd_mask & (1u << dest[5]))
goto forward;
*pskb = skb;
__br_handle_local_finish(skb);
return RX_HANDLER_PASS;
perhaps this can be part of the commit message somehow.
> - Link-local LLDP should arrive at standalone ports (and the test
> should be skipped on bridged ports similar to how it is done
> for the IEEE1588v2/PTP tests)
>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
With that addressed:
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-10 9:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 16:03 [PATCH] selftests: net: local_termination: test link-local protocols Daniel Golle
2026-03-10 9:08 ` Vladimir Oltean
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox