naccyde / rpms / iproute

Forked from rpms/iproute 8 months ago
Clone

Blame SOURCES/0134-man-Add-a-man-page-for-the-simple-action.patch

049c96
From a97f29e69b11276cc18793cd696614c367ffc806 Mon Sep 17 00:00:00 2001
049c96
From: Phil Sutter <psutter@redhat.com>
049c96
Date: Wed, 30 Mar 2016 16:43:19 +0200
049c96
Subject: [PATCH] man: Add a man page for the simple action
049c96
049c96
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1275426
049c96
Upstream Status: iproute2.git commit ebf9933bb3d5c
049c96
049c96
commit ebf9933bb3d5c6a869edb7405f7a4759862409ab
049c96
Author: Phil Sutter <phil@nwl.cc>
049c96
Date:   Fri Mar 4 13:11:42 2016 +0100
049c96
049c96
    man: Add a man page for the simple action
049c96
049c96
    Signed-off-by: Phil Sutter <phil@nwl.cc>
049c96
---
049c96
 man/man8/tc-simple.8 | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
049c96
 1 file changed, 76 insertions(+)
049c96
 create mode 100644 man/man8/tc-simple.8
049c96
049c96
diff --git a/man/man8/tc-simple.8 b/man/man8/tc-simple.8
049c96
new file mode 100644
049c96
index 0000000..2206dc3
049c96
--- /dev/null
049c96
+++ b/man/man8/tc-simple.8
049c96
@@ -0,0 +1,76 @@
049c96
+.TH "Simple action in tc" 8 "12 Jan 2015" "iproute2" "Linux"
049c96
+
049c96
+.SH NAME
049c96
+simple - basic example action
049c96
+.SH SYNOPSIS
049c96
+.in +8
049c96
+.ti -8
049c96
+.BR tc " ... " "action simple"
049c96
+.I STRING
049c96
+.SH DESCRIPTION
049c96
+This is a pedagogical example rather than an actually useful action. Upon every access, it prints the given
049c96
+.I STRING
049c96
+which may be of arbitrary length.
049c96
+.SH OPTIONS
049c96
+.TP
049c96
+.I STRING
049c96
+The actual string to print.
049c96
+.SH EXAMPLES
049c96
+The following example makes the kernel yell "Incoming ICMP!" every time it sees
049c96
+an incoming ICMP on eth0. Steps are:
049c96
+.IP 1) 4
049c96
+Add an ingress qdisc point to eth0
049c96
+.IP 2) 4
049c96
+Start a chain on ingress of eth0 that first matches ICMP then invokes the
049c96
+simple action to shout.
049c96
+.IP 3) 4
049c96
+display stats and show that no packet has been seen by the action
049c96
+.IP 4) 4
049c96
+Send one ping packet to google (expect to receive a response back)
049c96
+.IP 5) 4
049c96
+grep the logs to see the logged message
049c96
+.IP 6) 4
049c96
+display stats again and observe increment by 1
049c96
+
049c96
+.RE
049c96
+.EX
049c96
+  hadi@noma1:$ tc qdisc add dev eth0 ingress
049c96
+  hadi@noma1:$tc filter add dev eth0 parent ffff: protocol ip prio 5 \\
049c96
+	 u32 match ip protocol 1 0xff flowid 1:1 action simple "Incoming ICMP"
049c96
+
049c96
+  hadi@noma1:$ sudo tc -s filter ls  dev eth0 parent ffff:
049c96
+   filter protocol ip pref 5 u32
049c96
+   filter protocol ip pref 5 u32 fh 800: ht divisor 1
049c96
+   filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
049c96
+     match 00010000/00ff0000 at 8
049c96
+	action order 1: Simple <Incoming ICMP>
049c96
+	 index 4 ref 1 bind 1 installed 29 sec used 29 sec
049c96
+	 Action statistics:
049c96
+		Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
049c96
+		backlog 0b 0p requeues 0
049c96
+
049c96
+
049c96
+  hadi@noma1$ ping -c 1 www.google.ca
049c96
+  PING www.google.ca (74.125.225.120) 56(84) bytes of data.
049c96
+  64 bytes from ord08s08-in-f24.1e100.net (74.125.225.120): icmp_req=1 ttl=53 time=31.3 ms
049c96
+
049c96
+  --- www.google.ca ping statistics ---
049c96
+  1 packets transmitted, 1 received, 0% packet loss, time 0ms
049c96
+  rtt min/avg/max/mdev = 31.316/31.316/31.316/0.000 ms
049c96
+
049c96
+  hadi@noma1$ dmesg | grep simple
049c96
+  [135354.473951] simple: Incoming ICMP_1
049c96
+
049c96
+  hadi@noma1$ sudo tc/tc -s filter ls  dev eth0 parent ffff:
049c96
+  filter protocol ip pref 5 u32
049c96
+  filter protocol ip pref 5 u32 fh 800: ht divisor 1
049c96
+  filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
049c96
+    match 00010000/00ff0000 at 8
049c96
+	action order 1: Simple <Incoming ICMP>
049c96
+	 index 4 ref 1 bind 1 installed 206 sec used 67 sec
049c96
+	Action statistics:
049c96
+	Sent 84 bytes 1 pkt (dropped 0, overlimits 0 requeues 0)
049c96
+	backlog 0b 0p requeues 0
049c96
+.EE
049c96
+.SH SEE ALSO
049c96
+.BR tc (8)
049c96
-- 
049c96
1.8.3.1
049c96