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] [day] [month] [year] [list]
Date:	Wed, 01 Oct 2014 13:30:28 +0900
From:	Atzm Watanabe <atzm@...atosphere.co.jp>
To:	Cong Wang <cwang@...pensource.com>
Cc:	netdev <netdev@...r.kernel.org>,
	Cong Wang <xiyou.wangcong@...il.com>,
	Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH iproute2] iplink: do not require assigning negative ifindex at link creation

At Tue, 30 Sep 2014 11:26:04 -0700,
Cong Wang wrote:
> 
> On Tue, Sep 30, 2014 at 4:10 AM, Atzm Watanabe <atzm@...atosphere.co.jp> wrote:
> > Since commit 3c682146aeff, iplink requires assigning negative
> > ifindex (-1) to the kernel when creating interface without
> > specifying index.
> >
> > Cc: Cong Wang <xiyou.wangcong@...il.com>
> > Signed-off-by: Atzm Watanabe <atzm@...atosphere.co.jp>
> > ---
> >  ip/iplink.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/ip/iplink.c b/ip/iplink.c
> > index cb9c870..de6b2a9 100644
> > --- a/ip/iplink.c
> > +++ b/ip/iplink.c
> > @@ -689,7 +689,10 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
> >                         addattr_l(&req.n, sizeof(req), IFLA_LINK, &ifindex, 4);
> >                 }
> >
> > -               req.i.ifi_index = index;
> > +               if (index <= 0)
> > +                       req.i.ifi_index = 0;
> > +               else
> > +                       req.i.ifi_index = index;
> 
> How about checking if it is -1?
> 
> if (index == -1)
>    req.i.ifi_index = 0;
> else
>    req.i.ifi_index = index;

Agreed, will fix.

Because iplink_parse() forbids specifying negative index, it will be
actually same.  But your suggestion seems more nicer than my patch.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ