summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2018-12-13 06:54:41 -0500
committerDavid S. Miller <davem@davemloft.net>2018-12-13 21:41:38 -0500
commit61345fab484b97cca47149c90396c74ac76072f5 (patch)
tree24076d11d7789ae27d2782755bbff153cf50e3cb
parentb89df65c5e2ab2ce674997e44e87452f4d2e9b05 (diff)
net: ipvlan: Issue NETDEV_PRE_CHANGEADDR
A NETDEV_CHANGEADDR event implies a change of address of each of the IPVLANs of this IPVLAN device. Therefore propagate NETDEV_PRE_CHANGEADDR to all the IPVLANs. Signed-off-by: Petr Machata <petrm@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ipvlan/ipvlan_main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 723a3f663c06..19bdde60680c 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -759,10 +759,13 @@ EXPORT_SYMBOL_GPL(ipvlan_link_register);
759static int ipvlan_device_event(struct notifier_block *unused, 759static int ipvlan_device_event(struct notifier_block *unused,
760 unsigned long event, void *ptr) 760 unsigned long event, void *ptr)
761{ 761{
762 struct netlink_ext_ack *extack = netdev_notifier_info_to_extack(ptr);
763 struct netdev_notifier_pre_changeaddr_info *prechaddr_info;
762 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 764 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
763 struct ipvl_dev *ipvlan, *next; 765 struct ipvl_dev *ipvlan, *next;
764 struct ipvl_port *port; 766 struct ipvl_port *port;
765 LIST_HEAD(lst_kill); 767 LIST_HEAD(lst_kill);
768 int err;
766 769
767 if (!netif_is_ipvlan_port(dev)) 770 if (!netif_is_ipvlan_port(dev))
768 return NOTIFY_DONE; 771 return NOTIFY_DONE;
@@ -818,6 +821,17 @@ static int ipvlan_device_event(struct notifier_block *unused,
818 ipvlan_adjust_mtu(ipvlan, dev); 821 ipvlan_adjust_mtu(ipvlan, dev);
819 break; 822 break;
820 823
824 case NETDEV_PRE_CHANGEADDR:
825 prechaddr_info = ptr;
826 list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
827 err = dev_pre_changeaddr_notify(ipvlan->dev,
828 prechaddr_info->dev_addr,
829 extack);
830 if (err)
831 return notifier_from_errno(err);
832 }
833 break;
834
821 case NETDEV_CHANGEADDR: 835 case NETDEV_CHANGEADDR:
822 list_for_each_entry(ipvlan, &port->ipvlans, pnode) { 836 list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
823 ether_addr_copy(ipvlan->dev->dev_addr, dev->dev_addr); 837 ether_addr_copy(ipvlan->dev->dev_addr, dev->dev_addr);