Skip to contentSkip to conversation

Propagate MAC address changes to VLANs

PATCH In review Mike Manning 2 participants 2 messages Feb 23, 2016 – Feb 25, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Propagate MAC address changes to VLANs

The MAC address of the physical interface is only copied to the VLAN when it is first created, resulting in an inconsistency after MAC address changes of only newly created VLANs having an up-to-date MAC.

Continuing to inherit the MAC address unless explicitly changed for the VLAN allows IPv6 EUI64 addresses for the VLAN to reflect the change and thus for DAD to behave as expected for the given MAC.

---
 net/8021q/vlan.c |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
net/8021q/vlan.c +6 -11
@@ -293,15 +293,15 @@ static void vlan_sync_address(struct net
 
     /* vlan address was different from the old address and is equal to
      * the new address */
-    if (!ether_addr_equal(vlandev->dev_addr, vlan->real_dev_addr) &&
+    if ((vlandev->flags & IFF_UP) &&
+        !ether_addr_equal(vlandev->dev_addr, vlan->real_dev_addr) &&
         ether_addr_equal(vlandev->dev_addr, dev->dev_addr))
         dev_uc_del(dev, vlandev->dev_addr);
 
-    /* vlan address was equal to the old address and is different from
+    /* vlan address was equal to the old address so now also inherit
      * the new address */
-    if (ether_addr_equal(vlandev->dev_addr, vlan->real_dev_addr) &&
-        !ether_addr_equal(vlandev->dev_addr, dev->dev_addr))
-        dev_uc_add(dev, vlandev->dev_addr);
+    if (ether_addr_equal(vlandev->dev_addr, vlan->real_dev_addr))
+        ether_addr_copy(vlandev->dev_addr, dev->dev_addr);
 
     ether_addr_copy(vlan->real_dev_addr, dev->dev_addr);
 }
@@ -389,13 +389,8 @@ static int vlan_device_event(struct noti
 
     case NETDEV_CHANGEADDR:
         /* Adjust unicast filters on underlying device */
-        vlan_group_for_each_dev(grp, i, vlandev) {
-            flgs = vlandev->flags;
-            if (!(flgs & IFF_UP))
-                continue;
-
+        vlan_group_for_each_dev(grp, i, vlandev)
             vlan_sync_address(dev, vlandev);
-        }
         break;
 
     case NETDEV_CHANGEMTU:
maintainer
#1 lore raw

From: Mike Manning <[email protected]>
Date: Tue, 23 Feb 2016 20:56:31 +0000

net/8021q/vlan.c static void vlan_sync_address(struct net · line 297

Quoted 9 lines
net/8021q/vlan.c +2 -1
@@ -293,15 +293,15 @@ static void vlan_sync_address(struct net
 
     /* vlan address was different from the old address and is equal to
      * the new address */
-    if (!ether_addr_equal(vlandev->dev_addr, vlan->real_dev_addr) &&
+    if ((vlandev->flags & IFF_UP) &&
+        !ether_addr_equal(vlandev->dev_addr, vlan->real_dev_addr) &&

This patch is corrupted by your email client.

Please read Documentation/email-clients.txt, fix your setup, and email a test patch to yourself.

Only resubmit this patch to the list once you are able to successfully apply the patch in that test email.