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_vlan.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'extensions/libebt_vlan.c') diff --git a/extensions/libebt_vlan.c b/extensions/libebt_vlan.c index be269c6c..fa697921 100644 --- a/extensions/libebt_vlan.c +++ b/extensions/libebt_vlan.c @@ -109,19 +109,14 @@ static void brvlan_print(const void *ip, const struct xt_entry_match *match, struct ebt_vlan_info *vlaninfo = (struct ebt_vlan_info *) match->data; if (vlaninfo->bitmask & EBT_VLAN_ID) { - if (vlaninfo->invflags & EBT_VLAN_ID) - printf("! "); - printf("--vlan-id %d ", vlaninfo->id); + printf("--vlan-id %s%d ", (vlaninfo->invflags & EBT_VLAN_ID) ? "! " : "", vlaninfo->id); } if (vlaninfo->bitmask & EBT_VLAN_PRIO) { - if (vlaninfo->invflags & EBT_VLAN_PRIO) - printf("! "); - printf("--vlan-prio %d ", vlaninfo->prio); + printf("--vlan-prio %s%d ", (vlaninfo->invflags & EBT_VLAN_PRIO) ? "! " : "", vlaninfo->prio); } if (vlaninfo->bitmask & EBT_VLAN_ENCAP) { - if (vlaninfo->invflags & EBT_VLAN_ENCAP) - printf("! "); - printf("--vlan-encap %4.4X ", ntohs(vlaninfo->encap)); + printf("--vlan-encap %s", (vlaninfo->invflags & EBT_VLAN_ENCAP) ? "! " : ""); + printf("%4.4X ", ntohs(vlaninfo->encap)); } } -- cgit v1.2.3