From: Stephen Hemminger Date: Fri, 1 Sep 2017 19:17:48 +0000 (-0700) Subject: Merge branch 'master' into net-next X-Git-Tag: v4.14.0~39^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e706e12d9b006c36812f4798446e7de4d3e7f6e;p=thirdparty%2Fiproute2.git Merge branch 'master' into net-next Needed to add JSON support to tclass. --- 2e706e12d9b006c36812f4798446e7de4d3e7f6e diff --cc ip/link_gre6.c index 957853d6e,78b5215c6..7d07932a6 --- a/ip/link_gre6.c +++ b/ip/link_gre6.c @@@ -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]);