Thread (2 messages) flat view 2 messages, 2 authors, 2025-03-27

Re: [PATCH] net: bridge: set skb->protocol for 802.1Q VLAN packets

From: Nikolay Aleksandrov <razor@blackwall.org>
Date: 2025-03-27 22:45:40
Also in: bridge

On 3/26/25 20:11, inuc@qq.com wrote:
quoted hunk ↗ jump to hunk
From: Liu Jie <redacted>

When bridging locally originated VLAN-tagged packets, we must ensure
skb->protocol is properly set to ETH_P_8021Q. Currently, if this field
remains unset, br_allowed_ingress() may incorrectly drop valid VLAN
packets during the bridge transmission path.

Fix this by explicitly checking eth_hdr(skb)->h_proto for VLAN tags when
handling locally generated packets.

Signed-off-by: Liu Jie <redacted>
---
  net/bridge/br_device.c | 3 +++
  1 file changed, 3 insertions(+)
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 0ab4613aa..9094ba7e4 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -63,6 +63,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
  	skb_reset_mac_header(skb);
  	skb_pull(skb, ETH_HLEN);
  
+	if (eth_hdr(skb)->h_proto == htons(ETH_P_8021Q))
+		skb->protocol = htons(ETH_P_8021Q);
+
  	if (!br_allowed_ingress(br, br_vlan_group_rcu(br), skb, &vid,
  				&state, &vlan))
  		goto out;
Why do you think the protocol is incorrect? Did you see a problem with
some particular setup?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help