summaryrefslogtreecommitdiffstats
path: root/iptables
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2022-12-01 13:03:49 +0100
committerPhil Sutter <phil@nwl.cc>2022-12-02 01:47:32 +0100
commit39589b3edb7c0ea3e64777c7f4cdbf45be55ce53 (patch)
tree267f5398896ab802f3505b4a4e93cf0d103e3fb1 /iptables
parentba1c0fe89eb56f8bf25f9165f2e5dc366ea0118c (diff)
ebtables: Fix MAC address match translation
If a mask was present, ebtables-translate would emit illegal syntax. Fixes: 5e2b473a64bc7 ("xtables-compat: extend generic tests for masks and wildcards") Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables')
-rw-r--r--iptables/nft-bridge.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/iptables/nft-bridge.c b/iptables/nft-bridge.c
index 8d002c17..e223d197 100644
--- a/iptables/nft-bridge.c
+++ b/iptables/nft-bridge.c
@@ -866,17 +866,17 @@ static void nft_bridge_xlate_mac(struct xt_xlate *xl, const char *type, bool inv
xt_xlate_add(xl, "ether %s %s", type, invert ? "!= " : "");
- xlate_mac(xl, mac);
-
if (memcmp(mask, one_msk, ETH_ALEN)) {
int i;
- xt_xlate_add(xl, " and ");
+ xt_xlate_add(xl, "and");
xlate_mac(xl, mask);
xt_xlate_add(xl, " == %02x", mac[0] & mask[0]);
for (i=1; i < ETH_ALEN; i++)
xt_xlate_add(xl, ":%02x", mac[i] & mask[i]);
+ } else {
+ xlate_mac(xl, mac);
}
}