From 35b22e82fa62e10950d8e0fa53a755d4abadf346 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 5 Feb 2019 18:18:02 +0100 Subject: Revert "ebtables: use extrapositioned negation consistently" This reverts commit 5f508b76a0cebaf91965ffa678089222e2d47964. While attempts at unifying syntax between arp-, eb- and iptables-nft increase the opportunity for more code-sharing, they are problematic when it comes to compatibility. Accepting the old syntax on input helps, but due to the fact that neither arptables nor ebtables support --check command we must expect for users to test existence of a rule by comparing input with output. If that happens in a script, deviating from the old syntax in output has a high chance of breaking it. Therefore revert Florian's patch changing inversion character position in output and review the old code for consistency - the only thing changed on top of the actual revert is ebtables' own copy of print_iface() to make it adhere to the intrapositioned negation scheme used throughout ebtables. Added extension tests by the reverted commit have been kept. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- extensions/libebt_ip.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'extensions/libebt_ip.c') diff --git a/extensions/libebt_ip.c b/extensions/libebt_ip.c index d48704fe..acb9bfcd 100644 --- a/extensions/libebt_ip.c +++ b/extensions/libebt_ip.c @@ -472,35 +472,35 @@ static void brip_print(const void *ip, const struct xt_entry_match *match, struct in_addr *addrp, *maskp; if (info->bitmask & EBT_IP_SOURCE) { + printf("--ip-src "); if (info->invflags & EBT_IP_SOURCE) printf("! "); - printf("--ip-src "); addrp = (struct in_addr *)&info->saddr; maskp = (struct in_addr *)&info->smsk; printf("%s%s ", xtables_ipaddr_to_numeric(addrp), xtables_ipmask_to_numeric(maskp)); } if (info->bitmask & EBT_IP_DEST) { + printf("--ip-dst "); if (info->invflags & EBT_IP_DEST) printf("! "); - printf("--ip-dst "); addrp = (struct in_addr *)&info->daddr; maskp = (struct in_addr *)&info->dmsk; printf("%s%s ", xtables_ipaddr_to_numeric(addrp), xtables_ipmask_to_numeric(maskp)); } if (info->bitmask & EBT_IP_TOS) { + printf("--ip-tos "); if (info->invflags & EBT_IP_TOS) printf("! "); - printf("--ip-tos "); printf("0x%02X ", info->tos); } if (info->bitmask & EBT_IP_PROTO) { struct protoent *pe; + printf("--ip-proto "); if (info->invflags & EBT_IP_PROTO) printf("! "); - printf("--ip-proto "); pe = getprotobynumber(info->protocol); if (pe == NULL) { printf("%d ", info->protocol); @@ -509,28 +509,28 @@ static void brip_print(const void *ip, const struct xt_entry_match *match, } } if (info->bitmask & EBT_IP_SPORT) { + printf("--ip-sport "); if (info->invflags & EBT_IP_SPORT) printf("! "); - printf("--ip-sport "); print_port_range(info->sport); } if (info->bitmask & EBT_IP_DPORT) { + printf("--ip-dport "); if (info->invflags & EBT_IP_DPORT) printf("! "); - printf("--ip-dport "); print_port_range(info->dport); } if (info->bitmask & EBT_IP_ICMP) { + printf("--ip-icmp-type "); if (info->invflags & EBT_IP_ICMP) printf("! "); - printf("--ip-icmp-type "); ebt_print_icmp_type(icmp_codes, ARRAY_SIZE(icmp_codes), info->icmp_type, info->icmp_code); } if (info->bitmask & EBT_IP_IGMP) { + printf("--ip-igmp-type "); if (info->invflags & EBT_IP_IGMP) printf("! "); - printf("--ip-igmp-type "); ebt_print_icmp_type(igmp_types, ARRAY_SIZE(igmp_types), info->igmp_type, NULL); } -- cgit v1.2.3