]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
cleanup warnings
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 4 Aug 2014 17:30:35 +0000 (10:30 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 4 Aug 2014 17:30:35 +0000 (10:30 -0700)
ll_index can return -1 but was declared unsigned.
rt_addr_n2a had unused length parameter

13 files changed:
include/ll_map.h
include/utils.h
ip/iplink_bond.c
ip/ipmroute.c
ip/ipprefix.c
ip/iproute.c
ip/iprule.c
ip/iptunnel.c
ip/ipxfrm.c
ip/link_ip6tnl.c
ip/xfrm_monitor.c
lib/ll_map.c
lib/utils.c

index f1dda39b7604f69b981d6e93fd1e8c83c0f9ff54..4c78498e7e1e74e43116d45af7c8a90aae06c06f 100644 (file)
@@ -9,6 +9,6 @@ extern unsigned ll_name_to_index(const char *name);
 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__ */
index a4b5b4cc60d7e654e2926e40b25c71519afe0f9b..704dc51f33df1f7d6dc98e14cd95ba3a7c82e711 100644 (file)
@@ -98,7 +98,7 @@ extern __u8* hexstring_a2n(const char *str, __u8 *buf, int blen);
 
 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));
index 7a950df9679726b3a8867a71b007f7b220e0d87d..b5c511ebb7a4ba7ace286b0c2c9e4324d103672c 100644 (file)
@@ -407,7 +407,6 @@ static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
                        if (iptb[i])
                                fprintf(f, "%s",
                                        rt_addr_n2a(AF_INET,
-                                                   RTA_PAYLOAD(iptb[i]),
                                                    RTA_DATA(iptb[i]),
                                                    buf,
                                                    INET_ADDRSTRLEN));
index 345576d070bd5793cbec08e61869d5c093bc98e6..be93a988b18ce671eaa70a47a213c7d1355e49e6 100644 (file)
@@ -116,14 +116,13 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
        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
index 018913e8d604ed2618fcf665198b25944afe9761..02c0efce68363403c8030f394a9cf276f5687f03 100644 (file)
@@ -80,7 +80,7 @@ int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
                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);
index daff9ce6c7a48591f75321d85bb6287f816c7bcb..d77b1e3585d9ce109e51d4125541631da623b8b1 100644 (file)
@@ -338,7 +338,6 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
        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 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
        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 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
                 */
                fprintf(fp, " src %s ",
                        rt_addr_n2a(r->rtm_family,
-                                   RTA_PAYLOAD(tb[RTA_PREFSRC]),
                                    RTA_DATA(tb[RTA_PREFSRC]),
                                    abuf, sizeof(abuf)));
        }
index 4ba16f89fc61b0578d259e812eb2c2258d497fef..366878e90f84b77228ff13371a4b1669346472a7 100644 (file)
@@ -89,7 +89,6 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
        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 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
        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
index c31b176cc0eca0fff12bfc4312abd92cd4389433..0844a4fc956106568dfcbf0fcaeabe5b0322638d 100644 (file)
@@ -343,7 +343,7 @@ static void print_tunnel(struct ip_tunnel_parm *p)
               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];
index cce51518170c2ce1f6f22016be94885c119420c1..f5f78ca6b96873ff9ce2ebd516123ead4fad1b7b 100644 (file)
@@ -288,10 +288,10 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
                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 @@ void xfrm_selector_print(struct xfrm_selector *sel, __u16 family,
                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_auth_trunc_print(struct xfrm_algo_auth *algo, int len,
 }
 
 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 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
 
                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 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
 
                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_);
        }
index f5b12454cf5f07503eb0157f18688ca3a548c339..1c7f56cb1e154330ddf4de4571b80f7ab5701273 100644 (file)
@@ -280,7 +280,6 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb
        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 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb
        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)));
        }
index dea0afc69297218881bb1d653b55f2169437c3e0..79453e41d726ced6ef5ff1f1dfdee76778631788 100644 (file)
@@ -225,8 +225,8 @@ static void xfrm_usersa_print(const struct xfrm_usersa_id *sa_id, __u32 reqid, F
        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 @@ static int xfrm_ae_print(const struct sockaddr_nl *who,
        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 @@ static int xfrm_ae_print(const struct sockaddr_nl *who,
        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 @@ static int xfrm_mapping_print(const struct sockaddr_nl *who,
        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);
index fd7db550f85eb2b5cd2b43555fd7844c9086fc2b..db34a2aae7b9e58eabada3d5ef5a0f363b9a7b7d 100644 (file)
@@ -28,7 +28,7 @@ struct ll_cache {
        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 @@ int ll_index_to_type(unsigned idx)
        return im ? im->type : -1;
 }
 
-unsigned ll_index_to_flags(unsigned idx)
+int ll_index_to_flags(unsigned idx)
 {
        const struct ll_cache *im;
 
index e9e104029fe1b049917afc7130f171aef34a9089..dc21567aca3a2703fd8103f57366872f706baafa 100644 (file)
@@ -454,19 +454,19 @@ int get_prefix_1(inet_prefix *dst, char *arg, int family)
        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 @@ int __get_user_hz(void)
        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 @@ const char *format_host(int af, int len, const void *addr,
                        return n;
        }
 #endif
-       return rt_addr_n2a(af, len, addr, buf, buflen);
+       return rt_addr_n2a(af, addr, buf, buflen);
 }