From: Stephen Hemminger Date: Fri, 9 May 2008 22:42:34 +0000 (-0700) Subject: Change formatting of u32 back to default X-Git-Tag: v2.6.26~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44dcfe820185;p=thirdparty%2Fiproute2.git Change formatting of u32 back to default Don't break scripts that depend on previous offset/value format. Introduce a new -pretty flag for decoding, and (*gasp*) document the formatting arguments. --- diff --git a/man/man8/tc.8 b/man/man8/tc.8 index 53a866f5a..8c0880fa5 100644 --- a/man/man8/tc.8 +++ b/man/man8/tc.8 @@ -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 diff --git a/tc/f_u32.c b/tc/f_u32.c index 7e4d56cab..aba767d06 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -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 6126c712f..aabeac857 100644 --- 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;