Commit b0832a29 authored by Eric Biederman's avatar Eric Biederman Committed by David S. Miller

macvlan: Support creating macvlans from macvlans

When running in a network namespace whose only link to
the outside world is a macvlan device, not being
able to create another macvlan is a real pain.

So modify macvlan creation to allow automatically forward
a creation of a macvlan on a macvlan to become a creation
of a macvlan on the underlying network device.
Signed-off-by: default avatarEric Biederman <ebiederm@aristanetworks.com>
Acked-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f7efb6cc
...@@ -461,12 +461,13 @@ static int macvlan_newlink(struct net_device *dev, ...@@ -461,12 +461,13 @@ static int macvlan_newlink(struct net_device *dev,
if (lowerdev == NULL) if (lowerdev == NULL)
return -ENODEV; return -ENODEV;
/* Don't allow macvlans on top of other macvlans - its not really /* When creating macvlans on top of other macvlans - use
* wrong, but lockdep can't handle it and its not useful for anything * the real device as the lowerdev.
* you couldn't do directly on top of the real device.
*/ */
if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) {
return -ENODEV; struct macvlan_dev *lowervlan = netdev_priv(lowerdev);
lowerdev = lowervlan->lowerdev;
}
if (!tb[IFLA_MTU]) if (!tb[IFLA_MTU])
dev->mtu = lowerdev->mtu; dev->mtu = lowerdev->mtu;
......
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