Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2 v2] iplink: do not require assigning negative ifindex at link creation
@ 2014-10-01  5:47 Atzm Watanabe
  2014-10-02  4:16 ` Cong Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Atzm Watanabe @ 2014-10-01  5:47 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Stephen Hemminger

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-02  4:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01  5:47 [PATCH iproute2 v2] iplink: do not require assigning negative ifindex at link creation Atzm Watanabe
2014-10-02  4:16 ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox