summaryrefslogtreecommitdiffhomepage
path: root/system-linux.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2013-05-13 11:12:10 +0200
committerSteven Barth <steven@midlink.org>2013-05-13 11:12:10 +0200
commitfb69c8e6afdae91ea5cc2dee9881e3b0a7afd5ad (patch)
tree24af62656e5fe2da783c2ccda3396ecd4a396ef7 /system-linux.c
parent570302d28d18d47f095f864be161045e169b5941 (diff)
Use logical instead of physical name for tunnel underlying link.
Signed-off-by: Steven Barth <steven@midlink.org>
Diffstat (limited to 'system-linux.c')
-rw-r--r--system-linux.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/system-linux.c b/system-linux.c
index efda0d5..f5c900d 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -1342,9 +1342,14 @@ int system_add_ip_tunnel(const char *name, struct blob_attr *attr)
return -EINVAL;
unsigned int link = 0;
- if ((cur = tb[TUNNEL_ATTR_LINK]) &&
- !(link = if_nametoindex((const char*)blobmsg_data(cur))))
- return -EINVAL;
+ if ((cur = tb[TUNNEL_ATTR_LINK])) {
+ struct interface *iface = vlist_find(&interfaces, blobmsg_data(cur), iface, node);
+ if (!iface)
+ return -EINVAL;
+
+ if (iface->l3_dev.dev)
+ link = iface->l3_dev.dev->ifindex;
+ }
if (!strcmp(str, "sit")) {