Don't break scripts that depend on previous offset/value format.
Introduce a new -pretty flag for decoding, and (*gasp*) document
the formatting arguments.
.B flowid
flow-id
-.B tc [-s | -d ] qdisc show [ dev
+.B tc
+.RI "[ " FORMAT " ]"
+.B qdisc show [ dev
DEV
.B ]
.P
-.B tc [-s | -d ] class show dev
+.B tc
+.RI "[ " FORMAT " ]"
+.B class show dev
DEV
.P
.B tc filter show dev
DEV
+.ti -8
+.IR FORMAT " := {"
+\fB\-s\fR[\fItatistics\fR] |
+\fB\-d\fR[\fIetails\fR] |
+\fB\-r\fR[\fIaw\fR] |
+\fB\-p\fR[\fIretty\fR] |
+\fB\i\fR[\fIec\fR] }
+
.SH DESCRIPTION
.B Tc
is used to configure Traffic Control in the Linux kernel. Traffic Control consists
Only available for qdiscs and performs a replace where the node
must exist already.
+.SH FORMAT
+The show command has additional formatting options:
+
+.TP
+.BR "\-s" , " \-stats", " \-statistics"
+output more statistics about packet usage.
+
+.TP
+.BR "\-d", " \-details"
+output more detailed information about rates and cell sizes.
+
+.TP
+.BR "\-r", " \-raw"
+output raw hex values for handles.
+
+.TP
+.BR "\-p", " \-pretty"
+decode filter offset and mask values to equivalent filter commands based on TCP/IP.
+
+.TP
+.BR "\-iec"
+print rates in IEC units (ie. 1K = 1024).
+
.SH HISTORY
.B tc
#include "utils.h"
#include "tc_util.h"
+extern int show_pretty;
+
static void explain(void)
{
fprintf(stderr, "Usage: ... u32 [ match SELECTOR ... ] [ link HTID ]"
{
char abuf[256];
- if (show_raw)
+ if (!show_pretty)
goto raw;
switch (key->off) {
int show_stats = 0;
int show_details = 0;
int show_raw = 0;
+int show_pretty = 0;
+
int resolve_hosts = 0;
int use_iec = 0;
int force = 0;
fprintf(stderr, "Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }\n"
" tc [-force] -batch file\n"
"where OBJECT := { qdisc | class | filter | action | monitor }\n"
- " OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -b[atch] [file] }\n");
+ " OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] | -b[atch] [file] }\n");
}
static int do_cmd(int argc, char **argv)
++show_details;
} else if (matches(argv[1], "-raw") == 0) {
++show_raw;
+ } else if (matches(argv[1], "-pretty") == 0) {
+ ++show_pretty;
} else if (matches(argv[1], "-Version") == 0) {
printf("tc utility, iproute2-ss%s\n", SNAPSHOT);
return 0;