From mboxrd@z Thu Jan 1 00:00:00 1970 From: Atzm Watanabe Subject: [PATCH iproute2] iplink: do not require assigning negative ifindex at link creation Date: Tue, 30 Sep 2014 20:10:12 +0900 Message-ID: <87wq8l5ppn.wl%atzm@stratosphere.co.jp> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: Cong Wang , Stephen Hemminger To: netdev@vger.kernel.org Return-path: Received: from mail-pa0-f44.google.com ([209.85.220.44]:44739 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751131AbaI3LKO (ORCPT ); Tue, 30 Sep 2014 07:10:14 -0400 Received: by mail-pa0-f44.google.com with SMTP id et14so4561053pad.17 for ; Tue, 30 Sep 2014 04:10:14 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: Since commit 3c682146aeff, iplink requires assigning negative ifindex (-1) to the kernel when creating interface without specifying index. Cc: Cong Wang Signed-off-by: Atzm Watanabe --- 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