Skip to contentSkip to conversation

Minor documentation improvements

PATCH Applied Simon Ruderich 2 participants 5 messages Mar 7, 2021 – Mar 9, 2021 netfilter

lore
Share & tools
lore
#0 lore raw

cover Minor documentation improvements

Hello,

while reading the nft man page I noticed a few minor things which should be improved by the following patches.

Regards
Simon

Simon Ruderich (3):
doc: add * to include example to actually include files
doc: remove duplicate tables in synproxy example
doc: move drop rule on a separate line in the blackhole example

 doc/nft.txt        |  2 +-
 doc/statements.txt | 20 +++-----------------
 2 files changed, 4 insertions(+), 18 deletions(-)
Signature · 1 line
2.30.1
#1 lore raw

PATCH 1/3 doc: add * to include example to actually include files

"/etc/firewall/rules/" causes no error but also doesn't include any files contained in the directory.

---
 doc/nft.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/nft.txt +1 -1
index 32261e26..e4f32179 100644
@@ -153,7 +153,7 @@ directory via the *-h*/*--help* option. +
 Include statements support the usual shell wildcard symbols (*,?,[]). Having no
 matches for an include statement is not an error, if wildcard symbols are used
 in the include statement. This allows having potentially empty include
-directories for statements like **include "/etc/firewall/rules/"**. The wildcard
+directories for statements like **include "/etc/firewall/rules/*"**. The wildcard
 matches are loaded in alphabetical order. Files beginning with dot (.) are not
 matched by include statements.
 
Signature · 1 line
2.30.1
#2 lore raw

PATCH 2/3 doc: remove duplicate tables in synproxy example

In reply to Simon Ruderich

The "outcome ruleset" is the same as the two tables in the example. Don't duplicate this information which just wastes space in the documentation and can confuse the reader (it took me a while to realize the tables are the same).

In addition, use the same table name for both tables to make it clear that they can be the same. They will be merged in the resulting ruleset.

---
 doc/statements.txt | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
doc/statements.txt +1 -16
index aac7c7d6..7bb538a9 100644
@@ -567,28 +567,13 @@ drop incorrect cookies. Flags combinations not expected during  3WHS will not
 match and continue (e.g. SYN+FIN, SYN+ACK). Finally, drop invalid packets, this
 will be out-of-flow packets that were not matched by SYNPROXY.
 
-    table ip foo {
+    table ip x {
             chain z {
                     type filter hook input priority filter; policy accept;
                     ct state { invalid, untracked } synproxy mss 1460 wscale 9 timestamp sack-perm
                     ct state invalid drop
             }
     }
-
-The outcome ruleset of the steps above should be similar to the one below.
-
-	table ip x {
-		chain y {
-			type filter hook prerouting priority raw; policy accept;
-	                tcp flags syn notrack
-		}
-
-		chain z {
-			type filter hook input priority filter; policy accept;
-	                ct state { invalid, untracked } synproxy mss 1460 wscale 9 timestamp sack-perm
-		        ct state invalid drop
-	        }
-	}
 ---------------------------------------
 
 FLOW STATEMENT
Signature · 1 line
2.30.1
#3 lore raw

PATCH 3/3 doc: move drop rule on a separate line in blackhole example

In reply to Simon Ruderich

At first I overlooked the "drop". Putting it on a separate line makes it more visible and also details the separate steps of this rule.

---
 doc/statements.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
doc/statements.txt +2 -1
index 7bb538a9..0973e5ef 100644
@@ -712,7 +712,8 @@ nft add rule ip filter input ip saddr @blackhole counter drop
 # requests occurred per second and ip address.
 nft add rule ip filter input tcp flags syn tcp dport ssh \
     add @flood { ip saddr limit rate over 10/second } \
-    add @blackhole { ip saddr } drop
+    add @blackhole { ip saddr } \
+    drop
 
 # inspect state of the sets.
 nft list set ip filter flood
Signature · 1 line
2.30.1
maintainer Applied
#4 lore raw
In reply to Simon Ruderich
Quoted 4 lines · Simon Ruderich

Hello,

while reading the nft man page I noticed a few minor things which should be improved by the following patches.

Applied, thanks.