[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHA+R7NSDU3PeBeJu0jnsZtdmQE=P6zUBH9jram=3gsVZYzcmw@mail.gmail.com>
Date: Tue, 30 Sep 2014 11:26:04 -0700
From: Cong Wang <cwang@...pensource.com>
To: Atzm Watanabe <atzm@...atosphere.co.jp>
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
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;
Thanks for fixing it.
--
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