mt7530/mt7531: kernel STP is blind on VLAN-aware bridges
Describe the bug
mt7530/mt7531: kernel STP is blind on VLAN-aware bridges since 6.12.y took half of a mainline series (BPDUs arrive VLAN-tagged, bridge drops them)
Summary
On MT7530/MT7531 (DSA) with a VLAN-aware bridge (vlan_filtering 1), the kernel bridge STP never processes
BPDUs received from a neighbouring switch. The switch chip delivers every trapped link-local frame to the
CPU with the ingress port's PVID tag, and the kernel drops 802.1Q-tagged BPDUs silently (no VLAN upper on the
DSA port, so __netif_receive_skb_core() marks them PACKET_OTHERHOST and llc_rcv() discards them).
The bridge therefore always elects itself root, never blocks a redundant link, and a physical loop through
two switch ports is not detected. Result: broadcast storm.
Cause: linux-6.12.y backported mainline commit 3ac85bcfd404 ("net: dsa: mt7530: preserve VLAN tags on trapped
link-local frames", stable id 0692849346451f) without its companion 4cb3cd670b2a ("net: dsa: mt7530: untag
VLAN-aware bridge PVID"). The first changes the BPC/RGAC egress tag attribute from EG_UNTAGGED to
EG_DISABLED, so trapped frames now get the CPU port's consistent (tagged) VLAN treatment. The second sets
ds->untag_vlan_aware_bridge_pvid so the DSA core strips that PVID tag in software again. Only the second
makes the first correct for STP. Before the backport, EG_UNTAGGED stripped the tag in hardware and STP worked.
Both include/kernel-6.12 (6.12.108) and 6.12.94 carry 0692849 and lack 4cb3cd67. There is no OpenWrt patch
covering it in target/linux/generic/{backport,pending,hack}-6.12 on openwrt-25.12.
Environment
- Target: mediatek/filogic, MT7981 SoC with MT7531 switch (DSA,
mt7530-mdio mdio-bus:1f) - OpenWrt 25.12 (kernel 6.12.94, r33051-f5dae5ece4); openwrt-25.12 HEAD (6.12.108) has the same code
- Bridge
switch0with lan1-lan4, wan1;vlan_filtering 1; lan ports PVID 1 untagged, VLANs 2/4/5 tagged - Peer: Ubiquiti US-48 (RSTP), which falls back to 802.1D on the port
Steps to reproduce
brctl addbr switch0; brctl addif switch0 lan1; brctl stp switch0 on; ip link set switch0 type bridge vlan_filtering 1(lan1 PVID 1 untagged), connect lan1 to any STP-speaking switch with a better bridge id.tcpdump -e -vv -ni lan1 stpbrctl showstp switch0
Observed
BPDUs from the peer arrive on lan1 tagged, although they are untagged on the wire:
18:e8:29:xx:xx:10 > 01:80:c2:00:00:00, ethertype 802.1Q (0x8100), length 64: vlan 1, p 0, 802.3LLC ...
STP 802.1d, Config, bridge-id 8000.18:e8:29:xx:xx:0f.802f
root-id 2000.d0:21:f9:xx:xx:86, root-pathcost 40000Our own BPDUs go out untagged (802.3, length 38). Removing lan1 from the bridge (port standalone, VLAN
unaware) makes the same peer BPDUs arrive untagged, so the tag is added by the switch chip, not by the peer.
The bridge never sees them: designated root stays our own id, root port 0, message age timer 0.00 on
lan1, /sys/class/net/switch0/bridge/stp_state is 1, group_addr is 01:80:c2:00:00:00, bpdu_guard 0.
With a second cable into the same peer network (lan2) nothing blocks and a storm follows:
vlan4: received packet on switch0.4 with own address as source address (addr:4c:33:29:xx:xx:04, vlan:0)
net_ratelimit: 242955 callbacks suppressedExpected
BPDUs reach the bridge untagged (as on the wire), the bridge adopts the peer's root and puts the redundant port in blocking.
Fix
Backport 4cb3cd670b2a (two lines, applies to 6.12.94 and 6.12.108 with offset; the DSA core in 6.12 already
has untag_vlan_aware_bridge_pvid and dsa_software_vlan_untag()):
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ mt7530_setup(struct dsa_switch *ds)
ds->assisted_learning_on_cpu_port = true;
+ ds->untag_vlan_aware_bridge_pvid = true;
ds->mtu_enforcement_ingress = true;
@@ mt7531_setup_common(struct dsa_switch *ds)
ds->assisted_learning_on_cpu_port = true;
+ ds->untag_vlan_aware_bridge_pvid = true;
ds->mtu_enforcement_ingress = true;Patch file for target/linux/generic/backport-6.12/ attached. This is also the fix for the original
report behind that series (#18576, untagged PVID traffic not reaching bridge VLAN uppers), which 25.12 is
now exposed to as well. It should probably go to stable too (linux-6.12.y has the same half-series).
OpenWrt version
r33051-f5dae5ece4
OpenWrt release
25.12.5
OpenWrt target/subtarget
mediatek/filogic
Device
zbtlink_zbt-z8102ax
Image kind
Official downloaded image
Steps to reproduce
No response
Actual behaviour
No response
Expected behaviour
No response
Additional info
No response
Diffconfig
Terms
- I am reporting an issue for OpenWrt, not an unsupported fork.
Source: openwrt/openwrt