All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] veth: delay peer link configuration after interfaces are tied
@ 2016-05-29 11:17 Vincent Bernat
  2016-05-30  9:23 ` Nicolas Dichtel
  0 siblings, 1 reply; 20+ messages in thread
From: Vincent Bernat @ 2016-05-29 11:17 UTC (permalink / raw)
  To: David S. Miller, Vijay Pandurangan, Paolo Abeni, netdev; +Cc: Vincent Bernat

When the peer link is created, its "iflink" information is not
advertised through netlink. If a user is maintaining a cache from all
updates, it will miss this information:

    2: veth0@NONE: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
        link/ether ae:0e:08:af:fb:a0 brd ff:ff:ff:ff:ff:ff
    3: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default
        link/ether 3a:31:f1:36:2e:e5 brd ff:ff:ff:ff:ff:ff

To avoid this situation, the peer link is only configured after both
interfaces are tied together:

    3: veth0@veth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
        link/ether ee:0d:80:46:36:fe brd ff:ff:ff:ff:ff:ff
    4: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default
        link/ether ba:25:bc:7a:0d:c8 brd ff:ff:ff:ff:ff:ff

Signed-off-by: Vincent Bernat <vincent@bernat.im>
---
 drivers/net/veth.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f37a6e61d4ad..9726c4dbf659 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -432,10 +432,6 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
 
 	netif_carrier_off(peer);
 
-	err = rtnl_configure_link(peer, ifmp);
-	if (err < 0)
-		goto err_configure_peer;
-
 	/*
 	 * register dev last
 	 *
@@ -466,6 +462,10 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
 
 	priv = netdev_priv(peer);
 	rcu_assign_pointer(priv->peer, dev);
+
+	err = rtnl_configure_link(peer, ifmp);
+	if (err < 0)
+		goto err_configure_peer;
 	return 0;
 
 err_register_dev:
-- 
2.8.1

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

end of thread, other threads:[~2016-06-10 13:21 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-29 11:17 [PATCH] veth: delay peer link configuration after interfaces are tied Vincent Bernat
2016-05-30  9:23 ` Nicolas Dichtel
2016-05-30 10:11   ` Vincent Bernat
2016-05-30 15:19     ` Nicolas Dichtel
2016-05-30 15:26       ` Vincent Bernat
2016-05-30 15:47         ` Nicolas Dichtel
2016-05-30 15:58           ` [net v3] veth: advertise peer link once both links are tied together Vincent Bernat
2016-05-30 16:01             ` Vincent Bernat
2016-05-30 16:27               ` Nicolas Dichtel
2016-05-31  6:29                 ` Vincent Bernat
2016-05-31  9:17                   ` Nicolas Dichtel
2016-06-08 20:30                     ` Lance Richardson
2016-06-10 13:15                       ` Nicolas Dichtel
2016-06-10 13:20                         ` Lance Richardson
2016-05-31  6:30                 ` [net v4] " Vincent Bernat
2016-05-31  6:54                   ` Vincent Bernat
2016-05-30 10:12   ` [PATCH] veth: delay peer link configuration after interfaces are tied Vincent Bernat
2016-05-30 10:14     ` Vincent Bernat
2016-05-30 10:13   ` Vincent Bernat
2016-05-30 15:19     ` Nicolas Dichtel

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.