Skip to contentSkip to conversation

man: iptables-restore.8: document flush behaviour for user-defined chains

PATCH In review Florian Westphal 2 participants 2 messages Aug 25, 2025 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 man: iptables-restore.8: document flush behaviour for user-defined chains

There is no way we can change this after two decades. Add an example and document that declaring a user defined chain will flush its contents in --noflush mode.

---
 iptables/iptables-restore.8.in | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
iptables/iptables-restore.8.in +14 -0
index df61b2a623f6..abf8d6decc27 100644
@@ -48,6 +48,20 @@ Print a short option summary.
 \fB\-n\fR, \fB\-\-noflush\fR
 Don't flush the previous contents of the table. If not specified,
 both commands flush (delete) all previous contents of the respective table.
+Note that this option will flush user-defined chains if they are declared.
+Example:
+.P
+.in +4n
+.EX
+*filter
+:FILTERS - [0:0]
+-A FILTERS ...
+.EE
+
+will flush and re-build the FILTERS chain from scratch,
+while retaining the content of all other chains in the table.
+.in
+.P
 .TP
 \fB\-t\fP, \fB\-\-test\fP
 Only parse and construct the ruleset, but do not commit it.
Signature · 1 line
2.51.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Florian Westphal

There is no way we can change this after two decades. Add an example and document that declaring a user defined chain will flush its contents in --noflush mode.

Thanks.

Quoted 33 lines
---
 iptables/iptables-restore.8.in | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
iptables/iptables-restore.8.in +14 -0
index df61b2a623f6..abf8d6decc27 100644
@@ -48,6 +48,20 @@ Print a short option summary.
 \fB\-n\fR, \fB\-\-noflush\fR
 Don't flush the previous contents of the table. If not specified,
 both commands flush (delete) all previous contents of the respective table.
+Note that this option will flush user-defined chains if they are declared.
+Example:
+.P
+.in +4n
+.EX
+*filter
+:FILTERS - [0:0]
+-A FILTERS ...
+.EE
+
+will flush and re-build the FILTERS chain from scratch,
+while retaining the content of all other chains in the table.
+.in
+.P
 .TP
 \fB\-t\fP, \fB\-\-test\fP
 Only parse and construct the ruleset, but do not commit it.
Signature · 1 line
2.51.0