tc-simple: Fix documentation

- CONTROL has to come last, otherwise 'index' applies to gact and not
  simple itself.
- Man page wasn't updated to reflect syntax changes.

Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
Phil Sutter 2017-08-03 17:00:51 +02:00 committed by Stephen Hemminger
parent 34705c807a
commit e2a055dd23
2 changed files with 28 additions and 5 deletions

View File

@ -6,15 +6,37 @@ simple - basic example action
.in +8 .in +8
.ti -8 .ti -8
.BR tc " ... " "action simple" .BR tc " ... " "action simple"
.I STRING [
.BI sdata " STRING"
] [
.BI index " INDEX"
] [
.I CONTROL
]
.ti -8
.IR CONTROL " := {"
.BR reclassify " | " pipe " | " drop " | " continue " | " ok " }"
.SH DESCRIPTION .SH DESCRIPTION
This is a pedagogical example rather than an actually useful action. Upon every access, it prints the given This is a pedagogical example rather than an actually useful action. Upon every access, it prints the given
.I STRING .I STRING
which may be of arbitrary length. which may be of arbitrary length.
.SH OPTIONS .SH OPTIONS
.TP .TP
.I STRING .BI sdata " STRING"
The actual string to print. The actual string to print.
.TP
.BI index " INDEX"
Optional action index value.
.TP
.I CONTROL
Indicate how
.B tc
should proceed after executing the action. For a description of the possible
.I CONTROL
values, see
.BR tc-actions (8).
.SH EXAMPLES .SH EXAMPLES
The following example makes the kernel yell "Incoming ICMP!" every time it sees The following example makes the kernel yell "Incoming ICMP!" every time it sees
an incoming ICMP on eth0. Steps are: an incoming ICMP on eth0. Steps are:
@ -36,7 +58,7 @@ display stats again and observe increment by 1
.EX .EX
hadi@noma1:$ tc qdisc add dev eth0 ingress hadi@noma1:$ tc qdisc add dev eth0 ingress
hadi@noma1:$tc filter add dev eth0 parent ffff: protocol ip prio 5 \\ hadi@noma1:$tc filter add dev eth0 parent ffff: protocol ip prio 5 \\
u32 match ip protocol 1 0xff flowid 1:1 action simple "Incoming ICMP" u32 match ip protocol 1 0xff flowid 1:1 action simple sdata "Incoming ICMP"
hadi@noma1:$ sudo tc -s filter ls dev eth0 parent ffff: hadi@noma1:$ sudo tc -s filter ls dev eth0 parent ffff:
filter protocol ip pref 5 u32 filter protocol ip pref 5 u32
@ -74,3 +96,4 @@ display stats again and observe increment by 1
.EE .EE
.SH SEE ALSO .SH SEE ALSO
.BR tc (8) .BR tc (8)
.BR tc-actions (8)

View File

@ -81,10 +81,10 @@
#endif #endif
static void explain(void) static void explain(void)
{ {
fprintf(stderr, "Usage:... simple [sdata STRING] [CONTROL] [index INDEX]\n"); fprintf(stderr, "Usage:... simple [sdata STRING] [index INDEX] [CONTROL]\n");
fprintf(stderr, "\tSTRING being an arbitrary string\n" fprintf(stderr, "\tSTRING being an arbitrary string\n"
"\tCONTROL := reclassify|pipe|drop|continue|ok\n"
"\tINDEX := optional index value used\n"); "\tINDEX := optional index value used\n");
"\tCONTROL := reclassify|pipe|drop|continue|ok\n"
} }
static void usage(void) static void usage(void)