From: Florian Westphal <fw@strlen.de>
To: netdev@vger.kernel.org
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH 1/1] iproute2: fix addrlabel interface names handling
Date: Fri, 7 May 2010 23:31:02 +0200 [thread overview]
Message-ID: <1273267862-22443-1-git-send-email-fw@strlen.de> (raw)
ip addrlabel outputs if%d names due to missing init call:
$ ip addrlabel s
prefix a::42/128 dev if4 label 1000
Also, ip did not accept "if%d" interfaces on input.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
ip/ipaddrlabel.c | 2 ++
lib/ll_map.c | 6 +++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c
index cf438d6..95e813d 100644
--- a/ip/ipaddrlabel.c
+++ b/ip/ipaddrlabel.c
@@ -252,6 +252,8 @@ static int ipaddrlabel_flush(int argc, char **argv)
int do_ipaddrlabel(int argc, char **argv)
{
+ ll_init_map(&rth);
+
if (argc < 1) {
return ipaddrlabel_list(0, NULL);
} else if (matches(argv[0], "list") == 0 ||
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 5addf4a..b8b49aa 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -161,6 +161,7 @@ unsigned ll_name_to_index(const char *name)
static int icache;
struct idxmap *im;
int i;
+ unsigned idx;
if (name == NULL)
return 0;
@@ -176,7 +177,10 @@ unsigned ll_name_to_index(const char *name)
}
}
- return if_nametoindex(name);
+ idx = if_nametoindex(name);
+ if (idx == 0)
+ sscanf(name, "if%u", &idx);
+ return idx;
}
int ll_init_map(struct rtnl_handle *rth)
--
1.6.4.4
reply other threads:[~2010-05-07 21:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1273267862-22443-1-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--cc=netdev@vger.kernel.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