naccyde / rpms / iproute

Forked from rpms/iproute a year ago
Clone

Blame SOURCES/0037-man-tc-ct.8-Add-manual-page-for-ct-tc-action.patch

d2d45d
From 7c371119412595ad2d063b91fdea616dcacb4eed Mon Sep 17 00:00:00 2001
d2d45d
From: Andrea Claudi <aclaudi@redhat.com>
d2d45d
Date: Tue, 9 Jun 2020 15:45:56 +0200
d2d45d
Subject: [PATCH] man: tc-ct.8: Add manual page for ct tc action
d2d45d
d2d45d
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1844637
d2d45d
Upstream Status: iproute2.git commit 924c43778a845
d2d45d
d2d45d
commit 924c43778a8453e2cd0fd1440b9224bed9c87c0d
d2d45d
Author: Paul Blakey <paulb@mellanox.com>
d2d45d
Date:   Thu May 14 17:10:20 2020 +0300
d2d45d
d2d45d
    man: tc-ct.8: Add manual page for ct tc action
d2d45d
d2d45d
    Signed-off-by: Paul Blakey <paulb@mellanox.com>
d2d45d
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
d2d45d
---
d2d45d
 man/man8/tc-ct.8     | 107 +++++++++++++++++++++++++++++++++++++++++++
d2d45d
 man/man8/tc-flower.8 |   6 +++
d2d45d
 2 files changed, 113 insertions(+)
d2d45d
 create mode 100644 man/man8/tc-ct.8
d2d45d
d2d45d
diff --git a/man/man8/tc-ct.8 b/man/man8/tc-ct.8
d2d45d
new file mode 100644
d2d45d
index 0000000000000..45d29320f1d01
d2d45d
--- /dev/null
d2d45d
+++ b/man/man8/tc-ct.8
d2d45d
@@ -0,0 +1,107 @@
d2d45d
+.TH "ct action in tc" 8 "14 May 2020" "iproute2" "Linux"
d2d45d
+.SH NAME
d2d45d
+ct \- tc connection tracking action
d2d45d
+.SH SYNOPSIS
d2d45d
+.in +8
d2d45d
+.ti -8
d2d45d
+.BR "tc ... action ct commit [ force ] [ zone "
d2d45d
+.IR ZONE
d2d45d
+.BR "] [ mark "
d2d45d
+.IR MASKED_MARK
d2d45d
+.BR "] [ label "
d2d45d
+.IR MASKED_LABEL
d2d45d
+.BR "] [ nat "
d2d45d
+.IR NAT_SPEC
d2d45d
+.BR "]"
d2d45d
+
d2d45d
+.ti -8
d2d45d
+.BR "tc ... action ct [ nat ] [ zone "
d2d45d
+.IR ZONE
d2d45d
+.BR "]"
d2d45d
+
d2d45d
+.ti -8
d2d45d
+.BR "tc ... action ct clear"
d2d45d
+
d2d45d
+.SH DESCRIPTION
d2d45d
+The ct action is a tc action for sending packets and interacting with the netfilter conntrack module.
d2d45d
+
d2d45d
+It can (as shown in the synopsis, in order):
d2d45d
+
d2d45d
+Send the packet to conntrack, and commit the connection, while configuring
d2d45d
+a 32bit mark, 128bit label, and src/dst nat.
d2d45d
+
d2d45d
+Send the packet to conntrack, which will mark the packet with the connection's state and
d2d45d
+configured metadata (mark/label), and execute previous configured nat.
d2d45d
+
d2d45d
+Clear the packet's of previous connection tracking state.
d2d45d
+
d2d45d
+.SH OPTIONS
d2d45d
+.TP
d2d45d
+.BI zone " ZONE"
d2d45d
+Specify a conntrack zone number on which to send the packet to conntrack.
d2d45d
+.TP
d2d45d
+.BI mark " MASKED_MARK"
d2d45d
+Specify a masked 32bit mark to set for the connection (only valid with commit).
d2d45d
+.TP
d2d45d
+.BI label " MASKED_LABEL"
d2d45d
+Specify a masked 128bit label to set for the connection (only valid with commit).
d2d45d
+.TP
d2d45d
+.BI nat " NAT_SPEC"
d2d45d
+.BI Where " NAT_SPEC " ":= {src|dst} addr" " addr1" "[-" "addr2" "] [port " "port1" "[-" "port2" "]]"
d2d45d
+
d2d45d
+Specify src/dst and range of nat to configure for the connection (only valid with commit).
d2d45d
+.RS
d2d45d
+.TP
d2d45d
+src/dst - configure src or dst nat
d2d45d
+.TP
d2d45d
+.BI  "" "addr1" "/" "addr2" " - IPv4/IPv6 addresses"
d2d45d
+.TP
d2d45d
+.BI  "" "port1" "/" "port2" " - Port numbers"
d2d45d
+.RE
d2d45d
+.TP
d2d45d
+.BI nat
d2d45d
+Restore any previous configured nat.
d2d45d
+.TP
d2d45d
+.BI clear
d2d45d
+Remove any conntrack state and metadata (mark/label) from the packet (must only option specified).
d2d45d
+.TP
d2d45d
+.BI force
d2d45d
+Forces conntrack direction for a previously commited connections, so that current direction will become the original direction (only valid with commit).
d2d45d
+
d2d45d
+.SH EXAMPLES
d2d45d
+Example showing natted firewall in conntrack zone 2, and conntrack mark usage:
d2d45d
+.EX
d2d45d
+
d2d45d
+#Add ingress qdisc on eth0 and eth1 interfaces
d2d45d
+.nf
d2d45d
+$ tc qdisc add dev eth0 handle ingress
d2d45d
+$ tc qdisc add dev eth1 handle ingress
d2d45d
+
d2d45d
+#Setup filters on eth0, allowing opening new connections in zone 2, and doing src nat + mark for each new connection
d2d45d
+$ tc filter add dev eth0 ingress prio 1 chain 0 proto ip flower ip_proto tcp ct_state -trk \\
d2d45d
+action ct zone 2 pipe action goto chain 2
d2d45d
+$ tc filter add dev eth0 ingress prio 1 chain 2 proto ip flower ct_state +trk+new \\
d2d45d
+action ct zone 2 commit mark 0xbb nat src addr 5.5.5.7 pipe action mirred egress redirect dev eth1
d2d45d
+$ tc filter add dev eth0 ingress prio 1 chain 2 proto ip flower ct_zone 2 ct_mark 0xbb ct_state +trk+est \\
d2d45d
+action ct nat pipe action mirred egress redirect dev eth1
d2d45d
+
d2d45d
+#Setup filters on eth1, allowing only established connections of zone 2 through, and reverse nat (dst nat in this case)
d2d45d
+$ tc filter add dev eth1 ingress prio 1 chain 0 proto ip flower ip_proto tcp ct_state -trk \\
d2d45d
+action ct zone 2 pipe action goto chain 1
d2d45d
+$ tc filter add dev eth1 ingress prio 1 chain 1 proto ip flower ct_zone 2 ct_mark 0xbb ct_state +trk+est \\
d2d45d
+action ct nat pipe action mirred egress redirect dev eth0
d2d45d
+.fi
d2d45d
+
d2d45d
+.EE
d2d45d
+
d2d45d
+.RE
d2d45d
+.SH SEE ALSO
d2d45d
+.BR tc (8),
d2d45d
+.BR tc-flower (8)
d2d45d
+.BR tc-mirred (8)
d2d45d
+.SH AUTHORS
d2d45d
+Paul Blakey <paulb@mellanox.com>
d2d45d
+
d2d45d
+Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
d2d45d
+
d2d45d
+Yossi Kuperman <yossiku@mellanox.com>
d2d45d
diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8
d2d45d
index 0f95f303f23b7..02a7256f36ebb 100644
d2d45d
--- a/man/man8/tc-flower.8
d2d45d
+++ b/man/man8/tc-flower.8
d2d45d
@@ -1,5 +1,11 @@
d2d45d
 .TH "Flower filter in tc" 8 "22 Oct 2015" "iproute2" "Linux"
d2d45d
 
d2d45d
+	"Usage: ct clear\n"
d2d45d
+		"	ct commit [force] [zone ZONE] [mark MASKED_MARK] [label MASKED_LABEL] [nat NAT_SPEC] [OFFLOAD_POLICY]\n"
d2d45d
+		"	ct [nat] [zone ZONE] [OFFLOAD_POLICY]\n"
d2d45d
+		"Where: ZONE is the conntrack zone table number\n"
d2d45d
+		"	NAT_SPEC is {src|dst} addr addr1[-addr2] [port port1[-port2]]\n"
d2d45d
+		"	OFFLOAD_POLICY is [policy_pkts PACKETS] [policy_timeout TIMEOUT]\n"
d2d45d
 .SH NAME
d2d45d
 flower \- flow based traffic control filter
d2d45d
 .SH SYNOPSIS
d2d45d
-- 
d2d45d
2.26.2
d2d45d