]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - ip/link_gre6.c
Merge branch 'master' into net-next
[mirror_iproute2.git] / ip / link_gre6.c
index 957853d6e6e4143acdda4555d69be4113475102d..7d07932a60f01f93f314fb6c2f79981b10ec9527 100644 (file)
@@ -288,6 +288,7 @@ get_failed:
                        else {
                                if (get_u8(&uval, *argv, 16))
                                        invarg("invalid TClass", *argv);
+                               flowinfo &= ~IP6_FLOWINFO_TCLASS;
                                flowinfo |= htonl((__u32)uval << 20) & IP6_FLOWINFO_TCLASS;
                                flags &= ~IP6_TNL_F_USE_ORIG_TCLASS;
                        }
@@ -303,6 +304,7 @@ get_failed:
                                        invarg("invalid Flowlabel", *argv);
                                if (uval > 0xFFFFF)
                                        invarg("invalid Flowlabel", *argv);
+                               flowinfo &= ~IP6_FLOWINFO_FLOWLABEL;
                                flowinfo |= htonl(uval) & IP6_FLOWINFO_FLOWLABEL;
                                flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL;
                        }
@@ -488,6 +490,24 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
                }
        }
 
+       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)
                print_bool(PRINT_ANY,
                           "ip6_tnl_f_rcv_dscp_copy",