Netdev List
 help / color / mirror / Atom feed
From: Atzm Watanabe <atzm@stratosphere.co.jp>
To: netdev@vger.kernel.org
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2] iplink: do not require assigning negative ifindex at link creation
Date: Tue, 30 Sep 2014 20:10:12 +0900	[thread overview]
Message-ID: <87wq8l5ppn.wl%atzm@stratosphere.co.jp> (raw)

Since commit 3c682146aeff, iplink requires assigning negative
ifindex (-1) to the kernel when creating interface without
specifying index.

Cc: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Atzm Watanabe <atzm@stratosphere.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;
 	}
 
 	if (name) {
-- 
1.8.1.5

             reply	other threads:[~2014-09-30 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 11:10 Atzm Watanabe [this message]
2014-09-30 18:26 ` [PATCH iproute2] iplink: do not require assigning negative ifindex at link creation Cong Wang
2014-10-01  4:30   ` Atzm Watanabe

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=87wq8l5ppn.wl%atzm@stratosphere.co.jp \
    --to=atzm@stratosphere.co.jp \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=xiyou.wangcong@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox