From: Tom Herbert <therbert@google.com>
To: davem@davemloft.net, stephen@networkplumber.org, netdev@vger.kernel.org
Subject: [PATCH iproute2 1/5] iplink: Fix setting of -1 as ifindex
Date: Fri, 3 Oct 2014 08:55:14 -0700 [thread overview]
Message-ID: <1412351718-22921-2-git-send-email-therbert@google.com> (raw)
In-Reply-To: <1412351718-22921-1-git-send-email-therbert@google.com>
Commit 3c682146aeff157ec3540 ("iplink: forbid negative ifindex and
modifying ifindex") initializes index to -1 in iplink_modify. When
creating a link, req.i.ifi_index is then set to -1 if the link option is
not used. In the kernel this is then used to set dev->ifindex. For
dev->ifindex, zero is considered to be unset and -1 is treated as
a set index, so when a second tunnel is create the new device conflicts
with the old one (both have ifindex of -1) so -EBUSY is returned.
This patch set zero in req.i.ifi_index is index is unset (still -1).
Signed-off-by: Tom Herbert <therbert@google.com>
---
ip/iplink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index cb9c870..1b6ffc6 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -689,7 +689,7 @@ 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;
+ req.i.ifi_index = (index > 0) ? : 0;
}
if (name) {
--
2.1.0.rc2.206.gedb03e5
next prev parent reply other threads:[~2014-10-03 15:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-03 15:55 [PATCH iproute2 0/5] iproute: Add FOU and GUE configuration in ip Tom Herbert
2014-10-03 15:55 ` Tom Herbert [this message]
2014-10-07 0:42 ` [PATCH iproute2 1/5] iplink: Fix setting of -1 as ifindex Cong Wang
2014-10-03 15:55 ` [PATCH iproute2 2/5] ip fou: Support to configure foo-over-udp RX Tom Herbert
2014-11-02 19:36 ` Stephen Hemminger
2014-11-02 19:45 ` Stephen Hemminger
2014-11-02 20:53 ` Stephen Hemminger
2014-10-03 15:55 ` [PATCH iproute2 3/5] ip tunnel: Kernel uapi definitions for fou and gue Tom Herbert
2014-10-03 15:55 ` [PATCH 4/5] ip link ipip: Add support to configure FOU and GUE Tom Herbert
2014-10-21 16:48 ` Sabrina Dubroca
2014-10-03 15:55 ` [PATCH 5/5] ip link gre: " Tom Herbert
2014-11-02 19:46 ` [PATCH iproute2 0/5] iproute: Add FOU and GUE configuration in ip Stephen Hemminger
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=1412351718-22921-2-git-send-email-therbert@google.com \
--to=therbert@google.com \
--cc=davem@davemloft.net \
--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;
as well as URLs for NNTP newsgroup(s).