]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
tc: p_ip6: Support pedit of IPv6 dsfield
authorPetr Machata <petrm@mellanox.com>
Fri, 3 Apr 2020 23:05:29 +0000 (02:05 +0300)
committerDavid Ahern <dsahern@gmail.com>
Thu, 9 Apr 2020 14:39:58 +0000 (14:39 +0000)
Support keywords dsfield, traffic_class and tos in the IPv6 context.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
man/man8/tc-pedit.8
tc/p_ip6.c

index bbd725c4d0ba137147b2e44444fd487131d0c96c..3f6baa3ddaf5e9c086b29ef50d4a3d267d1b751a 100644 (file)
@@ -60,8 +60,8 @@ pedit - generic packet editor action
 
 .ti -8
 .IR IP6HDR_FIELD " := { "
-.BR src " | " dst " | " flow_lbl " | " payload_len " | " nexthdr " |"
-.BR hoplimit " }"
+.BR src " | " dst " | " traffic_class " | " flow_lbl " | " payload_len " | "
+.BR nexthdr " | " hoplimit " }"
 
 .ti -8
 .IR TCPHDR_FIELD " := { "
@@ -229,6 +229,8 @@ are:
 .TQ
 .B dst
 .TQ
+.B traffic_class
+.TQ
 .B flow_lbl
 .TQ
 .B payload_len
index 7cc7997bcdb3c493588422f250d74c2be3419f7d..71660c610c827b1a2c25370b1895639b5e12ed21 100644 (file)
@@ -74,6 +74,21 @@ parse_ip6(int *argc_p, char ***argv_p,
                res = parse_cmd(&argc, &argv, 1, TU32, RU8, sel, tkey);
                goto done;
        }
+       if (strcmp(*argv, "traffic_class") == 0) {
+               NEXT_ARG();
+               tkey->off = 1;
+               res = parse_cmd(&argc, &argv, 1, TU32, RU8, sel, tkey);
+
+               /* Shift the field by 4 bits on success. */
+               if (!res) {
+                       int nkeys = sel->sel.nkeys;
+                       struct tc_pedit_key *key = &sel->sel.keys[nkeys - 1];
+
+                       key->mask = htonl(ntohl(key->mask) << 4 | 0xf);
+                       key->val = htonl(ntohl(key->val) << 4);
+               }
+               goto done;
+       }
 
        return -1;