]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Merge branch 'master' into net-next
authorDavid Ahern <dsahern@gmail.com>
Sun, 21 Jan 2018 17:37:01 +0000 (09:37 -0800)
committerDavid Ahern <dsahern@gmail.com>
Sun, 21 Jan 2018 17:37:39 +0000 (09:37 -0800)
Conflicts:
ip/link_gre.c
ip/link_gre6.c

Signed-off-by: David Ahern <dsahern@gmail.com>
1  2 
ip/ipaddress.c
ip/iplink.c
ip/link_gre.c
ip/link_gre6.c
man/man8/ip-link.8.in
tc/m_action.c
tc/tc_filter.c

diff --cc ip/ipaddress.c
Simple merge
diff --cc ip/iplink.c
Simple merge
diff --cc ip/link_gre.c
index 52c581d224ac582ae7231340bd09af5a85d52324,6254e8875135088facb9e363242da76427ea0bde..674603ba7a25f0d456cc077ad3ecd593567b9d5c
@@@ -518,102 -465,15 +506,37 @@@ static void gre_print_opt(struct link_u
        if (tb[IFLA_GRE_ERSPAN_INDEX]) {
                __u32 erspan_idx = rta_getattr_u32(tb[IFLA_GRE_ERSPAN_INDEX]);
  
 -              print_uint(PRINT_ANY,
 -                         "erspan_index", "erspan_index %u ", erspan_idx);
 +              print_uint(PRINT_ANY, "erspan_index", "erspan_index %u ", erspan_idx);
 +      }
 +
 +      if (tb[IFLA_GRE_ERSPAN_VER]) {
 +              __u8 erspan_ver = rta_getattr_u8(tb[IFLA_GRE_ERSPAN_VER]);
 +
 +              print_uint(PRINT_ANY, "erspan_ver", "erspan_ver %u ", erspan_ver);
 +      }
 +
 +      if (tb[IFLA_GRE_ERSPAN_DIR]) {
 +              __u8 erspan_dir = rta_getattr_u8(tb[IFLA_GRE_ERSPAN_DIR]);
 +
 +              if (erspan_dir == 0)
 +                      print_string(PRINT_ANY, "erspan_dir",
 +                                   "erspan_dir ingress ", NULL);
 +              else
 +                      print_string(PRINT_ANY, "erspan_dir",
 +                                   "erspan_dir egress ", NULL);
 +      }
 +
 +      if (tb[IFLA_GRE_ERSPAN_HWID]) {
 +              __u16 erspan_hwid = rta_getattr_u16(tb[IFLA_GRE_ERSPAN_HWID]);
 +
 +              print_hex(PRINT_ANY, "erspan_hwid", "erspan_hwid 0x%x ", erspan_hwid);
        }
  
-       if (tb[IFLA_GRE_ENCAP_TYPE] &&
-           rta_getattr_u16(tb[IFLA_GRE_ENCAP_TYPE]) != TUNNEL_ENCAP_NONE) {
-               __u16 type = rta_getattr_u16(tb[IFLA_GRE_ENCAP_TYPE]);
-               __u16 flags = rta_getattr_u16(tb[IFLA_GRE_ENCAP_FLAGS]);
-               __u16 sport = rta_getattr_u16(tb[IFLA_GRE_ENCAP_SPORT]);
-               __u16 dport = rta_getattr_u16(tb[IFLA_GRE_ENCAP_DPORT]);
-               open_json_object("encap");
-               print_string(PRINT_FP, NULL, "encap ", NULL);
-               switch (type) {
-               case TUNNEL_ENCAP_FOU:
-                       print_string(PRINT_ANY, "type", "%s ", "fou");
-                       break;
-               case TUNNEL_ENCAP_GUE:
-                       print_string(PRINT_ANY, "type", "%s ", "gue");
-                       break;
-               default:
-                       print_null(PRINT_ANY, "type", "%s ", "unknown");
-                       break;
-               }
-               if (is_json_context()) {
-                       print_uint(PRINT_JSON,
-                                  "sport",
-                                  NULL,
-                                  sport ? ntohs(sport) : 0);
-                       print_uint(PRINT_JSON, "dport", NULL, ntohs(dport));
-                       print_bool(PRINT_JSON,
-                                  "csum",
-                                  NULL,
-                                  flags & TUNNEL_ENCAP_FLAG_CSUM);
-                       print_bool(PRINT_JSON,
-                                  "csum6",
-                                  NULL,
-                                  flags & TUNNEL_ENCAP_FLAG_CSUM6);
-                       print_bool(PRINT_JSON,
-                                  "remcsum",
-                                  NULL,
-                                  flags & TUNNEL_ENCAP_FLAG_REMCSUM);
-                       close_json_object();
-               } else {
-                       if (sport == 0)
-                               fputs("encap-sport auto ", f);
-                       else
-                               fprintf(f, "encap-sport %u", ntohs(sport));
-                       fprintf(f, "encap-dport %u ", ntohs(dport));
-                       if (flags & TUNNEL_ENCAP_FLAG_CSUM)
-                               fputs("encap-csum ", f);
-                       else
-                               fputs("noencap-csum ", f);
-                       if (flags & TUNNEL_ENCAP_FLAG_CSUM6)
-                               fputs("encap-csum6 ", f);
-                       else
-                               fputs("noencap-csum6 ", f);
-                       if (flags & TUNNEL_ENCAP_FLAG_REMCSUM)
-                               fputs("encap-remcsum ", f);
-                       else
-                               fputs("noencap-remcsum ", f);
-               }
-       }
+       tnl_print_encap(tb,
+                       IFLA_GRE_ENCAP_TYPE,
+                       IFLA_GRE_ENCAP_FLAGS,
+                       IFLA_GRE_ENCAP_SPORT,
+                       IFLA_GRE_ENCAP_DPORT);
  }
  
  static void gre_print_help(struct link_util *lu, int argc, char **argv,
diff --cc ip/link_gre6.c
index bc33026c31d0d12f75314ab041061ad125b3a65b,29ca3d1373d891d268fac08a8f2b6c3e7aa9f304..a0eeb5a63cd115c24276a1b59834c93068ee0af2
@@@ -587,91 -513,16 +568,80 @@@ static void gre_print_opt(struct link_u
  
        if (tb[IFLA_GRE_ERSPAN_INDEX]) {
                __u32 erspan_idx = rta_getattr_u32(tb[IFLA_GRE_ERSPAN_INDEX]);
 +              print_uint(PRINT_ANY, "erspan_index", "erspan_index %u ", erspan_idx);
 +      }
 +
 +      if (tb[IFLA_GRE_ERSPAN_VER]) {
 +              __u8 erspan_ver = rta_getattr_u8(tb[IFLA_GRE_ERSPAN_VER]);
 +
 +              print_uint(PRINT_ANY, "erspan_ver", "erspan_ver %u ", erspan_ver);
 +      }
 +
 +      if (tb[IFLA_GRE_ERSPAN_DIR]) {
 +              __u8 erspan_dir = rta_getattr_u8(tb[IFLA_GRE_ERSPAN_DIR]);
 +
 +              if (erspan_dir == 0)
 +                      print_string(PRINT_ANY, "erspan_dir",
 +                                   "erspan_dir ingress ", NULL);
 +              else
 +                      print_string(PRINT_ANY, "erspan_dir",
 +                                   "erspan_dir egress ", NULL);
 +      }
  
 -              print_uint(PRINT_ANY,
 -                         "erspan_index", "erspan_index %u ", erspan_idx);
 +      if (tb[IFLA_GRE_ERSPAN_HWID]) {
 +              __u16 erspan_hwid = rta_getattr_u16(tb[IFLA_GRE_ERSPAN_HWID]);
 +
 +              print_hex(PRINT_ANY, "erspan_hwid", "erspan_hwid 0x%x ", erspan_hwid);
 +      }
 +
 +      if (tb[IFLA_GRE_ENCAP_TYPE] &&
 +          rta_getattr_u16(tb[IFLA_GRE_ENCAP_TYPE]) != TUNNEL_ENCAP_NONE) {
 +              __u16 type = rta_getattr_u16(tb[IFLA_GRE_ENCAP_TYPE]);
 +              __u16 flags = rta_getattr_u16(tb[IFLA_GRE_ENCAP_FLAGS]);
 +              __u16 sport = rta_getattr_u16(tb[IFLA_GRE_ENCAP_SPORT]);
 +              __u16 dport = rta_getattr_u16(tb[IFLA_GRE_ENCAP_DPORT]);
 +
 +              open_json_object("encap");
 +
 +              print_string(PRINT_FP, NULL, "encap ", NULL);
 +              switch (type) {
 +              case TUNNEL_ENCAP_FOU:
 +                      print_string(PRINT_ANY, "type", "%s ", "fou");
 +                      break;
 +              case TUNNEL_ENCAP_GUE:
 +                      print_string(PRINT_ANY, "type", "%s ", "gue");
 +                      break;
 +              default:
 +                      print_null(PRINT_ANY, "type", "unknown ", NULL);
 +                      break;
 +              }
 +
 +              if (is_json_context()) {
 +                      print_uint(PRINT_JSON,
 +                                 "sport",
 +                                 NULL,
 +                                 sport ? ntohs(sport) : 0);
 +                      print_uint(PRINT_JSON, "dport", NULL, ntohs(dport));
 +                      print_bool(PRINT_JSON, "csum", NULL,
 +                                         flags & TUNNEL_ENCAP_FLAG_CSUM);
 +                      print_bool(PRINT_JSON, "csum6", NULL,
 +                                         flags & TUNNEL_ENCAP_FLAG_CSUM6);
 +                      print_bool(PRINT_JSON, "remcsum", NULL,
 +                                         flags & TUNNEL_ENCAP_FLAG_REMCSUM);
 +                      close_json_object();
 +              } else {
 +                      if (sport == 0)
 +                              fputs("encap-sport auto ", f);
 +                      else
 +                              fprintf(f, "encap-sport %u", ntohs(sport));
-                       fprintf(f, "encap-dport %u ", ntohs(dport));
-                       if (flags & TUNNEL_ENCAP_FLAG_CSUM)
-                               fputs("encap-csum ", f);
-                       else
-                               fputs("noencap-csum ", f);
-                       if (flags & TUNNEL_ENCAP_FLAG_CSUM6)
-                               fputs("encap-csum6 ", f);
-                       else
-                               fputs("noencap-csum6 ", f);
-                       if (flags & TUNNEL_ENCAP_FLAG_REMCSUM)
-                               fputs("encap-remcsum ", f);
-                       else
-                               fputs("noencap-remcsum ", f);
 +              }
        }
+       tnl_print_encap(tb,
+                       IFLA_GRE_ENCAP_TYPE,
+                       IFLA_GRE_ENCAP_FLAGS,
+                       IFLA_GRE_ENCAP_SPORT,
+                       IFLA_GRE_ENCAP_DPORT);
  }
  
  static void gre_print_help(struct link_util *lu, int argc, char **argv,
Simple merge
diff --cc tc/m_action.c
Simple merge
diff --cc tc/tc_filter.c
Simple merge