diff options
author | Eric Biederman <ebiederm@aristanetworks.com> | 2009-03-13 16:15:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-13 16:15:37 -0400 |
commit | b0832a2961022a076c812384435b5f0290b3fc91 (patch) | |
tree | ca4d0a09e9aabc00f1960a8fb4f2ebd82f49ba8f | |
parent | f7efb6ccc2113911e4e064f78bcd0343c4673038 (diff) |
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: Eric Biederman <ebiederm@aristanetworks.com>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/macvlan.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 7e24b5048686..b5241fc0f512 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -461,12 +461,13 @@ static int macvlan_newlink(struct net_device *dev, | |||
461 | if (lowerdev == NULL) | 461 | if (lowerdev == NULL) |
462 | return -ENODEV; | 462 | return -ENODEV; |
463 | 463 | ||
464 | /* Don't allow macvlans on top of other macvlans - its not really | 464 | /* When creating macvlans on top of other macvlans - use |
465 | * wrong, but lockdep can't handle it and its not useful for anything | 465 | * the real device as the lowerdev. |
466 | * you couldn't do directly on top of the real device. | ||
467 | */ | 466 | */ |
468 | if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) | 467 | if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) { |
469 | return -ENODEV; | 468 | struct macvlan_dev *lowervlan = netdev_priv(lowerdev); |
469 | lowerdev = lowervlan->lowerdev; | ||
470 | } | ||
470 | 471 | ||
471 | if (!tb[IFLA_MTU]) | 472 | if (!tb[IFLA_MTU]) |
472 | dev->mtu = lowerdev->mtu; | 473 | dev->mtu = lowerdev->mtu; |