summaryrefslogtreecommitdiffstats
path: root/extensions/libebt_ip.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-05-08 10:15:11 +0200
committerFlorian Westphal <fw@strlen.de>2018-05-10 02:31:05 +0200
commit6454d7dc89f83920cd08606fdff43358c7e64a53 (patch)
tree33294b8d8675aaa706fb12842af294408360bbdf /extensions/libebt_ip.c
parent07f4ca96816886635acfb9478b2d04929938eb78 (diff)
ebtables-translate: suppress redundant protocols
kernel would reject ip, ip6 etc. without -p ip, -p ip6. So add it. On reverse, search the match list to decide if -p has to be translated or not. Also, icmp and icmpv6 also imply l3 protocol, so no need to translate that either. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'extensions/libebt_ip.c')
-rw-r--r--extensions/libebt_ip.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/extensions/libebt_ip.c b/extensions/libebt_ip.c
index 9b3cd33c..4b5c1665 100644
--- a/extensions/libebt_ip.c
+++ b/extensions/libebt_ip.c
@@ -686,9 +686,9 @@ static int brip_xlate(struct xt_xlate *xl,
if (info->bitmask & EBT_IP_PROTO) {
struct protoent *pe;
- if (info->bitmask & (EBT_IP_SPORT|EBT_IP_DPORT) &&
+ if (info->bitmask & (EBT_IP_SPORT|EBT_IP_DPORT|EBT_IP_ICMP) &&
(info->invflags & EBT_IP_PROTO) == 0) {
- /* port number given and not inverted, no need to print this */
+ /* port number or icmp given and not inverted, no need to print this */
pname = brip_xlate_proto_to_name(info->protocol);
} else {
xt_xlate_add(xl, "ip protocol ");