From 6454d7dc89f83920cd08606fdff43358c7e64a53 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Tue, 8 May 2018 10:15:11 +0200 Subject: 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 --- extensions/libebt_ip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'extensions/libebt_ip.c') 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 "); -- cgit v1.2.3