From: Stephen Hemminger <stephen@networkplumber.org>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: David Ahern <dsahern@gmail.com>,
Sabrina Dubroca <sd@queasysnail.net>,
netdev@vger.kernel.org, Dan Winship <danw@redhat.com>
Subject: Re: [PATCH net v2] rtnetlink: always put ILFA_LINK for links with a link-netnsid
Date: Mon, 13 May 2019 09:36:55 -0700 [thread overview]
Message-ID: <20190513093655.3b7ed78a@hermes.lan> (raw)
In-Reply-To: <83ffac16-f03a-acd7-815a-0b952c0ef951@6wind.com>
On Mon, 13 May 2019 17:18:28 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> Le 13/05/2019 à 17:07, David Ahern a écrit :
> > On 5/13/19 7:47 AM, Sabrina Dubroca wrote:
> >> Currently, nla_put_iflink() doesn't put the IFLA_LINK attribute when
> >> iflink == ifindex.
> >>
> >> In some cases, a device can be created in a different netns with the
> >> same ifindex as its parent. That device will not dump its IFLA_LINK
> >> attribute, which can confuse some userspace software that expects it.
> >> For example, if the last ifindex created in init_net and foo are both
> >> 8, these commands will trigger the issue:
> >>
> >> ip link add parent type dummy # ifindex 9
> >> ip link add link parent netns foo type macvlan # ifindex 9 in ns foo
> >>
> >> So, in case a device puts the IFLA_LINK_NETNSID attribute in a dump,
> >> always put the IFLA_LINK attribute as well.
> >>
> >> Thanks to Dan Winship for analyzing the original OpenShift bug down to
> >> the missing netlink attribute.
> >>
> >> Analyzed-by: Dan Winship <danw@redhat.com>
> >> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> >> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> >> Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> >> ---
> >> v2: change Fixes tag, it's been here forever as Nicolas said, and add his Ack
> >>
> >> net/core/rtnetlink.c | 16 ++++++++++------
> >> 1 file changed, 10 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> >> index 2bd12afb9297..adcc045952c2 100644
> >> --- a/net/core/rtnetlink.c
> >> +++ b/net/core/rtnetlink.c
> >> @@ -1496,14 +1496,15 @@ static int put_master_ifindex(struct sk_buff *skb, struct net_device *dev)
> >> return ret;
> >> }
> >>
> >> -static int nla_put_iflink(struct sk_buff *skb, const struct net_device *dev)
> >> +static int nla_put_iflink(struct sk_buff *skb, const struct net_device *dev,
> >> + bool force)
> >> {
> >> int ifindex = dev_get_iflink(dev);
> >>
> >> - if (dev->ifindex == ifindex)
> >> - return 0;
> >> + if (force || dev->ifindex != ifindex)
> >> + return nla_put_u32(skb, IFLA_LINK, ifindex);
> >>
> >> - return nla_put_u32(skb, IFLA_LINK, ifindex);
> >> + return 0;
> >> }
> >>
> >> static noinline_for_stack int nla_put_ifalias(struct sk_buff *skb,
> >
> > why not always adding the attribute?
> >
> Adding this attribute may change the output of 'ip link'.
> See this patch for example:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=95ec655bc465
+1
Printing eno1@eno1 is going to make scripts and users upset.
next prev parent reply other threads:[~2019-05-13 16:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 13:47 [PATCH net v2] rtnetlink: always put ILFA_LINK for links with a link-netnsid Sabrina Dubroca
2019-05-13 14:50 ` Nicolas Dichtel
2019-05-13 15:08 ` Sabrina Dubroca
2019-05-13 15:13 ` Nicolas Dichtel
2019-05-13 21:46 ` Sabrina Dubroca
2019-05-14 7:32 ` Nicolas Dichtel
2019-05-14 8:01 ` Sabrina Dubroca
2019-05-14 10:05 ` Nicolas Dichtel
2019-05-14 10:24 ` Sabrina Dubroca
2019-05-14 12:10 ` Nicolas Dichtel
2019-05-13 16:19 ` David Miller
2019-05-13 15:07 ` David Ahern
2019-05-13 15:18 ` Nicolas Dichtel
2019-05-13 16:36 ` Stephen Hemminger [this message]
2019-05-13 16:38 ` David Ahern
2019-05-13 18:07 ` Edward Cree
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=20190513093655.3b7ed78a@hermes.lan \
--to=stephen@networkplumber.org \
--cc=danw@redhat.com \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=sd@queasysnail.net \
/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 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.