Thread (12 messages) flat view 12 messages, 1 author, 16h ago
HOTtoday

[PATCH net-next 07/10] macvlan: do not assume mac header is set in macvlan_broadcast()

From: Eric Dumazet <edumazet@google.com>
Date: 2026-09-02 00:33:58
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

We should not assume mac header is set in output path.

Use skb_eth_hdr() instead of eth_hdr() to fix the issue,
and remove now redundant skb_reset_mac_header() call in macvlan_queue_xmit().

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/macvlan.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index afad90b9222a287214418e93221d569d4d83a1a6..62cf0f6922168984249af647338102f1a8afcb25 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -266,7 +266,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
 			      struct net_device *src,
 			      enum macvlan_mode mode)
 {
-	const struct ethhdr *eth = eth_hdr(skb);
+	const struct ethhdr *eth = skb_eth_hdr(skb);
 	const struct macvlan_dev *vlan;
 	struct sk_buff *nskb;
 	unsigned int i;
@@ -424,7 +424,7 @@ static void macvlan_forward_source_one(struct sk_buff *skb,
 	len = nskb->len + ETH_HLEN;
 	nskb->dev = dev;
 
-	if (ether_addr_equal_64bits(eth_hdr(skb)->h_dest, dev->dev_addr))
+	if (ether_addr_equal_64bits(skb_eth_hdr(skb)->h_dest, dev->dev_addr))
 		nskb->pkt_type = PACKET_HOST;
 
 	ret = __netif_rx(nskb);
@@ -557,7 +557,6 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
 
 		/* send to other bridge ports directly */
 		if (is_multicast_ether_addr(eth->h_dest)) {
-			skb_reset_mac_header(skb);
 			macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
 			goto xmit_world;
 		}
-- 
2.55.0.966.g6673acef38-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help