lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190513093655.3b7ed78a@hermes.lan>
Date:   Mon, 13 May 2019 09:36:55 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc:     David Ahern <dsahern@...il.com>,
        Sabrina Dubroca <sd@...asysnail.net>, 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

On Mon, 13 May 2019 17:18:28 +0200
Nicolas Dichtel <nicolas.dichtel@...nd.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@...hat.com>
> >> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> >> Signed-off-by: Sabrina Dubroca <sd@...asysnail.net>
> >> Acked-by: Nicolas Dichtel <nicolas.dichtel@...nd.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@...1 is going to make scripts and users upset.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ