]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
Change formatting of u32 back to default
authorStephen Hemminger <stephen.hemminger@vyatta.com>
Fri, 9 May 2008 22:42:34 +0000 (15:42 -0700)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Fri, 9 May 2008 22:42:34 +0000 (15:42 -0700)
Don't break scripts that depend on previous offset/value format.
Introduce a new -pretty flag for decoding, and (*gasp*) document
the formatting arguments.

man/man8/tc.8
tc/f_u32.c
tc/tc.c

index 53a866f5acea8c9e3c5f6d70a93645e40dd7b10d..8c0880fa5cd16d0a54645172d044db4beb5dcbf1 100644 (file)
@@ -34,16 +34,28 @@ priority filtertype
 .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 
@@ -326,6 +338,29 @@ link
 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
index 7e4d56cabb32973793fdf8fae71f8d81382297c8..aba767d062078480ac83887c7140e624d41790df 100644 (file)
@@ -25,6 +25,8 @@
 #include "utils.h"
 #include "tc_util.h"
 
+extern int show_pretty;
+
 static void explain(void)
 {
        fprintf(stderr, "Usage: ... u32 [ match SELECTOR ... ] [ link HTID ]"
@@ -793,7 +795,7 @@ static void show_key(FILE *f, const struct tc_u32_key *key)
 {
        char abuf[256];
 
-       if (show_raw)
+       if (!show_pretty)
                goto raw;
 
        switch (key->off) {
diff --git a/tc/tc.c b/tc/tc.c
index 6126c712f13bdbaf7c49c723e3b5386e9bc779d8..aabeac857db3d6508e35d6ed43bd5eb1c5213d26 100644 (file)
--- a/tc/tc.c
+++ b/tc/tc.c
@@ -33,6 +33,8 @@
 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;
@@ -182,7 +184,7 @@ static void usage(void)
        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)
@@ -273,6 +275,8 @@ int main(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;