Skip to content

Commit

Permalink
macvlan: add link to upper device
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Jan 4, 2013
1 parent 9ff162a commit 7cd43db
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

err = netdev_upper_dev_link(lowerdev, dev);
if (err)
goto destroy_port;

port->count += 1;
err = register_netdevice(dev);
if (err < 0)
goto destroy_port;
goto upper_dev_unlink;

list_add_tail(&vlan->list, &port->vlans);
netif_stacked_transfer_operstate(lowerdev, dev);

return 0;

upper_dev_unlink:
netdev_upper_dev_unlink(lowerdev, dev);
destroy_port:
port->count -= 1;
if (!port->count)
Expand All @@ -797,6 +803,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head)

list_del(&vlan->list);
unregister_netdevice_queue(dev, head);
netdev_upper_dev_unlink(vlan->lowerdev, dev);
}
EXPORT_SYMBOL_GPL(macvlan_dellink);

Expand Down

0 comments on commit 7cd43db

Please sign in to comment.