[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190514080127.GA17749@bistromath.localdomain>
Date: Tue, 14 May 2019 10:01:27 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc: netdev@...r.kernel.org, Dan Winship <danw@...hat.com>
Subject: Re: [PATCH net v2] rtnetlink: always put ILFA_LINK for links with a
link-netnsid
2019-05-14, 09:32:32 +0200, Nicolas Dichtel wrote:
> Le 13/05/2019 à 23:46, Sabrina Dubroca a écrit :
> > 2019-05-13, 17:13:36 +0200, Nicolas Dichtel wrote:
> >> Le 13/05/2019 à 17:08, Sabrina Dubroca a écrit :
> >>> 2019-05-13, 16:50:51 +0200, Nicolas Dichtel wrote:
> >>>> Le 13/05/2019 à 15:47, Sabrina Dubroca a écrit :
> >>>>> 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@...hat.com>
> >>>>> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> >>>> I would say:
> >>>> Fixes: 5e6700b3bf98 ("sit: add support of x-netns")
> >>>>
> >>>> Because before this patch, there was no device with an iflink that can be put in
> >>>> another netns.
> >>>
> >>> That tells us how far back we might want to backport this fix, but not
> >>> which commit introduced the bug. I think Fixes should refer to the
> >>> introduction of the faulty code, not to what patch made it visible (if
> >>> we can find both).
> >> No sure to follow you. The problem you describe cannot happen before commit
> >> 5e6700b3bf98, so there cannot be a "faulty" patch before that commit.
> >
> > What about macvlan devices?
> >
> > From commit b863ceb7ddce ("[NET]: Add macvlan driver"):
> >
> > static int macvlan_init(struct net_device *dev)
> > {
> > ...
> > dev->iflink = lowerdev->ifindex;
> > ...
> > }
> >
> > vlan devices also had an iflink assigned since commit ddd7bf9fe4e5.
> >
> > What am I missing?
> You miss the fact that netns have been introduced after both commits.
Ah, right.
> What about this one?
> Fixes: d8a5ec672768 ("[NET]: netlink support for moving devices between network
> namespaces.")
Nice. Now I think the bug can't really trigger unless one of these
commits are present:
aa79e66eee5d ("net: Make ifindex generation per-net namespace")
9c7dafbfab15 ("net: Allow to create links with given ifindex")
I'll use those two as Fixes tags for v3, unless you want something
different.
Thanks,
--
Sabrina
Powered by blists - more mailing lists