All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] macvlan: Support creating macvlans from macvlans
@ 2009-03-05 23:12 Eric W. Biederman
  2009-03-06 13:54 ` Patrick McHardy
  0 siblings, 1 reply; 16+ messages in thread
From: Eric W. Biederman @ 2009-03-05 23:12 UTC (permalink / raw)
  To: David Miller; +Cc: Patrick McHardy, netdev


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>
---
 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 7e24b50..b5241fc 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -461,12 +461,13 @@ static int macvlan_newlink(struct net_device *dev,
 	if (lowerdev == NULL)
 		return -ENODEV;
 
-	/* Don't allow macvlans on top of other macvlans - its not really
-	 * wrong, but lockdep can't handle it and its not useful for anything
-	 * you couldn't do directly on top of the real device.
+	/* When creating macvlans on top of other macvlans - use
+	 * the real device as the lowerdev.
 	 */
-	if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops)
-		return -ENODEV;
+	if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) {
+		struct macvlan_dev *lowervlan = netdev_priv(lowerdev);
+		lowerdev = lowervlan->lowerdev;
+	}
 
 	if (!tb[IFLA_MTU])
 		dev->mtu = lowerdev->mtu;
-- 
1.6.1.2.350.g88cc


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2009-03-13 20:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-05 23:12 [PATCH] macvlan: Support creating macvlans from macvlans Eric W. Biederman
2009-03-06 13:54 ` Patrick McHardy
2009-03-06 14:17   ` Eric W. Biederman
2009-03-06 14:25     ` Patrick McHardy
2009-03-06 15:03       ` Eric W. Biederman
2009-03-06 15:08         ` Patrick McHardy
2009-03-06 15:24           ` Eric W. Biederman
2009-03-06 15:33             ` Patrick McHardy
2009-03-06 15:50               ` Eric W. Biederman
2009-03-06 15:56                 ` Patrick McHardy
2009-03-06 17:07             ` Ben Greear
2009-03-06 20:16               ` [PATCH] macvlan: Deterministic ingress packet delivery Eric W. Biederman
2009-03-07 16:36                 ` Ben Greear
2009-03-09 13:25                 ` Patrick McHardy
2009-03-13 20:16                   ` David Miller
2009-03-13 20:15           ` [PATCH] macvlan: Support creating macvlans from macvlans David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.