Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61345fab authored by Petr Machata's avatar Petr Machata Committed by David S. Miller
Browse files

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: default avatarPetr Machata <petrm@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b89df65c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -759,10 +759,13 @@ EXPORT_SYMBOL_GPL(ipvlan_link_register);
static int ipvlan_device_event(struct notifier_block *unused,
			       unsigned long event, void *ptr)
{
	struct netlink_ext_ack *extack = netdev_notifier_info_to_extack(ptr);
	struct netdev_notifier_pre_changeaddr_info *prechaddr_info;
	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
	struct ipvl_dev *ipvlan, *next;
	struct ipvl_port *port;
	LIST_HEAD(lst_kill);
	int err;

	if (!netif_is_ipvlan_port(dev))
		return NOTIFY_DONE;
@@ -818,6 +821,17 @@ static int ipvlan_device_event(struct notifier_block *unused,
			ipvlan_adjust_mtu(ipvlan, dev);
		break;

	case NETDEV_PRE_CHANGEADDR:
		prechaddr_info = ptr;
		list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
			err = dev_pre_changeaddr_notify(ipvlan->dev,
						    prechaddr_info->dev_addr,
						    extack);
			if (err)
				return notifier_from_errno(err);
		}
		break;

	case NETDEV_CHANGEADDR:
		list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
			ether_addr_copy(ipvlan->dev->dev_addr, dev->dev_addr);