|
|
8cce6c |
From 71eb9a84f50211f78cf2b7b5ef34f99944a76c02 Mon Sep 17 00:00:00 2001
|
|
|
8cce6c |
From: Phil Sutter <phil@nwl.cc>
|
|
|
8cce6c |
Date: Tue, 5 Feb 2019 18:18:02 +0100
|
|
|
8cce6c |
Subject: [PATCH] Revert "ebtables: use extrapositioned negation consistently"
|
|
|
8cce6c |
|
|
|
8cce6c |
This reverts commit 5f508b76a0cebaf91965ffa678089222e2d47964.
|
|
|
8cce6c |
|
|
|
8cce6c |
While attempts at unifying syntax between arp-, eb- and iptables-nft
|
|
|
8cce6c |
increase the opportunity for more code-sharing, they are problematic
|
|
|
8cce6c |
when it comes to compatibility. Accepting the old syntax on input helps,
|
|
|
8cce6c |
but due to the fact that neither arptables nor ebtables support --check
|
|
|
8cce6c |
command we must expect for users to test existence of a rule by
|
|
|
8cce6c |
comparing input with output. If that happens in a script, deviating from
|
|
|
8cce6c |
the old syntax in output has a high chance of breaking it.
|
|
|
8cce6c |
|
|
|
8cce6c |
Therefore revert Florian's patch changing inversion character position
|
|
|
8cce6c |
in output and review the old code for consistency - the only thing
|
|
|
8cce6c |
changed on top of the actual revert is ebtables' own copy of
|
|
|
8cce6c |
print_iface() to make it adhere to the intrapositioned negation scheme
|
|
|
8cce6c |
used throughout ebtables.
|
|
|
8cce6c |
|
|
|
8cce6c |
Added extension tests by the reverted commit have been kept.
|
|
|
8cce6c |
|
|
|
8cce6c |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
8cce6c |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
8cce6c |
(cherry picked from commit 35b22e82fa62e10950d8e0fa53a755d4abadf346)
|
|
|
8cce6c |
|
|
|
8cce6c |
Conflicts:
|
|
|
8cce6c |
- Drop changes to extensions/*.t since these files don't exist in
|
|
|
8cce6c |
release tarballs.
|
|
|
8cce6c |
|
|
|
8cce6c |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
8cce6c |
---
|
|
|
8cce6c |
extensions/libebt_802_3.c | 4 ++--
|
|
|
8cce6c |
extensions/libebt_arp.c | 14 +++++++-------
|
|
|
8cce6c |
extensions/libebt_ip.c | 16 ++++++++--------
|
|
|
8cce6c |
extensions/libebt_ip6.c | 14 +++++++-------
|
|
|
8cce6c |
extensions/libebt_mark_m.c | 2 +-
|
|
|
8cce6c |
extensions/libebt_pkttype.c | 5 +----
|
|
|
8cce6c |
extensions/libebt_stp.c | 5 ++---
|
|
|
8cce6c |
extensions/libebt_vlan.c | 13 ++++---------
|
|
|
8cce6c |
iptables/nft-bridge.c | 6 +++---
|
|
|
8cce6c |
9 files changed, 35 insertions(+), 44 deletions(-)
|
|
|
8cce6c |
|
|
|
8cce6c |
diff --git a/extensions/libebt_802_3.c b/extensions/libebt_802_3.c
|
|
|
8cce6c |
index 9e91d05262591..f05d02ead5a4a 100644
|
|
|
8cce6c |
--- a/extensions/libebt_802_3.c
|
|
|
8cce6c |
+++ b/extensions/libebt_802_3.c
|
|
|
8cce6c |
@@ -98,15 +98,15 @@ static void br802_3_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
struct ebt_802_3_info *info = (struct ebt_802_3_info *)match->data;
|
|
|
8cce6c |
|
|
|
8cce6c |
if (info->bitmask & EBT_802_3_SAP) {
|
|
|
8cce6c |
+ printf("--802_3-sap ");
|
|
|
8cce6c |
if (info->invflags & EBT_802_3_SAP)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--802_3-sap ");
|
|
|
8cce6c |
printf("0x%.2x ", info->sap);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (info->bitmask & EBT_802_3_TYPE) {
|
|
|
8cce6c |
+ printf("--802_3-type ");
|
|
|
8cce6c |
if (info->invflags & EBT_802_3_TYPE)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--802_3-type ");
|
|
|
8cce6c |
printf("0x%.4x ", ntohs(info->type));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
}
|
|
|
8cce6c |
diff --git a/extensions/libebt_arp.c b/extensions/libebt_arp.c
|
|
|
8cce6c |
index c1b0ab1db0cf1..a062b7e7e5864 100644
|
|
|
8cce6c |
--- a/extensions/libebt_arp.c
|
|
|
8cce6c |
+++ b/extensions/libebt_arp.c
|
|
|
8cce6c |
@@ -338,51 +338,51 @@ static void brarp_print(const void *ip, const struct xt_entry_match *match, int
|
|
|
8cce6c |
|
|
|
8cce6c |
if (arpinfo->bitmask & EBT_ARP_OPCODE) {
|
|
|
8cce6c |
int opcode = ntohs(arpinfo->opcode);
|
|
|
8cce6c |
+ printf("--arp-op ");
|
|
|
8cce6c |
if (arpinfo->invflags & EBT_ARP_OPCODE)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--arp-op ");
|
|
|
8cce6c |
if (opcode > 0 && opcode <= ARRAY_SIZE(opcodes))
|
|
|
8cce6c |
printf("%s ", opcodes[opcode - 1]);
|
|
|
8cce6c |
else
|
|
|
8cce6c |
printf("%d ", opcode);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (arpinfo->bitmask & EBT_ARP_HTYPE) {
|
|
|
8cce6c |
+ printf("--arp-htype ");
|
|
|
8cce6c |
if (arpinfo->invflags & EBT_ARP_HTYPE)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--arp-htype ");
|
|
|
8cce6c |
printf("%d ", ntohs(arpinfo->htype));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (arpinfo->bitmask & EBT_ARP_PTYPE) {
|
|
|
8cce6c |
+ printf("--arp-ptype ");
|
|
|
8cce6c |
if (arpinfo->invflags & EBT_ARP_PTYPE)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--arp-ptype ");
|
|
|
8cce6c |
printf("0x%x ", ntohs(arpinfo->ptype));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (arpinfo->bitmask & EBT_ARP_SRC_IP) {
|
|
|
8cce6c |
+ printf("--arp-ip-src ");
|
|
|
8cce6c |
if (arpinfo->invflags & EBT_ARP_SRC_IP)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--arp-ip-src ");
|
|
|
8cce6c |
printf("%s%s ", xtables_ipaddr_to_numeric((const struct in_addr*) &arpinfo->saddr),
|
|
|
8cce6c |
xtables_ipmask_to_numeric((const struct in_addr*)&arpinfo->smsk));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (arpinfo->bitmask & EBT_ARP_DST_IP) {
|
|
|
8cce6c |
+ printf("--arp-ip-dst ");
|
|
|
8cce6c |
if (arpinfo->invflags & EBT_ARP_DST_IP)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--arp-ip-dst ");
|
|
|
8cce6c |
printf("%s%s ", xtables_ipaddr_to_numeric((const struct in_addr*) &arpinfo->daddr),
|
|
|
8cce6c |
xtables_ipmask_to_numeric((const struct in_addr*)&arpinfo->dmsk));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (arpinfo->bitmask & EBT_ARP_SRC_MAC) {
|
|
|
8cce6c |
+ printf("--arp-mac-src ");
|
|
|
8cce6c |
if (arpinfo->invflags & EBT_ARP_SRC_MAC)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--arp-mac-src ");
|
|
|
8cce6c |
xtables_print_mac_and_mask(arpinfo->smaddr, arpinfo->smmsk);
|
|
|
8cce6c |
printf(" ");
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (arpinfo->bitmask & EBT_ARP_DST_MAC) {
|
|
|
8cce6c |
+ printf("--arp-mac-dst ");
|
|
|
8cce6c |
if (arpinfo->invflags & EBT_ARP_DST_MAC)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--arp-mac-dst ");
|
|
|
8cce6c |
xtables_print_mac_and_mask(arpinfo->dmaddr, arpinfo->dmmsk);
|
|
|
8cce6c |
printf(" ");
|
|
|
8cce6c |
}
|
|
|
8cce6c |
diff --git a/extensions/libebt_ip.c b/extensions/libebt_ip.c
|
|
|
8cce6c |
index d48704fe1c802..acb9bfcdbbd9f 100644
|
|
|
8cce6c |
--- a/extensions/libebt_ip.c
|
|
|
8cce6c |
+++ b/extensions/libebt_ip.c
|
|
|
8cce6c |
@@ -472,35 +472,35 @@ static void brip_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
struct in_addr *addrp, *maskp;
|
|
|
8cce6c |
|
|
|
8cce6c |
if (info->bitmask & EBT_IP_SOURCE) {
|
|
|
8cce6c |
+ printf("--ip-src ");
|
|
|
8cce6c |
if (info->invflags & EBT_IP_SOURCE)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip-src ");
|
|
|
8cce6c |
addrp = (struct in_addr *)&info->saddr;
|
|
|
8cce6c |
maskp = (struct in_addr *)&info->smsk;
|
|
|
8cce6c |
printf("%s%s ", xtables_ipaddr_to_numeric(addrp),
|
|
|
8cce6c |
xtables_ipmask_to_numeric(maskp));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (info->bitmask & EBT_IP_DEST) {
|
|
|
8cce6c |
+ printf("--ip-dst ");
|
|
|
8cce6c |
if (info->invflags & EBT_IP_DEST)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip-dst ");
|
|
|
8cce6c |
addrp = (struct in_addr *)&info->daddr;
|
|
|
8cce6c |
maskp = (struct in_addr *)&info->dmsk;
|
|
|
8cce6c |
printf("%s%s ", xtables_ipaddr_to_numeric(addrp),
|
|
|
8cce6c |
xtables_ipmask_to_numeric(maskp));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (info->bitmask & EBT_IP_TOS) {
|
|
|
8cce6c |
+ printf("--ip-tos ");
|
|
|
8cce6c |
if (info->invflags & EBT_IP_TOS)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip-tos ");
|
|
|
8cce6c |
printf("0x%02X ", info->tos);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (info->bitmask & EBT_IP_PROTO) {
|
|
|
8cce6c |
struct protoent *pe;
|
|
|
8cce6c |
|
|
|
8cce6c |
+ printf("--ip-proto ");
|
|
|
8cce6c |
if (info->invflags & EBT_IP_PROTO)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip-proto ");
|
|
|
8cce6c |
pe = getprotobynumber(info->protocol);
|
|
|
8cce6c |
if (pe == NULL) {
|
|
|
8cce6c |
printf("%d ", info->protocol);
|
|
|
8cce6c |
@@ -509,28 +509,28 @@ static void brip_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
}
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (info->bitmask & EBT_IP_SPORT) {
|
|
|
8cce6c |
+ printf("--ip-sport ");
|
|
|
8cce6c |
if (info->invflags & EBT_IP_SPORT)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip-sport ");
|
|
|
8cce6c |
print_port_range(info->sport);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (info->bitmask & EBT_IP_DPORT) {
|
|
|
8cce6c |
+ printf("--ip-dport ");
|
|
|
8cce6c |
if (info->invflags & EBT_IP_DPORT)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip-dport ");
|
|
|
8cce6c |
print_port_range(info->dport);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (info->bitmask & EBT_IP_ICMP) {
|
|
|
8cce6c |
+ printf("--ip-icmp-type ");
|
|
|
8cce6c |
if (info->invflags & EBT_IP_ICMP)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip-icmp-type ");
|
|
|
8cce6c |
ebt_print_icmp_type(icmp_codes, ARRAY_SIZE(icmp_codes),
|
|
|
8cce6c |
info->icmp_type, info->icmp_code);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (info->bitmask & EBT_IP_IGMP) {
|
|
|
8cce6c |
+ printf("--ip-igmp-type ");
|
|
|
8cce6c |
if (info->invflags & EBT_IP_IGMP)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip-igmp-type ");
|
|
|
8cce6c |
ebt_print_icmp_type(igmp_types, ARRAY_SIZE(igmp_types),
|
|
|
8cce6c |
info->igmp_type, NULL);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
diff --git a/extensions/libebt_ip6.c b/extensions/libebt_ip6.c
|
|
|
8cce6c |
index b727764903ffa..b8a5a5d8c3a92 100644
|
|
|
8cce6c |
--- a/extensions/libebt_ip6.c
|
|
|
8cce6c |
+++ b/extensions/libebt_ip6.c
|
|
|
8cce6c |
@@ -399,31 +399,31 @@ static void brip6_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
struct ebt_ip6_info *ipinfo = (struct ebt_ip6_info *)match->data;
|
|
|
8cce6c |
|
|
|
8cce6c |
if (ipinfo->bitmask & EBT_IP6_SOURCE) {
|
|
|
8cce6c |
+ printf("--ip6-src ");
|
|
|
8cce6c |
if (ipinfo->invflags & EBT_IP6_SOURCE)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip6-src ");
|
|
|
8cce6c |
printf("%s", xtables_ip6addr_to_numeric(&ipinfo->saddr));
|
|
|
8cce6c |
printf("%s ", xtables_ip6mask_to_numeric(&ipinfo->smsk));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (ipinfo->bitmask & EBT_IP6_DEST) {
|
|
|
8cce6c |
+ printf("--ip6-dst ");
|
|
|
8cce6c |
if (ipinfo->invflags & EBT_IP6_DEST)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip6-dst ");
|
|
|
8cce6c |
printf("%s", xtables_ip6addr_to_numeric(&ipinfo->daddr));
|
|
|
8cce6c |
printf("%s ", xtables_ip6mask_to_numeric(&ipinfo->dmsk));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (ipinfo->bitmask & EBT_IP6_TCLASS) {
|
|
|
8cce6c |
+ printf("--ip6-tclass ");
|
|
|
8cce6c |
if (ipinfo->invflags & EBT_IP6_TCLASS)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip6-tclass ");
|
|
|
8cce6c |
printf("0x%02X ", ipinfo->tclass);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (ipinfo->bitmask & EBT_IP6_PROTO) {
|
|
|
8cce6c |
struct protoent *pe;
|
|
|
8cce6c |
|
|
|
8cce6c |
+ printf("--ip6-proto ");
|
|
|
8cce6c |
if (ipinfo->invflags & EBT_IP6_PROTO)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip6-proto ");
|
|
|
8cce6c |
pe = getprotobynumber(ipinfo->protocol);
|
|
|
8cce6c |
if (pe == NULL) {
|
|
|
8cce6c |
printf("%d ", ipinfo->protocol);
|
|
|
8cce6c |
@@ -432,21 +432,21 @@ static void brip6_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
}
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (ipinfo->bitmask & EBT_IP6_SPORT) {
|
|
|
8cce6c |
+ printf("--ip6-sport ");
|
|
|
8cce6c |
if (ipinfo->invflags & EBT_IP6_SPORT)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip6-sport ");
|
|
|
8cce6c |
print_port_range(ipinfo->sport);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (ipinfo->bitmask & EBT_IP6_DPORT) {
|
|
|
8cce6c |
+ printf("--ip6-dport ");
|
|
|
8cce6c |
if (ipinfo->invflags & EBT_IP6_DPORT)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip6-dport ");
|
|
|
8cce6c |
print_port_range(ipinfo->dport);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (ipinfo->bitmask & EBT_IP6_ICMP6) {
|
|
|
8cce6c |
+ printf("--ip6-icmp-type ");
|
|
|
8cce6c |
if (ipinfo->invflags & EBT_IP6_ICMP6)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--ip6-icmp-type ");
|
|
|
8cce6c |
print_icmp_type(ipinfo->icmpv6_type, ipinfo->icmpv6_code);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
}
|
|
|
8cce6c |
diff --git a/extensions/libebt_mark_m.c b/extensions/libebt_mark_m.c
|
|
|
8cce6c |
index 64ad926f19959..2462d0af7d0bc 100644
|
|
|
8cce6c |
--- a/extensions/libebt_mark_m.c
|
|
|
8cce6c |
+++ b/extensions/libebt_mark_m.c
|
|
|
8cce6c |
@@ -86,9 +86,9 @@ static void brmark_m_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
{
|
|
|
8cce6c |
struct ebt_mark_m_info *info = (struct ebt_mark_m_info *)match->data;
|
|
|
8cce6c |
|
|
|
8cce6c |
+ printf("--mark ");
|
|
|
8cce6c |
if (info->invert)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("--mark ");
|
|
|
8cce6c |
if (info->bitmask == EBT_MARK_OR)
|
|
|
8cce6c |
printf("/0x%lx ", info->mask);
|
|
|
8cce6c |
else if (info->mask != 0xffffffff)
|
|
|
8cce6c |
diff --git a/extensions/libebt_pkttype.c b/extensions/libebt_pkttype.c
|
|
|
8cce6c |
index 265674d19bde6..4e2d19de7983b 100644
|
|
|
8cce6c |
--- a/extensions/libebt_pkttype.c
|
|
|
8cce6c |
+++ b/extensions/libebt_pkttype.c
|
|
|
8cce6c |
@@ -75,10 +75,7 @@ static void brpkttype_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
{
|
|
|
8cce6c |
struct ebt_pkttype_info *pt = (struct ebt_pkttype_info *)match->data;
|
|
|
8cce6c |
|
|
|
8cce6c |
- if (pt->invert)
|
|
|
8cce6c |
- printf("! ");
|
|
|
8cce6c |
-
|
|
|
8cce6c |
- printf("--pkttype-type ");
|
|
|
8cce6c |
+ printf("--pkttype-type %s", pt->invert ? "! " : "");
|
|
|
8cce6c |
|
|
|
8cce6c |
if (pt->pkt_type < ARRAY_SIZE(classes))
|
|
|
8cce6c |
printf("%s ", classes[pt->pkt_type]);
|
|
|
8cce6c |
diff --git a/extensions/libebt_stp.c b/extensions/libebt_stp.c
|
|
|
8cce6c |
index 33e4c8d9c615d..06cf93b8d8449 100644
|
|
|
8cce6c |
--- a/extensions/libebt_stp.c
|
|
|
8cce6c |
+++ b/extensions/libebt_stp.c
|
|
|
8cce6c |
@@ -307,9 +307,8 @@ static void brstp_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
for (i = 0; i < STP_NUMOPS; i++) {
|
|
|
8cce6c |
if (!(stpinfo->bitmask & (1 << i)))
|
|
|
8cce6c |
continue;
|
|
|
8cce6c |
- if (stpinfo->invflags & (1 << i))
|
|
|
8cce6c |
- printf("! ");
|
|
|
8cce6c |
- printf("--%s ", brstp_opts[i].name);
|
|
|
8cce6c |
+ printf("--%s %s", brstp_opts[i].name,
|
|
|
8cce6c |
+ (stpinfo->invflags & (1 << i)) ? "! " : "");
|
|
|
8cce6c |
if (EBT_STP_TYPE == (1 << i)) {
|
|
|
8cce6c |
if (stpinfo->type == BPDU_TYPE_CONFIG)
|
|
|
8cce6c |
printf("%s", BPDU_TYPE_CONFIG_STRING);
|
|
|
8cce6c |
diff --git a/extensions/libebt_vlan.c b/extensions/libebt_vlan.c
|
|
|
8cce6c |
index 4a2eb7126895e..a2a9dcce531ce 100644
|
|
|
8cce6c |
--- a/extensions/libebt_vlan.c
|
|
|
8cce6c |
+++ b/extensions/libebt_vlan.c
|
|
|
8cce6c |
@@ -108,19 +108,14 @@ static void brvlan_print(const void *ip, const struct xt_entry_match *match,
|
|
|
8cce6c |
struct ebt_vlan_info *vlaninfo = (struct ebt_vlan_info *) match->data;
|
|
|
8cce6c |
|
|
|
8cce6c |
if (vlaninfo->bitmask & EBT_VLAN_ID) {
|
|
|
8cce6c |
- if (vlaninfo->invflags & EBT_VLAN_ID)
|
|
|
8cce6c |
- printf("! ");
|
|
|
8cce6c |
- printf("--vlan-id %d ", vlaninfo->id);
|
|
|
8cce6c |
+ printf("--vlan-id %s%d ", (vlaninfo->invflags & EBT_VLAN_ID) ? "! " : "", vlaninfo->id);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (vlaninfo->bitmask & EBT_VLAN_PRIO) {
|
|
|
8cce6c |
- if (vlaninfo->invflags & EBT_VLAN_PRIO)
|
|
|
8cce6c |
- printf("! ");
|
|
|
8cce6c |
- printf("--vlan-prio %d ", vlaninfo->prio);
|
|
|
8cce6c |
+ printf("--vlan-prio %s%d ", (vlaninfo->invflags & EBT_VLAN_PRIO) ? "! " : "", vlaninfo->prio);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
if (vlaninfo->bitmask & EBT_VLAN_ENCAP) {
|
|
|
8cce6c |
- if (vlaninfo->invflags & EBT_VLAN_ENCAP)
|
|
|
8cce6c |
- printf("! ");
|
|
|
8cce6c |
- printf("--vlan-encap %4.4X ", ntohs(vlaninfo->encap));
|
|
|
8cce6c |
+ printf("--vlan-encap %s", (vlaninfo->invflags & EBT_VLAN_ENCAP) ? "! " : "");
|
|
|
8cce6c |
+ printf("%4.4X ", ntohs(vlaninfo->encap));
|
|
|
8cce6c |
}
|
|
|
8cce6c |
}
|
|
|
8cce6c |
|
|
|
8cce6c |
diff --git a/iptables/nft-bridge.c b/iptables/nft-bridge.c
|
|
|
8cce6c |
index 43b3e3e9649b8..2b79ca951cd92 100644
|
|
|
8cce6c |
--- a/iptables/nft-bridge.c
|
|
|
8cce6c |
+++ b/iptables/nft-bridge.c
|
|
|
8cce6c |
@@ -344,7 +344,7 @@ static void nft_rule_to_ebtables_command_state(const struct nftnl_rule *r,
|
|
|
8cce6c |
static void print_iface(const char *option, const char *name, bool invert)
|
|
|
8cce6c |
{
|
|
|
8cce6c |
if (*name)
|
|
|
8cce6c |
- printf("%s%s %s ", invert ? "! " : "", option, name);
|
|
|
8cce6c |
+ printf("%s%s %s ", option, invert ? " !" : "", name);
|
|
|
8cce6c |
}
|
|
|
8cce6c |
|
|
|
8cce6c |
static void nft_bridge_print_table_header(const char *tablename)
|
|
|
8cce6c |
@@ -389,9 +389,9 @@ static void print_mac(char option, const unsigned char *mac,
|
|
|
8cce6c |
const unsigned char *mask,
|
|
|
8cce6c |
bool invert)
|
|
|
8cce6c |
{
|
|
|
8cce6c |
+ printf("-%c ", option);
|
|
|
8cce6c |
if (invert)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("-%c ", option);
|
|
|
8cce6c |
ebt_print_mac_and_mask(mac, mask);
|
|
|
8cce6c |
printf(" ");
|
|
|
8cce6c |
}
|
|
|
8cce6c |
@@ -406,9 +406,9 @@ static void print_protocol(uint16_t ethproto, bool invert, unsigned int bitmask)
|
|
|
8cce6c |
if (bitmask & EBT_NOPROTO)
|
|
|
8cce6c |
return;
|
|
|
8cce6c |
|
|
|
8cce6c |
+ printf("-p ");
|
|
|
8cce6c |
if (invert)
|
|
|
8cce6c |
printf("! ");
|
|
|
8cce6c |
- printf("-p ");
|
|
|
8cce6c |
|
|
|
8cce6c |
if (bitmask & EBT_802_3) {
|
|
|
8cce6c |
printf("length ");
|
|
|
8cce6c |
--
|
|
|
8cce6c |
2.20.1
|
|
|
8cce6c |
|