Skip to contentSkip to conversation

iptables manpage and ICMP type/code

PATCH Victor Stinner 2 participants 2 messages Jan 13, 2009 netfilter

lore
Share & tools
lore
#0 lore raw

iptables supports ICMP code filtering, but it's not documented in the manpage. Attached patch fixes the manpage, before:

--icmp-type [!] typename
This allows specification of the ICMP type, which can be a numeric ICMP type, or one of the ICMP type names shown by the command
iptables -p icmp -h

After:

--icmp-type [!] type[/code]|typename
This allows specification of the ICMP type, which can be a numeric ICMP type, type and code, or one of the ICMP type names shown by the command
iptables -p icmp -h

It changes also the text style: keywords are underlined.

Note: iptables builtin help was already correct:
---------------------

$ iptables -p icmp -h
(...)
icmp match options:
[!] --icmp-type typename        match icmp type
                                (or numeric type or type/code)
(...)
---------------------
Signature · 2 lines
Victor Stinner
http://www.inl.fr/
extensions/libipt_icmp.man +7 -2
index 8c1bdbe..0798d7c 100644
@@ -1,9 +1,14 @@
 This extension can be used if `\-\-protocol icmp' is specified. It
 provides the following option:
 .TP
-[\fB!\fP] \fB\-\-icmp\-type\fP \fItypename\fP
+\fB\-\-icmp\-type\fP [\fB!\fP] \fItype\fP[\fB/\fP\fIcode\fP]|\fItypename\fP
 This allows specification of the ICMP type, which can be a numeric
-ICMP type, or one of the ICMP type names shown by the command
+ICMP
+.IR type ,
+.IR type
+and
+.IR code ,
+or one of the ICMP type names shown by the command
 .nf
  iptables \-p icmp \-h
 .fi
#1 lore raw
Quoted 9 lines · Victor Stinner

iptables supports ICMP code filtering, but it's not documented in the manpage. Attached patch fixes the manpage, [...]:

(quoted diff) +1 -1
-       --icmp-type [!] typename
+       --icmp-type [!] type[/code]|typename
             This allows specification of the ICMP type, which can be a
             the command
              iptables -p icmp -h

It changes also the text style: keywords are underlined.

Actually \fI is italic (it's "I" for a reason); it's just that, now that you mention it, there seems to be a glitch in man that causes it to be displayed as underline.

Quoted 2 lines

-[\fB!\fP] \fB\-\-icmp\-type\fP \fItypename\fP +\fB\-\-icmp\-type\fP [\fB!\fP] \fItype\fP[\fB/\fP\fIcode\fP]|\fItypename\fP

This is old syntax.

Review

Quoted 7 lines

This allows specification of the ICMP type, which can be a numeric

(quoted diff) +5 -1
-ICMP type, or one of the ICMP type names shown by the command
+ICMP
+.IR type ,
+.IR type
+and
+.IR code ,

'type' did not refer to the placeholder, but the type in general, hence it was not italic to begin with. I think this should not change, either.

parent 3e95daeb83446a61afa86914c9f1a03fa257537d (v1.4.3-rc1-19-g3e95dae) commit aa171d33c6d86940a057db2bd037f2f0106f1221

Author: Jan Engelhardt <[email protected]>
Date:   Tue Jan 13 15:30:10 2009 +0100

doc: augment ICMP manpage by type/code syntax

The ICMP match module also allows numeric type/code as in "--icmp-type type/code". Document it.

Based upon a patch by Victor Stinner <[email protected]>.

---
 extensions/libipt_icmp.c   |    2 +-
 extensions/libipt_icmp.man |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
extensions/libipt_icmp.c +1 -1
index d0b7bb3..fa5a540 100644
@@ -102,7 +102,7 @@ static void icmp_help(void)
 	printf(
 "icmp match options:\n"
 "[!] --icmp-type typename	match icmp type\n"
-"				(or numeric type or type/code)\n");
+"[!] --icmp-type type[/code]	(or numeric type or type/code)\n");
 	print_icmptypes();
 }
 
extensions/libipt_icmp.man +2 -2
index 8c1bdbe..1039704 100644
@@ -1,9 +1,9 @@
 This extension can be used if `\-\-protocol icmp' is specified. It
 provides the following option:
 .TP
-[\fB!\fP] \fB\-\-icmp\-type\fP \fItypename\fP
+[\fB!\fP] \fB\-\-icmp\-type\fP {\fItype\fP[\fB/\fP\fIcode\fP]|\fItypename\fP}
 This allows specification of the ICMP type, which can be a numeric
-ICMP type, or one of the ICMP type names shown by the command
+ICMP type, type/code pair, or one of the ICMP type names shown by the command
 .nf
  iptables \-p icmp \-h
 .fi
Signature · 1 line
# Created with git-export-patch