diff mbox

[net-next,2/2] macvlan: propagate lowerdev mac address changes for passthru mode

Message ID 1401106233-11320-3-git-send-email-dingtianhong@huawei.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Ding Tianhong May 26, 2014, 12:10 p.m. UTC
The macvlan dev should have the same mac address like lowerdev for passthru
mode, so when the lowerdev address changes we should change the macvlan dev
to the new mac address. This patch adds that propagation.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/net/macvlan.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox

Patch

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 7bd9082..55faff3 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -1116,6 +1116,18 @@  static int macvlan_device_event(struct notifier_block *unused,
 			dev_set_mtu(vlan->dev, dev->mtu);
 		}
 		break;
+	case NETDEV_CHANGEADDR:
+		if (!port->passthru)
+			return NOTIFY_DONE;
+
+		vlan = list_first_entry_or_null(&port->vlans,
+						struct macvlan_dev,
+						list);
+
+		if (macvlan_sync_address(vlan->dev, dev->dev_addr))
+			return NOTIFY_BAD;
+
+		break;
 	case NETDEV_UNREGISTER:
 		/* twiddle thumbs on netns device moves */
 		if (dev->reg_state != NETREG_UNREGISTERING)