Use standard routines for interface name to index etc

Use the available libraries for mapping from interface index to name
or type. This should speed up display with lots of interfaces
diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c
index 203e4a3..f0db5aa 100644
--- a/ip/ip6tunnel.c
+++ b/ip/ip6tunnel.c
@@ -36,6 +36,7 @@
 
 #include "utils.h"
 #include "tunnel.h"
+#include "ip_common.h"
 
 #define IP6_FLOWINFO_TCLASS	htonl(0x0FF00000)
 #define IP6_FLOWINFO_FLOWLABEL	htonl(0x000FFFFF)
@@ -75,7 +76,7 @@
 	printf("%s: %s/ipv6 remote %s local %s",
 	       p->name, tnl_strproto(p->proto), remote, local);
 	if (p->link) {
-		char *n = tnl_ioctl_get_ifname(p->link);
+		const char *n = ll_index_to_name(p->link);
 		if (n)
 			printf(" dev %s", n);
 	}
@@ -210,7 +211,7 @@
 		argc--; argv++;
 	}
 	if (medium[0]) {
-		p->link = tnl_ioctl_get_ifindex(medium);
+		p->link = ll_name_to_index(medium);
 		if (p->link == 0)
 			return -1;
 	}
@@ -266,7 +267,7 @@
 
 	while (fgets(buf, sizeof(buf), fp) != NULL) {
 		char name[IFNAMSIZ];
-		int type;
+		int index, type;
 		unsigned long rx_bytes, rx_packets, rx_errs, rx_drops,
 			rx_fifo, rx_frame,
 			tx_bytes, tx_packets, tx_errs, tx_drops,
@@ -288,7 +289,10 @@
 			continue;
 		if (p->name[0] && strcmp(p->name, name))
 			continue;
-		type = tnl_ioctl_get_iftype(name);
+		index = ll_name_to_index(name);
+		if (index == 0)
+			continue;
+		type = ll_index_to_type(index);
 		if (type == -1) {
 			fprintf(stderr, "Failed to get type of [%s]\n", name);
 			continue;
@@ -298,7 +302,7 @@
 		memset(&p1, 0, sizeof(p1));
 		ip6_tnl_parm_init(&p1, 0);
 		strcpy(p1.name, name);
-		p1.link = tnl_ioctl_get_ifindex(p1.name);
+		p1.link = ll_name_to_index(p1.name);
 		if (p1.link == 0)
 			continue;
 		if (tnl_get_ioctl(p1.name, &p1))
@@ -329,6 +333,7 @@
 {
         struct ip6_tnl_parm p;
 
+	ll_init_map(&rth);
 	ip6_tnl_parm_init(&p, 0);
 	p.proto = 0;  /* default to any */