Commit 9822c4fc authored by Eric Dumazet's avatar Eric Dumazet Committed by Khalid Elmously

macvlan: use skb_reset_mac_header() in macvlan_queue_xmit()

BugLink: https://bugs.launchpad.net/bugs/1860681

[ Upstream commit 1712b2ff ]

I missed the fact that macvlan_broadcast() can be used both
in RX and TX.

skb_eth_hdr() makes only sense in TX paths, so we can not
use it blindly in macvlan_broadcast()

Fixes: 96cc4b69 ("macvlan: do not assume mac_header is set in macvlan_broadcast()")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarJurgen Van Ham <juvanham@gmail.com>
Tested-by: default avatarMatteo Croce <mcroce@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 5ee41309
...@@ -233,7 +233,7 @@ static void macvlan_broadcast(struct sk_buff *skb, ...@@ -233,7 +233,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
struct net_device *src, struct net_device *src,
enum macvlan_mode mode) enum macvlan_mode mode)
{ {
const struct ethhdr *eth = skb_eth_hdr(skb); const struct ethhdr *eth = eth_hdr(skb);
const struct macvlan_dev *vlan; const struct macvlan_dev *vlan;
struct sk_buff *nskb; struct sk_buff *nskb;
unsigned int i; unsigned int i;
...@@ -476,10 +476,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -476,10 +476,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
const struct macvlan_dev *dest; const struct macvlan_dev *dest;
if (vlan->mode == MACVLAN_MODE_BRIDGE) { if (vlan->mode == MACVLAN_MODE_BRIDGE) {
const struct ethhdr *eth = (void *)skb->data; const struct ethhdr *eth = skb_eth_hdr(skb);
/* send to other bridge ports directly */ /* send to other bridge ports directly */
if (is_multicast_ether_addr(eth->h_dest)) { if (is_multicast_ether_addr(eth->h_dest)) {
skb_reset_mac_header(skb);
macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE); macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
goto xmit_world; goto xmit_world;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment