Patchwork [2/2] veth: Allow to create peer link with given ifindex

login
register
mail settings
Submitter Pavel Emelyanov
Date July 30, 2012, 4:36 a.m.
Message ID <50160F69.7020205@parallels.com>
Download mbox | patch
Permalink /patch/173953/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Pavel Emelyanov - July 30, 2012, 4:36 a.m.
The ifinfomsg is in there (thanks kaber@ for foreseeing this long time ago),
so take the given ifidex and register netdev with it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 5852361..496c026 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -348,6 +348,9 @@  static int veth_newlink(struct net *src_net, struct net_device *dev,
 	if (tbp[IFLA_ADDRESS] == NULL)
 		eth_hw_addr_random(peer);
 
+	if (ifmp)
+		peer->ifindex = ifmp->ifi_index;
+
 	err = register_netdevice(peer);
 	put_net(net);
 	net = NULL;