7c36fd9ba0ad0566c3bc9562ce47be2cb7b8424b
[openwrt/staging/luka.git] / package / network / utils / iproute2 / patches / 090-tc-add-support-for-action-act_ctinfo.patch
1 From b47fffb0f6dc285fe39613a5838e4e50f4f35202 Mon Sep 17 00:00:00 2001
2 From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
3 Date: Fri, 15 Mar 2019 09:35:37 +0000
4 Subject: [PATCH] tc: add support for action act_ctinfo
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 ctinfo is a tc action restoring data stored in conntrack marks to
10 various fields. At present it has two independent modes of operation,
11 restoration of DSCP into IPv4/v6 diffserv and restoration of conntrack
12 marks into packet skb marks.
13
14 It understands a number of parameters specific to this action in
15 additional to the usual action syntax. Each operating mode is
16 independent of the other so all options are optional, however not
17 specifying at least one mode is a bit pointless.
18
19 Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE]
20 [CONTROL] [index <INDEX>]
21
22 DSCP mode
23
24 dscp enables copying of a DSCP stored in the conntrack mark into the
25 ipv4/v6 diffserv field. The mask is a 32bit field and specifies where
26 in the conntrack mark the DSCP value is located. It must be 6
27 contiguous bits long. eg. 0xfc000000 would restore the DSCP from the
28 upper 6 bits of the conntrack mark.
29
30 The DSCP copying may be optionally controlled by a statemask. The
31 statemask is a 32bit field, usually with a single bit set and must not
32 overlap the dscp mask. The DSCP restore operation will only take place
33 if the corresponding bit/s in conntrack mark ANDed with the statemask
34 yield a non zero result.
35
36 eg. dscp 0xfc000000 0x01000000 would retrieve the DSCP from the top 6
37 bits, whilst using bit 25 as a flag to do so. Bit 26 is unused in this
38 example.
39
40 CPMARK mode
41
42 cpmark enables copying of the conntrack mark to the packet skb mark. In
43 this mode it is completely equivalent to the existing act_connmark
44 action. Additional functionality is provided by the optional mask
45 parameter, whereby the stored conntrack mark is logically ANDed with the
46 cpmark mask before being stored into skb mark. This allows shared usage
47 of the conntrack mark between applications.
48
49 eg. cpmark 0x00ffffff would restore only the lower 24 bits of the
50 conntrack mark, thus may be useful in the event that the upper 8 bits
51 are used by the DSCP function.
52
53 Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE]
54 [CONTROL] [index <INDEX>]
55 where :
56 dscp MASK is the bitmask to restore DSCP
57 STATEMASK is the bitmask to determine conditional restoring
58 cpmark MASK mask applied to restored packet mark
59 ZONE is the conntrack zone
60 CONTROL := reclassify | pipe | drop | continue | ok |
61 goto chain <CHAIN_INDEX>
62
63 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
64 Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
65 ---
66 include/uapi/linux/pkt_cls.h | 3 +-
67 include/uapi/linux/tc_act/tc_ctinfo.h | 34 ++++
68 man/man8/tc-ctinfo.8 | 170 ++++++++++++++++
69 tc/Makefile | 1 +
70 tc/m_ctinfo.c | 268 ++++++++++++++++++++++++++
71 5 files changed, 475 insertions(+), 1 deletion(-)
72 create mode 100644 include/uapi/linux/tc_act/tc_ctinfo.h
73 create mode 100644 man/man8/tc-ctinfo.8
74 create mode 100644 tc/m_ctinfo.c
75
76 diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
77 index 95d0db2a..a6e7e176 100644
78 --- a/include/uapi/linux/pkt_cls.h
79 +++ b/include/uapi/linux/pkt_cls.h
80 @@ -68,7 +68,8 @@ enum {
81 TCA_ID_UNSPEC=0,
82 TCA_ID_POLICE=1,
83 /* other actions go here */
84 - __TCA_ID_MAX=255
85 + TCA_ID_CTINFO=27,
86 + __TCA_ID_MAX = 255
87 };
88
89 #define TCA_ID_MAX __TCA_ID_MAX
90 diff --git a/include/uapi/linux/tc_act/tc_ctinfo.h b/include/uapi/linux/tc_act/tc_ctinfo.h
91 new file mode 100644
92 index 00000000..da803e05
93 --- /dev/null
94 +++ b/include/uapi/linux/tc_act/tc_ctinfo.h
95 @@ -0,0 +1,34 @@
96 +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
97 +#ifndef __UAPI_TC_CTINFO_H
98 +#define __UAPI_TC_CTINFO_H
99 +
100 +#include <linux/types.h>
101 +#include <linux/pkt_cls.h>
102 +
103 +struct tc_ctinfo {
104 + tc_gen;
105 +};
106 +
107 +enum {
108 + TCA_CTINFO_UNSPEC,
109 + TCA_CTINFO_PAD,
110 + TCA_CTINFO_TM,
111 + TCA_CTINFO_ACT,
112 + TCA_CTINFO_ZONE,
113 + TCA_CTINFO_PARMS_DSCP_MASK,
114 + TCA_CTINFO_PARMS_DSCP_STATEMASK,
115 + TCA_CTINFO_PARMS_CPMARK_MASK,
116 + TCA_CTINFO_STATS_DSCP_SET,
117 + TCA_CTINFO_STATS_DSCP_ERROR,
118 + TCA_CTINFO_STATS_CPMARK_SET,
119 + __TCA_CTINFO_MAX
120 +};
121 +
122 +#define TCA_CTINFO_MAX (__TCA_CTINFO_MAX - 1)
123 +
124 +enum {
125 + CTINFO_MODE_DSCP = BIT(0),
126 + CTINFO_MODE_CPMARK = BIT(1)
127 +};
128 +
129 +#endif
130 diff --git a/man/man8/tc-ctinfo.8 b/man/man8/tc-ctinfo.8
131 new file mode 100644
132 index 00000000..096590d1
133 --- /dev/null
134 +++ b/man/man8/tc-ctinfo.8
135 @@ -0,0 +1,170 @@
136 +.TH "ctinfo action in tc" 8 "4 Jun 2019" "iproute2" "Linux"
137 +.SH NAME
138 +ctinfo \- tc connmark processing action
139 +.SH SYNOPSIS
140 +.B tc ... action ctinfo
141 +[
142 +.B dscp
143 +MASK [STATEMASK] ] [
144 +.B cpmark
145 +[MASK] ] [
146 +.B zone
147 +ZONE ] [
148 +.B CONTROL
149 +] [
150 +.B index
151 +<INDEX>
152 +]
153 +
154 +.SH DESCRIPTION
155 +CTINFO (Conntrack Information) is a tc action for retrieving data from
156 +conntrack marks into various fields. At present it has two independent
157 +processing modes which may be viewed as sub-functions.
158 +
159 +DSCP mode copies a DSCP stored in conntrack's connmark into the IPv4/v6 diffserv
160 +field. The copying may conditionally occur based on a flag also stored in the
161 +connmark. DSCP mode was designed to assist in restoring packet classifications on
162 +ingress, classifications which may then be used by qdiscs such as CAKE. It may be
163 +used in any circumstance where ingress classification needs to be maintained across
164 +links that otherwise bleach or remap according to their own policies.
165 +
166 +CPMARK (copymark) mode copies the conntrack connmark into the packet's mark field. Without
167 +additional parameters it is functionally completely equivalent to the existing
168 +connmark action. An optional mask may be specified to mask which bits of the
169 +connmark are restored. This may be useful when DSCP and CPMARK modes are combined.
170 +
171 +Simple statistics (tc -s) on DSCP restores and CPMARK copies are maintained where values for
172 +set indicate a count of packets altered for that mode. DSCP includes an error count
173 +where the destination packet's diffserv field was unwriteable.
174 +.SH PARAMETERS
175 +.SS DSCP mode parameters:
176 +.IP mask
177 +A mask of 6 contiguous bits indicating where the DSCP value is located in the 32 bit
178 +conntrack mark field. A mask must be provided for this mode. mask is a 32 bit
179 +unsigned value.
180 +.IP statemask
181 +A mask of at least 1 bit indicating where a conditional restore flag is located in the
182 +32 bit conntrack mark field. The statemask bit/s must NOT overlap the mask bits. The
183 +DSCP will be restored if the conntrack mark logically ANDed with the statemask yields
184 +a non-zero result. statemask is an optional unsigned 32 bit value.
185 +.SS CPMARK mode parameters:
186 +.IP mask
187 +Store the logically ANDed result of conntrack mark and mask into the packet's mark
188 +field. Default is 0xffffffff i.e. the whole mark field. mask is an optional unsigned 32 bit
189 +value
190 +.SS Overall action parameters:
191 +.IP zone
192 +Specify the conntrack zone when doing conntrack lookups for packets.
193 +zone is a 16bit unsigned decimal value.
194 +Default is 0.
195 +.IP CONTROL
196 +The following keywords allow to control how the tree of qdisc, classes,
197 +filters and actions is further traversed after this action.
198 +.RS
199 +.TP
200 +.B reclassify
201 +Restart with the first filter in the current list.
202 +.TP
203 +.B pipe
204 +Continue with the next action attached to the same filter.
205 +.TP
206 +.B drop
207 +Drop the packet.
208 +.TP
209 +.B shot
210 +synonym for
211 +.B drop
212 +.TP
213 +.B continue
214 +Continue classification with the next filter in line.
215 +.TP
216 +.B pass
217 +Finish classification process and return to calling qdisc for further packet
218 +processing. This is the default.
219 +.RE
220 +.IP index
221 +Specify an index for this action in order to being able to identify it in later
222 +commands. index is a 32bit unsigned decimal value.
223 +.SH EXAMPLES
224 +Example showing conditional restoration of DSCP on ingress via an IFB
225 +.RS
226 +.EX
227 +
228 +#Set up the IFB interface
229 +.br
230 +tc qdisc add dev ifb4eth0 handle ffff: ingress
231 +
232 +#Put CAKE qdisc on it
233 +.br
234 +tc qdisc add dev ifb4eth0 root cake bandwidth 40mbit
235 +
236 +#Set interface UP
237 +.br
238 +ip link set dev ifb4eth0 up
239 +
240 +#Add 2 actions, ctinfo to restore dscp & mirred to redirect the packets to IFB
241 +.br
242 +tc filter add dev eth0 parent ffff: protocol all prio 10 u32 \\
243 + match u32 0 0 flowid 1:1 action \\
244 + ctinfo dscp 0xfc000000 0x01000000 \\
245 + mirred egress redirect dev ifb4eth0
246 +
247 +tc -s qdisc show dev eth0 ingress
248 +
249 + filter parent ffff: protocol all pref 10 u32 chain 0
250 + filter parent ffff: protocol all pref 10 u32 chain 0 fh 800: ht divisor 1
251 + filter parent ffff: protocol all pref 10 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw
252 + match 00000000/00000000 at 0
253 + action order 1: ctinfo zone 0 pipe
254 + index 2 ref 1 bind 1 dscp 0xfc000000 0x01000000 installed 72 sec used 0 sec DSCP set 1333 error 0 CPMARK set 0
255 + Action statistics:
256 + Sent 658484 bytes 1833 pkt (dropped 0, overlimits 0 requeues 0)
257 + backlog 0b 0p requeues 0
258 +
259 + action order 2: mirred (Egress Redirect to device ifb4eth0) stolen
260 + index 1 ref 1 bind 1 installed 72 sec used 0 sec
261 + Action statistics:
262 + Sent 658484 bytes 1833 pkt (dropped 0, overlimits 0 requeues 0)
263 + backlog 0b 0p requeues 0
264 +.EE
265 +.RE
266 +
267 +Example showing conditional restoration of DSCP on egress
268 +
269 +This may appear nonsensical since iptables marking of egress packets is easy
270 +to achieve, however the iptables flow classification rules may be extensive
271 +and so some sort of set once and forget may be useful especially on cpu
272 +constrained devices.
273 +.RS
274 +.EX
275 +
276 +# Send unmarked connections to a marking chain which needs to store a DSCP
277 +and set statemask bit in the connmark
278 +.br
279 +iptables -t mangle -A POSTROUTING -o eth0 -m connmark \\
280 + --mark 0x00000000/0x01000000 -g CLASS_MARKING_CHAIN
281 +
282 +# Apply marked DSCP to the packets
283 +.br
284 +tc filter add dev eth0 protocol all prio 10 u32 \\
285 + match u32 0 0 flowid 1:1 action \\
286 + ctinfo dscp 0xfc000000 0x01000000
287 +
288 +tc -s filter show dev eth0
289 + filter parent 800e: protocol all pref 10 u32 chain 0
290 + filter parent 800e: protocol all pref 10 u32 chain 0 fh 800: ht divisor 1
291 + filter parent 800e: protocol all pref 10 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw
292 + match 00000000/00000000 at 0
293 + action order 1: ctinfo zone 0 pipe
294 + index 1 ref 1 bind 1 dscp 0xfc000000 0x01000000 installed 7414 sec used 0 sec DSCP set 53404 error 0 CPMARK set 0
295 + Action statistics:
296 + Sent 32890260 bytes 120441 pkt (dropped 0, overlimits 0 requeues 0)
297 + backlog 0b 0p requeues 0
298 +.br
299 +.SH SEE ALSO
300 +.BR tc (8),
301 +.BR tc-cake (8)
302 +.BR tc-connmark (8)
303 +.BR tc-mirred (8)
304 +.SH AUTHORS
305 +ctinfo was written by Kevin Darbyshire-Bryant.
306 diff --git a/tc/Makefile b/tc/Makefile
307 index 2edaf2c8..ec93a9a1 100644
308 --- a/tc/Makefile
309 +++ b/tc/Makefile
310 @@ -48,6 +48,7 @@ TCMODULES += m_csum.o
311 TCMODULES += m_simple.o
312 TCMODULES += m_vlan.o
313 TCMODULES += m_connmark.o
314 +TCMODULES += m_ctinfo.o
315 TCMODULES += m_bpf.o
316 TCMODULES += m_tunnel_key.o
317 TCMODULES += m_sample.o
318 diff --git a/tc/m_ctinfo.c b/tc/m_ctinfo.c
319 new file mode 100644
320 index 00000000..5e451f87
321 --- /dev/null
322 +++ b/tc/m_ctinfo.c
323 @@ -0,0 +1,268 @@
324 +/* SPDX-License-Identifier: GPL-2.0 */
325 +/*
326 + * m_ctinfo.c netfilter ctinfo mark action
327 + *
328 + * Copyright (c) 2019 Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
329 + */
330 +
331 +#include <stdio.h>
332 +#include <stdlib.h>
333 +#include <unistd.h>
334 +#include <string.h>
335 +#include "utils.h"
336 +#include "tc_util.h"
337 +#include <linux/tc_act/tc_ctinfo.h>
338 +
339 +static void
340 +explain(void)
341 +{
342 + fprintf(stderr,
343 + "Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE] [CONTROL] [index <INDEX>]\n"
344 + "where :\n"
345 + "\tdscp MASK bitmask location of stored DSCP\n"
346 + "\t STATEMASK bitmask to determine conditional restoring\n"
347 + "\tcpmark MASK mask applied to mark on restoration\n"
348 + "\tZONE is the conntrack zone\n"
349 + "\tCONTROL := reclassify | pipe | drop | continue | ok |\n"
350 + "\t goto chain <CHAIN_INDEX>\n");
351 +}
352 +
353 +static void
354 +usage(void)
355 +{
356 + explain();
357 + exit(-1);
358 +}
359 +
360 +static int
361 +parse_ctinfo(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
362 + struct nlmsghdr *n)
363 +{
364 + unsigned int cpmarkmask = 0, dscpmask = 0, dscpstatemask = 0;
365 + struct tc_ctinfo sel = {};
366 + unsigned short zone = 0;
367 + char **argv = *argv_p;
368 + struct rtattr *tail;
369 + int argc = *argc_p;
370 + int ok = 0;
371 + __u8 i;
372 +
373 + while (argc > 0) {
374 + if (matches(*argv, "ctinfo") == 0) {
375 + ok = 1;
376 + NEXT_ARG_FWD();
377 + } else if (matches(*argv, "help") == 0) {
378 + usage();
379 + } else {
380 + break;
381 + }
382 +
383 + }
384 +
385 + if (!ok) {
386 + explain();
387 + return -1;
388 + }
389 +
390 + if (argc) {
391 + if (matches(*argv, "dscp") == 0) {
392 + NEXT_ARG();
393 + if (get_u32(&dscpmask, *argv, 0)) {
394 + fprintf(stderr,
395 + "ctinfo: Illegal dscp \"mask\"\n");
396 + return -1;
397 + }
398 + if (NEXT_ARG_OK()) {
399 + NEXT_ARG_FWD();
400 + if (!get_u32(&dscpstatemask, *argv, 0))
401 + NEXT_ARG_FWD(); /* was a statemask */
402 + } else {
403 + NEXT_ARG_FWD();
404 + }
405 + }
406 + }
407 +
408 + /* cpmark has optional mask parameter, so the next arg might not */
409 + /* exist, or it might be the next option, or it may actually be a */
410 + /* 32bit mask */
411 + if (argc) {
412 + if (matches(*argv, "cpmark") == 0) {
413 + cpmarkmask = ~0;
414 + if (NEXT_ARG_OK()) {
415 + NEXT_ARG_FWD();
416 + if (!get_u32(&cpmarkmask, *argv, 0))
417 + NEXT_ARG_FWD(); /* was a mask */
418 + } else {
419 + NEXT_ARG_FWD();
420 + }
421 + }
422 + }
423 +
424 + if (argc) {
425 + if (matches(*argv, "zone") == 0) {
426 + NEXT_ARG();
427 + if (get_u16(&zone, *argv, 10)) {
428 + fprintf(stderr, "ctinfo: Illegal \"zone\"\n");
429 + return -1;
430 + }
431 + NEXT_ARG_FWD();
432 + }
433 + }
434 +
435 + parse_action_control_dflt(&argc, &argv, &sel.action,
436 + false, TC_ACT_PIPE);
437 +
438 + if (argc) {
439 + if (matches(*argv, "index") == 0) {
440 + NEXT_ARG();
441 + if (get_u32(&sel.index, *argv, 10)) {
442 + fprintf(stderr, "ctinfo: Illegal \"index\"\n");
443 + return -1;
444 + }
445 + NEXT_ARG_FWD();
446 + }
447 + }
448 +
449 + if (dscpmask & dscpstatemask) {
450 + fprintf(stderr,
451 + "ctinfo: dscp mask & statemask must NOT overlap\n");
452 + return -1;
453 + }
454 +
455 + i = ffs(dscpmask);
456 + if (i && ((~0 & (dscpmask >> (i - 1))) != 0x3f)) {
457 + fprintf(stderr,
458 + "ctinfo: dscp mask must be 6 contiguous bits long\n");
459 + return -1;
460 + }
461 +
462 + tail = addattr_nest(n, MAX_MSG, tca_id);
463 + addattr_l(n, MAX_MSG, TCA_CTINFO_ACT, &sel, sizeof(sel));
464 + addattr16(n, MAX_MSG, TCA_CTINFO_ZONE, zone);
465 +
466 + if (dscpmask)
467 + addattr32(n, MAX_MSG,
468 + TCA_CTINFO_PARMS_DSCP_MASK, dscpmask);
469 +
470 + if (dscpstatemask)
471 + addattr32(n, MAX_MSG,
472 + TCA_CTINFO_PARMS_DSCP_STATEMASK, dscpstatemask);
473 +
474 + if (cpmarkmask)
475 + addattr32(n, MAX_MSG,
476 + TCA_CTINFO_PARMS_CPMARK_MASK, cpmarkmask);
477 +
478 + addattr_nest_end(n, tail);
479 +
480 + *argc_p = argc;
481 + *argv_p = argv;
482 + return 0;
483 +}
484 +
485 +static void print_ctinfo_stats(FILE *f, struct rtattr *tb[TCA_CTINFO_MAX + 1])
486 +{
487 + struct tcf_t *tm;
488 +
489 + if (tb[TCA_CTINFO_TM]) {
490 + tm = RTA_DATA(tb[TCA_CTINFO_TM]);
491 +
492 + print_tm(f, tm);
493 + }
494 +
495 + if (tb[TCA_CTINFO_STATS_DSCP_SET])
496 + print_lluint(PRINT_ANY, "dscpset", " DSCP set %llu",
497 + rta_getattr_u64(tb[TCA_CTINFO_STATS_DSCP_SET]));
498 + if (tb[TCA_CTINFO_STATS_DSCP_ERROR])
499 + print_lluint(PRINT_ANY, "dscperror", " error %llu",
500 + rta_getattr_u64(tb[TCA_CTINFO_STATS_DSCP_ERROR]));
501 +
502 + if (tb[TCA_CTINFO_STATS_CPMARK_SET])
503 + print_lluint(PRINT_ANY, "cpmarkset", " CPMARK set %llu",
504 + rta_getattr_u64(tb[TCA_CTINFO_STATS_CPMARK_SET]));
505 +}
506 +
507 +static int print_ctinfo(struct action_util *au, FILE *f, struct rtattr *arg)
508 +{
509 + unsigned int cpmarkmask = ~0, dscpmask = 0, dscpstatemask = 0;
510 + struct rtattr *tb[TCA_CTINFO_MAX + 1];
511 + unsigned short zone = 0;
512 + struct tc_ctinfo *ci;
513 +
514 + if (arg == NULL)
515 + return -1;
516 +
517 + parse_rtattr_nested(tb, TCA_CTINFO_MAX, arg);
518 + if (!tb[TCA_CTINFO_ACT]) {
519 + print_string(PRINT_FP, NULL, "%s",
520 + "[NULL ctinfo action parameters]");
521 + return -1;
522 + }
523 +
524 + ci = RTA_DATA(tb[TCA_CTINFO_ACT]);
525 +
526 + if (tb[TCA_CTINFO_PARMS_DSCP_MASK]) {
527 + if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_DSCP_MASK]) >=
528 + sizeof(__u32))
529 + dscpmask = rta_getattr_u32(
530 + tb[TCA_CTINFO_PARMS_DSCP_MASK]);
531 + else
532 + print_string(PRINT_FP, NULL, "%s",
533 + "[invalid dscp mask parameter]");
534 + }
535 +
536 + if (tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]) {
537 + if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]) >=
538 + sizeof(__u32))
539 + dscpstatemask = rta_getattr_u32(
540 + tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]);
541 + else
542 + print_string(PRINT_FP, NULL, "%s",
543 + "[invalid dscp statemask parameter]");
544 + }
545 +
546 + if (tb[TCA_CTINFO_PARMS_CPMARK_MASK]) {
547 + if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_CPMARK_MASK]) >=
548 + sizeof(__u32))
549 + cpmarkmask = rta_getattr_u32(
550 + tb[TCA_CTINFO_PARMS_CPMARK_MASK]);
551 + else
552 + print_string(PRINT_FP, NULL, "%s",
553 + "[invalid cpmark mask parameter]");
554 + }
555 +
556 + if (tb[TCA_CTINFO_ZONE] && RTA_PAYLOAD(tb[TCA_CTINFO_ZONE]) >=
557 + sizeof(__u16))
558 + zone = rta_getattr_u16(tb[TCA_CTINFO_ZONE]);
559 +
560 + print_string(PRINT_ANY, "kind", "%s ", "ctinfo");
561 + print_hu(PRINT_ANY, "zone", "zone %u", zone);
562 + print_action_control(f, " ", ci->action, "");
563 +
564 + print_string(PRINT_FP, NULL, "%s", _SL_);
565 + print_uint(PRINT_ANY, "index", "\t index %u", ci->index);
566 + print_int(PRINT_ANY, "ref", " ref %d", ci->refcnt);
567 + print_int(PRINT_ANY, "bind", " bind %d", ci->bindcnt);
568 +
569 + if (tb[TCA_CTINFO_PARMS_DSCP_MASK]) {
570 + print_0xhex(PRINT_ANY, "dscpmask", " dscp %#010llx", dscpmask);
571 + print_0xhex(PRINT_ANY, "dscpstatemask", " %#010llx",
572 + dscpstatemask);
573 + }
574 +
575 + if (tb[TCA_CTINFO_PARMS_CPMARK_MASK])
576 + print_0xhex(PRINT_ANY, "cpmark", " cpmark %#010llx",
577 + cpmarkmask);
578 +
579 + if (show_stats)
580 + print_ctinfo_stats(f, tb);
581 +
582 + print_string(PRINT_FP, NULL, "%s", _SL_);
583 +
584 + return 0;
585 +}
586 +
587 +struct action_util ctinfo_action_util = {
588 + .id = "ctinfo",
589 + .parse_aopt = parse_ctinfo,
590 + .print_aopt = print_ctinfo,
591 +};
592 --
593 2.20.1 (Apple Git-117)
594