netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Bernat <vincent@bernat.im>
To: "David S. Miller" <davem@davemloft.net>,
	Vijay Pandurangan <vijayp@vijayp.ca>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
Cc: Vincent Bernat <vincent@bernat.im>
Subject: [net v4] veth: advertise peer link once both links are tied together
Date: Tue, 31 May 2016 08:30:21 +0200	[thread overview]
Message-ID: <1464676221-4873-1-git-send-email-vincent@bernat.im> (raw)
In-Reply-To: <574C69DE.3050305@6wind.com>

When the peer link is created, its "iflink" information is not
advertised through Netlink. Once created, the local device is advertised
with this information but if a user is maintaining a cache from all
updates, it will still miss the iflink for the peer link:

    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

With this patch, we advertise again the peer link to let any user pick
the appropriate iflink information:

    3: veth0@NONE: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
        link/ether fa:ba:12:26:99:00 brd ff:ff:ff:ff:ff:ff
    3: veth0@veth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
        link/ether fa:ba:12:26:99:00 brd ff:ff:ff:ff:ff:ff
    4: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default
        link/ether ea:e4:e2:26:3c:87 brd ff:ff:ff:ff:ff:ff

Signed-off-by: Vincent Bernat <vincent@bernat.im>
---
v4:
 - use ~0U instead of IFF_SLAVE for ifi_change

v3:
 - send an additional netlink messages once the peer link is tied to
   avoid any chicken/egg problem

v2:
 - ensure the device is unregistered in case of link configuration failure

drivers/net/veth.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f37a6e61d4ad..aaa1b023b9f2 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -466,6 +466,8 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
 
 	priv = netdev_priv(peer);
 	rcu_assign_pointer(priv->peer, dev);
+
+	rtmsg_ifinfo(RTM_NEWLINK, peer, ~0U, GFP_KERNEL);
 	return 0;
 
 err_register_dev:
-- 
2.8.1

  parent reply	other threads:[~2016-05-31  6:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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                 ` Vincent Bernat [this message]
2016-05-31  6:54                   ` [net v4] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464676221-4873-1-git-send-email-vincent@bernat.im \
    --to=vincent@bernat.im \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vijayp@vijayp.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).