mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
macvlan: Support creating macvtaps from macvlans
When running in a network namespace whose only link to the outside world is a macvlan device, not being able to create a macvtap off of it is a real pain. So modify macvtap creation to automatically forward a creation of a macvtap on a macvlan to become a creation of a macvtap on the underlying network device, just like is currently done with macvlan-on-macvlan devices. v2: Use netif_is_macvlan and macvlan_dev_real_dev helpers to make it more clear what we're doing. Signed-off-by: Kevin Wallace <kevin@pentabarf.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
426e1fa31e
commit
d70f2cf520
1 changed files with 3 additions and 5 deletions
|
@ -820,13 +820,11 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
|
||||||
if (lowerdev == NULL)
|
if (lowerdev == NULL)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* When creating macvlans on top of other macvlans - use
|
/* When creating macvlans or macvtaps on top of other macvlans - use
|
||||||
* the real device as the lowerdev.
|
* the real device as the lowerdev.
|
||||||
*/
|
*/
|
||||||
if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) {
|
if (netif_is_macvlan(lowerdev))
|
||||||
struct macvlan_dev *lowervlan = netdev_priv(lowerdev);
|
lowerdev = macvlan_dev_real_dev(lowerdev);
|
||||||
lowerdev = lowervlan->lowerdev;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tb[IFLA_MTU])
|
if (!tb[IFLA_MTU])
|
||||||
dev->mtu = lowerdev->mtu;
|
dev->mtu = lowerdev->mtu;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue