158 lines
6.2 KiB
HTML
158 lines
6.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Simple action in tc</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Simple action in tc</H1>
|
|
Section: Linux (8)<BR>Updated: 12 Jan 2015<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<P>
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
simple - basic example action
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
<BR>
|
|
|
|
<B>tc</B> ... <B>action simple</B>
|
|
|
|
[
|
|
<B>sdata</B><I> STRING</I>
|
|
|
|
] [
|
|
<B>index</B><I> INDEX</I>
|
|
|
|
] [
|
|
<I>CONTROL</I>
|
|
|
|
]
|
|
<P>
|
|
<BR>
|
|
|
|
<I>CONTROL</I> := {
|
|
|
|
<B>reclassify</B> | <B>pipe</B> | <B>drop</B> | <B>continue</B> | <B>ok</B> }
|
|
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
This is a pedagogical example rather than an actually useful action. Upon every access, it prints the given
|
|
<I>STRING</I>
|
|
|
|
which may be of arbitrary length.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>sdata</B><I> STRING</I>
|
|
|
|
<DD>
|
|
The actual string to print.
|
|
<DT id="2"><B>index</B><I> INDEX</I>
|
|
|
|
<DD>
|
|
Optional action index value.
|
|
<DT id="3"><I>CONTROL</I>
|
|
|
|
<DD>
|
|
Indicate how
|
|
<B>tc</B>
|
|
|
|
should proceed after executing the action. For a description of the possible
|
|
<I>CONTROL</I>
|
|
|
|
values, see
|
|
<B><A HREF="/cgi-bin/man/man2html?8+tc-actions">tc-actions</A></B>(8).
|
|
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
The following example makes the kernel yell "Incoming ICMP!" every time it sees
|
|
an incoming ICMP on eth0. Steps are:
|
|
<DL COMPACT>
|
|
<DT id="4">1)<DD>
|
|
Add an ingress qdisc point to eth0
|
|
<DT id="5">2)<DD>
|
|
Start a chain on ingress of eth0 that first matches ICMP then invokes the
|
|
simple action to shout.
|
|
<DT id="6">3)<DD>
|
|
display stats and show that no packet has been seen by the action
|
|
<DT id="7">4)<DD>
|
|
Send one ping packet to google (expect to receive a response back)
|
|
<DT id="8">5)<DD>
|
|
grep the logs to see the logged message
|
|
<DT id="9">6)<DD>
|
|
display stats again and observe increment by 1
|
|
<P>
|
|
|
|
<BR> <A HREF="mailto:hadi@noma1">hadi@noma1</A>:$ tc qdisc add dev eth0 ingress
|
|
<BR> <A HREF="mailto:hadi@noma1">hadi@noma1</A>:$tc filter add dev eth0 parent ffff: protocol ip prio 5 \
|
|
<TT> </TT> u32 match ip protocol 1 0xff flowid 1:1 action simple sdata "Incoming ICMP"<BR>
|
|
<P>
|
|
<BR> <A HREF="mailto:hadi@noma1">hadi@noma1</A>:$ sudo tc -s filter ls dev eth0 parent ffff:
|
|
<BR> filter protocol ip pref 5 u32
|
|
<BR> filter protocol ip pref 5 u32 fh 800: ht divisor 1
|
|
<BR> filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
|
|
<BR> match 00010000/00ff0000 at 8
|
|
<TT> </TT>action order 1: Simple <Incoming ICMP><BR>
|
|
<TT> </TT> index 4 ref 1 bind 1 installed 29 sec used 29 sec<BR>
|
|
<TT> </TT> Action statistics:<BR>
|
|
<TT> </TT><TT> </TT>Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)<BR>
|
|
<TT> </TT><TT> </TT>backlog 0b 0p requeues 0<BR>
|
|
<P>
|
|
<P>
|
|
<BR> <A HREF="mailto:hadi@noma1">hadi@noma1</A>$ ping -c 1 <A HREF="http://www.google.ca">www.google.ca</A>
|
|
<BR> PING <A HREF="http://www.google.ca">www.google.ca</A> (74.125.225.120) 56(84) bytes of data.
|
|
<BR> 64 bytes from ord08s08-in-f24.1e100.net (74.125.225.120): icmp_req=1 ttl=53 time=31.3 ms
|
|
<P>
|
|
<BR> --- <A HREF="http://www.google.ca">www.google.ca</A> ping statistics ---
|
|
<BR> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
|
|
<BR> rtt min/avg/max/mdev = 31.316/31.316/31.316/0.000 ms
|
|
<P>
|
|
<BR> <A HREF="mailto:hadi@noma1">hadi@noma1</A>$ dmesg | grep simple
|
|
<BR> [135354.473951] simple: Incoming ICMP_1
|
|
<P>
|
|
<BR> <A HREF="mailto:hadi@noma1">hadi@noma1</A>$ sudo tc/tc -s filter ls dev eth0 parent ffff:
|
|
<BR> filter protocol ip pref 5 u32
|
|
<BR> filter protocol ip pref 5 u32 fh 800: ht divisor 1
|
|
<BR> filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
|
|
<BR> match 00010000/00ff0000 at 8
|
|
<TT> </TT>action order 1: Simple <Incoming ICMP><BR>
|
|
<TT> </TT> index 4 ref 1 bind 1 installed 206 sec used 67 sec<BR>
|
|
<TT> </TT>Action statistics:<BR>
|
|
<TT> </TT>Sent 84 bytes 1 pkt (dropped 0, overlimits 0 requeues 0)<BR>
|
|
<TT> </TT>backlog 0b 0p requeues 0<BR>
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+tc">tc</A></B>(8)
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+tc-actions">tc-actions</A></B>(8)
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="10"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="11"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="12"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="13"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="14"><A HREF="#lbAF">EXAMPLES</A><DD>
|
|
<DT id="15"><A HREF="#lbAG">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:17 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|