Re: [PATCH] selftests: net: local_termination: test link-local protocols

From: Vladimir Oltean

Date: Tue Mar 10 2026 - 05:23:52 EST


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@xxxxxxxxxxxxxx>
> ---

With that addressed:

Reviewed-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>
Tested-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>