From: Atzm Watanabe <atzm@stratosphere.co.jp>
To: netdev@vger.kernel.org
Cc: Cong Wang <cwang@twopensource.com>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2 v2] iplink: do not require assigning negative ifindex at link creation
Date: Wed, 01 Oct 2014 14:47:50 +0900 [thread overview]
Message-ID: <87tx3o5ojd.wl%atzm@stratosphere.co.jp> (raw)
Since commit 3c682146aeff, iplink requires assigning negative
ifindex (-1) to the kernel when creating interface without
specifying index.
v2: checking whether index is -1, suggested by Cong Wang.
Cc: Cong Wang <cwang@twopensource.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..5dd6060 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 == -1)
+ req.i.ifi_index = 0;
+ else
+ req.i.ifi_index = index;
}
if (name) {
--
1.8.1.5
next reply other threads:[~2014-10-01 5:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 5:47 Atzm Watanabe [this message]
2014-10-02 4:16 ` [PATCH iproute2 v2] iplink: do not require assigning negative ifindex at link creation Cong Wang
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=87tx3o5ojd.wl%atzm@stratosphere.co.jp \
--to=atzm@stratosphere.co.jp \
--cc=cwang@twopensource.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/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