]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ip6/tunnel: Unify encap_limit printing
authorSerhey Popovych <serhe.popovych@gmail.com>
Wed, 10 Jan 2018 15:53:13 +0000 (17:53 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 10 Jan 2018 16:06:12 +0000 (08:06 -0800)
Use %u format specifier to print it in link_gre6.c and
make code more readable.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/link_gre6.c
ip/link_ip6tnl.c

index 1205946f137ecf91d970451dfe7110979c4728dd..8014207db6a1467b6d66f2ac15b45507c856c392 100644 (file)
@@ -433,18 +433,15 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
                        print_int(PRINT_JSON, "ttl", NULL, ttl);
        }
 
-       if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT)
+       if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT) {
                print_bool(PRINT_ANY,
                           "ip6_tnl_f_ign_encap_limit",
                           "encaplimit none ",
                           true);
-       else if (tb[IFLA_GRE_ENCAP_LIMIT]) {
-               int encap_limit = rta_getattr_u8(tb[IFLA_GRE_ENCAP_LIMIT]);
+       else if (tb[IFLA_GRE_ENCAP_LIMIT]) {
+               __u8 val = rta_getattr_u8(tb[IFLA_GRE_ENCAP_LIMIT]);
 
-               print_int(PRINT_ANY,
-                         "encap_limit",
-                         "encaplimit %d ",
-                         encap_limit);
+               print_uint(PRINT_ANY, "encap_limit", "encaplimit %u ", val);
        }
 
        if (flags & IP6_TNL_F_USE_ORIG_FLOWLABEL) {
index 7000056b6e2e41bbdd9709360562c2590219f031..379eb3315319ff88dccdbca8d5ad5c6822286b1c 100644 (file)
@@ -387,16 +387,16 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb
                        print_uint(PRINT_ANY, "link_index", "dev %u ", link);
        }
 
-       if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT)
+       if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT) {
                print_bool(PRINT_ANY,
                           "ip6_tnl_f_ign_encap_limit",
                           "encaplimit none ",
                           true);
-       else if (tb[IFLA_IPTUN_ENCAP_LIMIT])
-               print_uint(PRINT_ANY,
-                          "encap_limit",
-                          "encaplimit %u ",
-                          rta_getattr_u8(tb[IFLA_IPTUN_ENCAP_LIMIT]));
+       } else if (tb[IFLA_IPTUN_ENCAP_LIMIT]) {
+               __u8 val = rta_getattr_u8(tb[IFLA_IPTUN_ENCAP_LIMIT]);
+
+               print_uint(PRINT_ANY, "encap_limit", "encaplimit %u ", val);
+       }
 
        if (tb[IFLA_IPTUN_TTL])
                print_uint(PRINT_ANY,