diff options
author | Phil Sutter <phil@nwl.cc> | 2020-10-06 19:07:19 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2020-10-06 21:50:51 +0200 |
commit | ad4b17b98bbedf93d2182a4dc9a37e9cf3adfe1b (patch) | |
tree | 0e4fa74a5964fb7e52f1853c9ef9bfebbc8fcb0e /extensions/libipt_icmp.txlate | |
parent | 72ed608bf1ea550ac13b5b880afc7ad3ffa0afd0 (diff) |
extensions: libipt_icmp: Fix translation of type 'any'
By itself, '-m icmp --icmp-type any' is a noop, it matches any icmp
types. Yet nft_ipv4_xlate() does not emit an 'ip protocol' match if
there's an extension with same name present in the rule. Luckily, legacy
iptables demands icmp match to be prepended by '-p icmp', so we can
assume this is present and just emit the 'ip protocol' match from icmp
xlate callback.
Fixes: aa158ca0fda65 ("extensions: libipt_icmp: Add translation to nft")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'extensions/libipt_icmp.txlate')
-rw-r--r-- | extensions/libipt_icmp.txlate | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extensions/libipt_icmp.txlate b/extensions/libipt_icmp.txlate index 434f8cc4..a2aec8e2 100644 --- a/extensions/libipt_icmp.txlate +++ b/extensions/libipt_icmp.txlate @@ -6,3 +6,6 @@ nft add rule ip filter INPUT icmp type destination-unreachable counter accept iptables-translate -t filter -A INPUT -m icmp ! --icmp-type 3 -j ACCEPT nft add rule ip filter INPUT icmp type != destination-unreachable counter accept + +iptables-translate -t filter -A INPUT -m icmp --icmp-type any -j ACCEPT +nft add rule ip filter INPUT ip protocol icmp counter accept |