]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Merge branch 'master' into net-next
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 1 Sep 2017 19:17:48 +0000 (12:17 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 1 Sep 2017 19:17:48 +0000 (12:17 -0700)
Needed to add JSON support to tclass.

1  2 
include/utils.h
ip/iproute_lwtunnel.c
ip/link_gre6.c

diff --cc include/utils.h
Simple merge
Simple merge
diff --cc ip/link_gre6.c
index 957853d6e6e4143acdda4555d69be4113475102d,78b5215c65037cafc9764aecfc9a23bbe76a097b..7d07932a60f01f93f314fb6c2f79981b10ec9527
@@@ -463,36 -456,23 +465,54 @@@ static void gre_print_opt(struct link_u
        else if (tb[IFLA_GRE_ENCAP_LIMIT]) {
                int encap_limit = rta_getattr_u8(tb[IFLA_GRE_ENCAP_LIMIT]);
  
 -              fprintf(f, "encaplimit %d ", encap_limit);
 +              print_int(PRINT_ANY,
 +                        "encap_limit",
 +                        "encaplimit %d ",
 +                        encap_limit);
        }
  
 -      if (flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
 -              fprintf(f, "flowlabel inherit ");
 -      else
 -              fprintf(f, "flowlabel 0x%05x ",
 -                      ntohl(flowinfo & IP6_FLOWINFO_FLOWLABEL));
 +      if (flags & IP6_TNL_F_USE_ORIG_FLOWLABEL) {
 +              print_bool(PRINT_ANY,
 +                         "ip6_tnl_f_use_orig_flowlabel",
 +                         "flowlabel inherit ",
 +                         true);
 +      } else {
 +              if (is_json_context()) {
 +                      SPRINT_BUF(b1);
 +
 +                      snprintf(b1, sizeof(b1), "0x%05x",
 +                               ntohl(flowinfo & IP6_FLOWINFO_FLOWLABEL));
 +                      print_string(PRINT_JSON, "flowlabel", NULL, b1);
 +
 +              } else {
 +                      fprintf(f, "flowlabel 0x%05x ",
 +                              ntohl(flowinfo & IP6_FLOWINFO_FLOWLABEL));
 +              }
 +      }
  
 -      if (flags & IP6_TNL_F_USE_ORIG_TCLASS)
 -              fprintf(f, "tclass inherit ");
 -      else
 -              fprintf(f, "tclass 0x%02x ",
 -                      ntohl(flowinfo & IP6_FLOWINFO_TCLASS) >> 20);
++      if (flags & IP6_TNL_F_USE_ORIG_TCLASS) {
++              print_bool(PRINT_ANY,
++                         "ip6_tnl_f_use_orig_tclass",
++                         "tclass inherit ",
++                         true);
++      } else {
++              if (is_json_context()) {
++                      SPRINT_BUF(b1);
++
++                      snprintf(b1, sizeof(b1), "0x%05x",
++                               ntohl(flowinfo & IP6_FLOWINFO_TCLASS) >> 20);
++                      print_string(PRINT_JSON, "tclass", NULL, b1);
++              } else {
++                      fprintf(f, "tclass 0x%02x ",
++                               ntohl(flowinfo & IP6_FLOWINFO_TCLASS) >> 20);
++              }
++      }
        if (flags & IP6_TNL_F_RCV_DSCP_COPY)
 -              fprintf(f, "dscp inherit ");
 +              print_bool(PRINT_ANY,
 +                         "ip6_tnl_f_rcv_dscp_copy",
 +                         "dscp inherit ",
 +                         true);
  
        if (tb[IFLA_GRE_IFLAGS])
                iflags = rta_getattr_u16(tb[IFLA_GRE_IFLAGS]);