diff options
author | Florian Westphal <fw@strlen.de> | 2010-05-07 11:31:02 +0000 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-05-13 09:23:46 -0700 |
commit | 24abb62ee737f98b4b5a7afc8b817cdb6eb53a46 (patch) | |
tree | ab10d1625a191fdfdd786b2aacae3189e53a0ee4 /lib | |
parent | 608a96c727db69498c1310f21e73045c95f2ad5d (diff) | |
download | android_external_iproute2-24abb62ee737f98b4b5a7afc8b817cdb6eb53a46.tar.gz android_external_iproute2-24abb62ee737f98b4b5a7afc8b817cdb6eb53a46.tar.bz2 android_external_iproute2-24abb62ee737f98b4b5a7afc8b817cdb6eb53a46.zip |
iproute2: fix addrlabel interface names handling
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ll_map.c | 6 |
1 files changed, 5 insertions, 1 deletions
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) |