diff mbox

vlan: Set correct source MAC address with TX VLAN offload enabled

Message ID 1394464635.27812.7.camel@peter-laptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Peter Boström March 10, 2014, 3:17 p.m. UTC
With TX VLAN offload enabled the source MAC address for frames sent using the
VLAN interface is currently set to the address of the real interface. This is
wrong since the VLAN interface may be configured with a different address.

The bug was introduced in commit 2205369a314e12fcec4781cc73ac9c08fc2b47de
("vlan: Fix header ops passthru when doing TX VLAN offload.").

This patch sets the source address before calling the create function of the
real interface.

Signed-off-by: Peter Boström <peter.bostrom@netrounds.com>
---
 net/8021q/vlan_dev.c | 3 +++
 1 file changed, 3 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller March 11, 2014, 2:22 a.m. UTC | #1
From: Peter Boström <peter.bostrom@netrounds.com>
Date: Mon, 10 Mar 2014 16:17:15 +0100

> With TX VLAN offload enabled the source MAC address for frames sent using the
> VLAN interface is currently set to the address of the real interface. This is
> wrong since the VLAN interface may be configured with a different address.
> 
> The bug was introduced in commit 2205369a314e12fcec4781cc73ac9c08fc2b47de
> ("vlan: Fix header ops passthru when doing TX VLAN offload.").
> 
> This patch sets the source address before calling the create function of the
> real interface.
> 
> Signed-off-by: Peter Boström <peter.bostrom@netrounds.com>

Good catch.

Applied and queued up for -stable, thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index de51c48..4b65aa4 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -538,6 +538,9 @@  static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev
 	struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
 	struct net_device *real_dev = vlan->real_dev;
 
+	if (saddr == NULL)
+		saddr = dev->dev_addr;
+
 	return dev_hard_header(skb, real_dev, type, daddr, saddr, len);
 }