Blame SOURCES/0022-doc-Add-minimal-description-of-v-map-statements.patch

8acaf9
From 3344672e56bad6468981d1bf683c312b18957671 Mon Sep 17 00:00:00 2001
8acaf9
From: Phil Sutter <psutter@redhat.com>
8acaf9
Date: Thu, 4 Apr 2019 13:02:55 +0200
8acaf9
Subject: [PATCH] doc: Add minimal description of (v)map statements
8acaf9
8acaf9
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1628974
8acaf9
Upstream Status: nftables commit 3b29acc8f2994
8acaf9
Conflicts: Changes applied manually to doc/nft.xml, upstream switched to
8acaf9
           using asciidoc.
8acaf9
8acaf9
commit 3b29acc8f29944c5cf34259f2e2b5b40b4d0ccdd
8acaf9
Author: Phil Sutter <phil@nwl.cc>
8acaf9
Date:   Tue Apr 2 15:36:42 2019 +0200
8acaf9
8acaf9
    doc: Add minimal description of (v)map statements
8acaf9
8acaf9
    Although quite useful, these were missing in man page. Content loosely
8acaf9
    based on wiki documentation.
8acaf9
8acaf9
    Signed-off-by: Phil Sutter <phil@nwl.cc>
8acaf9
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
8acaf9
---
8acaf9
 doc/nft.xml | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8acaf9
 1 file changed, 65 insertions(+)
8acaf9
8acaf9
diff --git a/doc/nft.xml b/doc/nft.xml
8acaf9
index 12b6cea..5ab363f 100644
8acaf9
--- a/doc/nft.xml
8acaf9
+++ b/doc/nft.xml
8acaf9
@@ -5012,6 +5012,71 @@ add rule nat prerouting tcp dport 22 redirect to :2222
8acaf9
 				
8acaf9
 			</para>
8acaf9
 		</refsect2>
8acaf9
+		<refsect2>
8acaf9
+			<title>Map statement</title>
8acaf9
+			<para>
8acaf9
+				The map statement is used to lookup data based on some specific input key.
8acaf9
+			</para>
8acaf9
+			<para>
8acaf9
+				<cmdsynopsis>
8acaf9
+					<replaceable>expression</replaceable>
8acaf9
+					<command>map {</command>
8acaf9
+					<replaceable>key</replaceable>
8acaf9
+					<command>:</command>
8acaf9
+					<replaceable>value</replaceable>
8acaf9
+					<arg choice="opt" rep="repeat">
8acaf9
+						<command>,</command>
8acaf9
+						<replaceable>key</replaceable>
8acaf9
+						<command>:</command>
8acaf9
+						<replaceable>value</replaceable>
8acaf9
+					</arg>
8acaf9
+					<command>}</command>
8acaf9
+				</cmdsynopsis>
8acaf9
+			</para>
8acaf9
+			<example>
8acaf9
+				<title>using the map statement</title>
8acaf9
+				<programlisting>
8acaf9
+# select DNAT target based on TCP dport:
8acaf9
+# connections to port 80 are redirected to 192.168.1.100,
8acaf9
+# connections to port 8888 are redirected to 192.168.1.101
8acaf9
+nft add rule ip nat prerouting dnat tcp dport map { 80 : 192.168.1.100, 8888 : 192.168.1.101 }
8acaf9
+
8acaf9
+# source address based SNAT:
8acaf9
+# packets from net 192.168.1.0/24 will appear as originating from 10.0.0.1,
8acaf9
+# packets from net 192.168.2.0/24 will appear as originating from 10.0.0.2
8acaf9
+nft add rule ip nat postrouting snat to ip saddr map { 192.168.1.0/24 : 10.0.0.1, 192.168.2.0/24 : 10.0.0.2 }
8acaf9
+				</programlisting>
8acaf9
+			</example>
8acaf9
+		</refsect2>
8acaf9
+		<refsect2>
8acaf9
+			<title>Vmap statement</title>
8acaf9
+			<para>
8acaf9
+				The verdict map (vmap) statement works analogous to the map statement, but contains verdicts as values.
8acaf9
+			</para>
8acaf9
+			<para>
8acaf9
+				<cmdsynopsis>
8acaf9
+					<replaceable>expression</replaceable>
8acaf9
+					<command>vmap {</command>
8acaf9
+					<replaceable>key</replaceable>
8acaf9
+					<command>:</command>
8acaf9
+					<replaceable>value</replaceable>
8acaf9
+					<arg choice="opt" rep="repeat">
8acaf9
+						<command>,</command>
8acaf9
+						<replaceable>key</replaceable>
8acaf9
+						<command>:</command>
8acaf9
+						<replaceable>value</replaceable>
8acaf9
+					</arg>
8acaf9
+					<command>}</command>
8acaf9
+				</cmdsynopsis>
8acaf9
+			</para>
8acaf9
+			<example>
8acaf9
+				<title>using the vmap statement</title>
8acaf9
+				<programlisting>
8acaf9
+# jump to different chains depending on layer 4 protocol type:
8acaf9
+nft add rule ip filter input ip protocol vmap { tcp : jump tcp-chain, udp : jump udp-chain , icmp : jump icmp-chain }
8acaf9
+				</programlisting>
8acaf9
+			</example>
8acaf9
+		</refsect2>
8acaf9
 	</refsect1>
8acaf9
 
8acaf9
 	<refsect1>
8acaf9
-- 
8acaf9
1.8.3.1
8acaf9