From patchwork Mon May 30 15:58:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Bernat X-Patchwork-Id: 627878 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rJLrn2GqWz9t5T for ; Tue, 31 May 2016 01:58:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=bernat.im header.i=@bernat.im header.b=JvFyNEhb; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161421AbcE3P6r (ORCPT ); Mon, 30 May 2016 11:58:47 -0400 Received: from bart.luffy.cx ([78.47.78.131]:40362 "EHLO bart.luffy.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161301AbcE3P6q (ORCPT ); Mon, 30 May 2016 11:58:46 -0400 Received: from bart.luffy.cx (localhost [127.0.0.1]) by bart.luffy.cx (Postfix) with ESMTP id 867311519E; Mon, 30 May 2016 17:58:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bernat.im; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=postfix; bh=a jP208ZtmnhboLOGwdDVezXNz4U=; b=JvFyNEhbmPVJ2MtTZ+4tRs+s/H+BGvifR HkUI8wNaE4eblKHa5E3cC0nic3mT5yQyWy9mYlyU2NR223sjEoqArnFr2/ubxGQZ 7zDeSK+Icu8ccO3ooK3tu9rcD75v2HcquQSumjK2xTaLVewcaUb/86ei4aSvcK9r 8K9aITsGTw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bernat.im; h=from:to:cc :subject:date:message-id:in-reply-to:references; q=dns; s= postfix; b=SENm7kXe45dQJeoAVqfQzyaC2BxB0SR4Hr0ndSPz6Ri8ZLFAzo/eb tregFpsU0mG4KzOMvuxr6dYvQqUj/BS6WcSTYq+Q1FgRDxZx7/pNqIq8sxpJpqiK GQObi4/f06gy0y5oHKFaWlQAJdRVb9oGemsNUGnuzkSKvbzqoSyG20= Received: from zoro.exoscale.ch (unknown [194.88.192.200]) by bart.luffy.cx (Postfix) with ESMTPS id 43CAA1519D; Mon, 30 May 2016 17:58:43 +0200 (CEST) Received: by zoro.exoscale.ch (Postfix, from userid 1000) id 1A43C136C; Mon, 30 May 2016 17:58:42 +0200 (CEST) From: Vincent Bernat To: "David S. Miller" , Vijay Pandurangan , Paolo Abeni , netdev@vger.kernel.org, Nicolas Dichtel Cc: Vincent Bernat Subject: [net v3] veth: advertise peer link once both links are tied together Date: Mon, 30 May 2016 17:58:37 +0200 Message-Id: <1464623917-11536-1-git-send-email-vincent@bernat.im> X-Mailer: git-send-email 2.8.1 In-Reply-To: <574C6095.9050804@6wind.com> References: <574C6095.9050804@6wind.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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: 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: 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: 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: 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: 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 --- 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..2376d17b8f53 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, IFF_SLAVE, GFP_KERNEL); return 0; err_register_dev: