cleanup warnings

ll_index can return -1 but was declared unsigned.
rt_addr_n2a had unused length parameter
diff --git a/include/ll_map.h b/include/ll_map.h
index f1dda39..4c78498 100644
--- a/include/ll_map.h
+++ b/include/ll_map.h
@@ -9,6 +9,6 @@
 extern const char *ll_index_to_name(unsigned idx);
 extern const char *ll_idx_n2a(unsigned idx, char *buf);
 extern int ll_index_to_type(unsigned idx);
-extern unsigned ll_index_to_flags(unsigned idx);
+extern int ll_index_to_flags(unsigned idx);
 
 #endif /* __LL_MAP_H__ */
diff --git a/include/utils.h b/include/utils.h
index a4b5b4c..704dc51 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -98,7 +98,7 @@
 
 extern const char *format_host(int af, int len, const void *addr,
 			       char *buf, int buflen);
-extern const char *rt_addr_n2a(int af, int len, const void *addr,
+extern const char *rt_addr_n2a(int af, const void *addr,
 			       char *buf, int buflen);
 
 void missarg(const char *) __attribute__((noreturn));
diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c
index 7a950df..b5c511e 100644
--- a/ip/iplink_bond.c
+++ b/ip/iplink_bond.c
@@ -407,7 +407,6 @@
 			if (iptb[i])
 				fprintf(f, "%s",
 					rt_addr_n2a(AF_INET,
-						    RTA_PAYLOAD(iptb[i]),
 						    RTA_DATA(iptb[i]),
 						    buf,
 						    INET_ADDRSTRLEN));
diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index 345576d..be93a98 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -116,14 +116,13 @@
 	if (tb[RTA_SRC])
 		len = snprintf(obuf, sizeof(obuf),
 			       "(%s, ", rt_addr_n2a(family,
-						    RTA_PAYLOAD(tb[RTA_SRC]),
 						    RTA_DATA(tb[RTA_SRC]),
 						    abuf, sizeof(abuf)));
 	else
 		len = sprintf(obuf, "(unknown, ");
 	if (tb[RTA_DST])
 		snprintf(obuf + len, sizeof(obuf) - len,
-			 "%s)", rt_addr_n2a(family, RTA_PAYLOAD(tb[RTA_DST]),
+			 "%s)", rt_addr_n2a(family,
 					    RTA_DATA(tb[RTA_DST]),
 					    abuf, sizeof(abuf)));
 	else
diff --git a/ip/ipprefix.c b/ip/ipprefix.c
index 018913e..02c0efc 100644
--- a/ip/ipprefix.c
+++ b/ip/ipprefix.c
@@ -80,7 +80,7 @@
 		pfx = (struct in6_addr *)RTA_DATA(tb[PREFIX_ADDRESS]);
 
 		memset(abuf, '\0', sizeof(abuf));
-		fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*pfx), pfx,
+		fprintf(fp, "%s", rt_addr_n2a(family, pfx,
 					      abuf, sizeof(abuf)));
 	}
 	fprintf(fp, "/%u ", prefix->prefix_len);
diff --git a/ip/iproute.c b/ip/iproute.c
index daff9ce..d77b1e3 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -338,7 +338,6 @@
 	if (tb[RTA_DST]) {
 		if (r->rtm_dst_len != host_len) {
 			fprintf(fp, "%s/%u ", rt_addr_n2a(r->rtm_family,
-							 RTA_PAYLOAD(tb[RTA_DST]),
 							 RTA_DATA(tb[RTA_DST]),
 							 abuf, sizeof(abuf)),
 				r->rtm_dst_len
@@ -358,7 +357,6 @@
 	if (tb[RTA_SRC]) {
 		if (r->rtm_src_len != host_len) {
 			fprintf(fp, "from %s/%u ", rt_addr_n2a(r->rtm_family,
-							 RTA_PAYLOAD(tb[RTA_SRC]),
 							 RTA_DATA(tb[RTA_SRC]),
 							 abuf, sizeof(abuf)),
 				r->rtm_src_len
@@ -402,7 +400,6 @@
 		 */
 		fprintf(fp, " src %s ",
 			rt_addr_n2a(r->rtm_family,
-				    RTA_PAYLOAD(tb[RTA_PREFSRC]),
 				    RTA_DATA(tb[RTA_PREFSRC]),
 				    abuf, sizeof(abuf)));
 	}
diff --git a/ip/iprule.c b/ip/iprule.c
index 4ba16f8..366878e 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -89,7 +89,6 @@
 	if (tb[FRA_SRC]) {
 		if (r->rtm_src_len != host_len) {
 			fprintf(fp, "from %s/%u ", rt_addr_n2a(r->rtm_family,
-							 RTA_PAYLOAD(tb[FRA_SRC]),
 							 RTA_DATA(tb[FRA_SRC]),
 							 abuf, sizeof(abuf)),
 				r->rtm_src_len
@@ -110,7 +109,6 @@
 	if (tb[FRA_DST]) {
 		if (r->rtm_dst_len != host_len) {
 			fprintf(fp, "to %s/%u ", rt_addr_n2a(r->rtm_family,
-							 RTA_PAYLOAD(tb[FRA_DST]),
 							 RTA_DATA(tb[FRA_DST]),
 							 abuf, sizeof(abuf)),
 				r->rtm_dst_len
diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index c31b176..0844a4f 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -343,7 +343,7 @@
 	       p->name,
 	       tnl_strproto(p->iph.protocol),
 	       p->iph.daddr ? format_host(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1))  : "any",
-	       p->iph.saddr ? rt_addr_n2a(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any");
+	       p->iph.saddr ? rt_addr_n2a(AF_INET, &p->iph.saddr, s2, sizeof(s2)) : "any");
 
 	if (p->iph.protocol == IPPROTO_IPV6 && (p->i_flags & SIT_ISATAP)) {
 		struct ip_tunnel_prl prl[16];
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index cce5151..f5f78ca 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -288,10 +288,10 @@
 		fputs(title, fp);
 
 	memset(abuf, '\0', sizeof(abuf));
-	fprintf(fp, "src %s ", rt_addr_n2a(family, sizeof(*saddr),
+	fprintf(fp, "src %s ", rt_addr_n2a(family,
 					   saddr, abuf, sizeof(abuf)));
 	memset(abuf, '\0', sizeof(abuf));
-	fprintf(fp, "dst %s", rt_addr_n2a(family, sizeof(id->daddr),
+	fprintf(fp, "dst %s", rt_addr_n2a(family,
 					  &id->daddr, abuf, sizeof(abuf)));
 	fprintf(fp, "%s", _SL_);
 
@@ -455,13 +455,11 @@
 		fputs(prefix, fp);
 
 	memset(abuf, '\0', sizeof(abuf));
-	fprintf(fp, "src %s/%u ", rt_addr_n2a(f, sizeof(sel->saddr),
-					      &sel->saddr, abuf, sizeof(abuf)),
+	fprintf(fp, "src %s/%u ", rt_addr_n2a(f, &sel->saddr, abuf, sizeof(abuf)),
 		sel->prefixlen_s);
 
 	memset(abuf, '\0', sizeof(abuf));
-	fprintf(fp, "dst %s/%u ", rt_addr_n2a(f, sizeof(sel->daddr),
-					      &sel->daddr, abuf, sizeof(abuf)),
+	fprintf(fp, "dst %s/%u ", rt_addr_n2a(f, &sel->daddr, abuf, sizeof(abuf)),
 		sel->prefixlen_d);
 
 	if (sel->proto)
@@ -588,7 +586,7 @@
 }
 
 static void xfrm_tmpl_print(struct xfrm_user_tmpl *tmpls, int len,
-			    __u16 family, FILE *fp, const char *prefix)
+			    FILE *fp, const char *prefix)
 {
 	int ntmpls = len / sizeof(struct xfrm_user_tmpl);
 	int i;
@@ -756,15 +754,14 @@
 
 		memset(abuf, '\0', sizeof(abuf));
 		fprintf(fp, "addr %s",
-			rt_addr_n2a(family, sizeof(e->encap_oa),
-				    &e->encap_oa, abuf, sizeof(abuf)));
+			rt_addr_n2a(family, &e->encap_oa, abuf, sizeof(abuf)));
 		fprintf(fp, "%s", _SL_);
 	}
 
 	if (tb[XFRMA_TMPL]) {
 		struct rtattr *rta = tb[XFRMA_TMPL];
 		xfrm_tmpl_print((struct xfrm_user_tmpl *) RTA_DATA(rta),
-				RTA_PAYLOAD(rta), family, fp, prefix);
+				RTA_PAYLOAD(rta), fp, prefix);
 	}
 
 	if (tb[XFRMA_COADDR]) {
@@ -785,7 +782,7 @@
 
 		memset(abuf, '\0', sizeof(abuf));
 		fprintf(fp, "%s",
-			rt_addr_n2a(family, sizeof(*coa), coa,
+			rt_addr_n2a(family, coa,
 				    abuf, sizeof(abuf)));
 		fprintf(fp, "%s", _SL_);
 	}
diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c
index f5b1245..1c7f56c 100644
--- a/ip/link_ip6tnl.c
+++ b/ip/link_ip6tnl.c
@@ -280,7 +280,6 @@
 	if (tb[IFLA_IPTUN_REMOTE]) {
 		fprintf(f, "remote %s ",
 			rt_addr_n2a(AF_INET6,
-				    RTA_PAYLOAD(tb[IFLA_IPTUN_REMOTE]),
 				    RTA_DATA(tb[IFLA_IPTUN_REMOTE]),
 				    s1, sizeof(s1)));
 	}
@@ -288,7 +287,6 @@
 	if (tb[IFLA_IPTUN_LOCAL]) {
 		fprintf(f, "local %s ",
 			rt_addr_n2a(AF_INET6,
-				    RTA_PAYLOAD(tb[IFLA_IPTUN_LOCAL]),
 				    RTA_DATA(tb[IFLA_IPTUN_LOCAL]),
 				    s1, sizeof(s1)));
 	}
diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c
index dea0afc..79453e4 100644
--- a/ip/xfrm_monitor.c
+++ b/ip/xfrm_monitor.c
@@ -225,8 +225,8 @@
 	char buf[256];
 
 	buf[0] = 0;
-	fprintf(fp, "dst %s ", rt_addr_n2a(sa_id->family,
-		sizeof(sa_id->daddr), &sa_id->daddr, buf, sizeof(buf)));
+	fprintf(fp, "dst %s ",
+		rt_addr_n2a(sa_id->family, &sa_id->daddr, buf, sizeof(buf)));
 
 	fprintf(fp, " reqid 0x%x", reqid);
 
@@ -245,9 +245,8 @@
 	xfrm_ae_flags_print(id->flags, arg);
 	fprintf(fp,"\n\t");
 	memset(abuf, '\0', sizeof(abuf));
-	fprintf(fp, "src %s ", rt_addr_n2a(id->sa_id.family,
-		sizeof(id->saddr), &id->saddr,
-		abuf, sizeof(abuf)));
+	fprintf(fp, "src %s ", rt_addr_n2a(id->sa_id.family, &id->saddr,
+					   abuf, sizeof(abuf)));
 
 	xfrm_usersa_print(&id->sa_id, id->reqid, fp);
 
@@ -257,12 +256,12 @@
 	return 0;
 }
 
-static void xfrm_print_addr(FILE *fp, int family, xfrm_address_t *a, size_t s)
+static void xfrm_print_addr(FILE *fp, int family, xfrm_address_t *a)
 {
 	char buf[256];
 
 	buf[0] = 0;
-	fprintf(fp, "%s", rt_addr_n2a(family, s, a, buf, sizeof(buf)));
+	fprintf(fp, "%s", rt_addr_n2a(family, a, buf, sizeof(buf)));
 }
 
 static int xfrm_mapping_print(const struct sockaddr_nl *who,
@@ -272,12 +271,10 @@
 	struct xfrm_user_mapping *map = NLMSG_DATA(n);
 
 	fprintf(fp, "Mapping change ");
-	xfrm_print_addr(fp, map->id.family, &map->old_saddr,
-			sizeof(map->old_saddr));
+	xfrm_print_addr(fp, map->id.family, &map->old_saddr);
 
 	fprintf(fp, ":%d -> ", ntohs(map->old_sport));
-	xfrm_print_addr(fp, map->id.family, &map->new_saddr,
-			sizeof(map->new_saddr));
+	xfrm_print_addr(fp, map->id.family, &map->new_saddr);
 	fprintf(fp, ":%d\n\t", ntohs(map->new_sport));
 
 	xfrm_usersa_print(&map->id, map->reqid, fp);
diff --git a/lib/ll_map.c b/lib/ll_map.c
index fd7db55..db34a2a 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -28,7 +28,7 @@
 	struct hlist_node idx_hash;
 	struct hlist_node name_hash;
 	unsigned	flags;
-	int		index;
+	unsigned 	index;
 	unsigned short	type;
 	char		name[IFNAMSIZ];
 };
@@ -173,7 +173,7 @@
 	return im ? im->type : -1;
 }
 
-unsigned ll_index_to_flags(unsigned idx)
+int ll_index_to_flags(unsigned idx)
 {
 	const struct ll_cache *im;
 
diff --git a/lib/utils.c b/lib/utils.c
index e9e1040..dc21567 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -454,19 +454,19 @@
 	err = get_addr_1(dst, arg, family);
 	if (err == 0) {
 		switch(dst->family) {
-			case AF_INET6:
-				dst->bitlen = 128;
-				break;
-			case AF_DECnet:
-				dst->bitlen = 16;
-				break;
-			default:
-			case AF_INET:
-				dst->bitlen = 32;
+		case AF_INET6:
+			dst->bitlen = 128;
+			break;
+		case AF_DECnet:
+			dst->bitlen = 16;
+			break;
+		default:
+		case AF_INET:
+			dst->bitlen = 32;
 		}
 		if (slash) {
 			if (get_netmask(&plen, slash+1, 0)
-					|| plen > dst->bitlen) {
+			    || plen > dst->bitlen) {
 				err = -1;
 				goto done;
 			}
@@ -621,7 +621,7 @@
 	return sysconf(_SC_CLK_TCK);
 }
 
-const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen)
+const char *rt_addr_n2a(int af, const void *addr, char *buf, int buflen)
 {
 	switch (af) {
 	case AF_INET:
@@ -728,7 +728,7 @@
 			return n;
 	}
 #endif
-	return rt_addr_n2a(af, len, addr, buf, buflen);
+	return rt_addr_n2a(af, addr, buf, buflen);
 }