Commit 7cd43db7 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

macvlan: add link to upper device

Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9ff162a8
...@@ -764,16 +764,22 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, ...@@ -764,16 +764,22 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN); memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN);
} }
err = netdev_upper_dev_link(lowerdev, dev);
if (err)
goto destroy_port;
port->count += 1; port->count += 1;
err = register_netdevice(dev); err = register_netdevice(dev);
if (err < 0) if (err < 0)
goto destroy_port; goto upper_dev_unlink;
list_add_tail(&vlan->list, &port->vlans); list_add_tail(&vlan->list, &port->vlans);
netif_stacked_transfer_operstate(lowerdev, dev); netif_stacked_transfer_operstate(lowerdev, dev);
return 0; return 0;
upper_dev_unlink:
netdev_upper_dev_unlink(lowerdev, dev);
destroy_port: destroy_port:
port->count -= 1; port->count -= 1;
if (!port->count) if (!port->count)
...@@ -797,6 +803,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head) ...@@ -797,6 +803,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head)
list_del(&vlan->list); list_del(&vlan->list);
unregister_netdevice_queue(dev, head); unregister_netdevice_queue(dev, head);
netdev_upper_dev_unlink(vlan->lowerdev, dev);
} }
EXPORT_SYMBOL_GPL(macvlan_dellink); EXPORT_SYMBOL_GPL(macvlan_dellink);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment