From c33bae9c6c7a49c8af16df846e6112fc4727e643 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 13 Feb 2020 17:49:53 +0100 Subject: ebtables: among: Support mixed MAC and MAC/IP entries Powered by Stefano's support for concatenated ranges, a full among match replacement can be implemented. The trick is to add MAC-only elements as a concatenation of MAC and zero-length prefix, i.e. a range from 0.0.0.0 till 255.255.255.255. Although not quite needed, detection of pure MAC-only matches is left in place. For those, no implicit 'meta protocol' match is added (which is required otherwise at least to keep nft output correct) and no concat type is used for the set. Signed-off-by: Phil Sutter --- extensions/libebt_among.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'extensions/libebt_among.c') diff --git a/extensions/libebt_among.c b/extensions/libebt_among.c index 715d559f..2b9a1b65 100644 --- a/extensions/libebt_among.c +++ b/extensions/libebt_among.c @@ -63,10 +63,6 @@ parse_nft_among_pair(char *buf, struct nft_among_pair *pair, bool have_ip) char *sep = index(buf, '='); struct ether_addr *ether; - if (have_ip ^ !!sep) - xtables_error(PARAMETER_PROBLEM, - "among: Mixed MAC and MAC=IP not allowed."); - if (sep) { *sep = '\0'; @@ -205,7 +201,7 @@ static void __bramong_print(struct nft_among_pair *pairs, isep = ","; printf("%s", ether_ntoa(&pairs[i].ether)); - if (have_ip) + if (pairs[i].in.s_addr != INADDR_ANY) printf("=%s", inet_ntoa(pairs[i].in)); } printf(" "); -- cgit v1.2.3