netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] macvlan: Support creating macvtaps from macvlans
@ 2013-12-03  4:13 Kevin Wallace
  2013-12-03  8:24 ` Michal Kubecek
  2013-12-03 10:55 ` [PATCH v2] " Kevin Wallace
  0 siblings, 2 replies; 11+ messages in thread
From: Kevin Wallace @ 2013-12-03  4:13 UTC (permalink / raw)
  To: netdev; +Cc: Kevin Wallace

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.

Signed-off-by: Kevin Wallace <kevin@pentabarf.net>
---
 drivers/net/macvlan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 16b43bf..3fa86cb 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -757,6 +757,8 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])
 	return 0;
 }
 
+static struct rtnl_link_ops macvlan_link_ops;
+
 int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
 			   struct nlattr *tb[], struct nlattr *data[],
 			   int (*receive)(struct sk_buff *skb),
@@ -775,10 +777,10 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
 	if (lowerdev == NULL)
 		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.
 	 */
-	if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) {
+	if (lowerdev->rtnl_link_ops == &macvlan_link_ops) {
 		struct macvlan_dev *lowervlan = netdev_priv(lowerdev);
 		lowerdev = lowervlan->lowerdev;
 	}
-- 
1.8.3.2

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

end of thread, other threads:[~2013-12-06  0:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03  4:13 [PATCH] macvlan: Support creating macvtaps from macvlans Kevin Wallace
2013-12-03  8:24 ` Michal Kubecek
2013-12-03  9:58   ` Kevin Wallace
2013-12-03 10:55 ` [PATCH v2] " Kevin Wallace
2013-12-03 16:17   ` Vlad Yasevich
2013-12-03 17:46     ` Kevin Wallace
2013-12-03 19:47     ` Michal Kubecek
2013-12-04 13:59       ` Vlad Yasevich
2013-12-04 14:23         ` Michal Kubecek
2013-12-04 14:57           ` Vlad Yasevich
2013-12-06  0:59   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).