From 1bdb5535f561a4e065d766f0f4f41067e31c7281 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 3 Nov 2020 12:08:39 +0100 Subject: libxtables: Extend MAC address printing/parsing support Adding a parser which supports common names for special MAC/mask combinations and a print routine detecting those special addresses and printing the respective name allows to consolidate all the various duplicated implementations. The side-effects of this change are manageable: * arptables now accepts "BGA" as alias for the bridge group address * "mac" match now prints MAC addresses in lower-case which is consistent with the remaining code at least Signed-off-by: Phil Sutter --- include/xtables.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/xtables.h') diff --git a/include/xtables.h b/include/xtables.h index 5044dd08..df1eaee3 100644 --- a/include/xtables.h +++ b/include/xtables.h @@ -557,6 +557,9 @@ extern void xtables_save_string(const char *value); #define FMT(tab,notab) ((format) & FMT_NOTABLE ? (notab) : (tab)) extern void xtables_print_num(uint64_t number, unsigned int format); +extern int xtables_parse_mac_and_mask(const char *from, void *to, void *mask); +extern int xtables_print_well_known_mac_and_mask(const void *mac, + const void *mask); extern void xtables_print_mac(const unsigned char *macaddress); extern void xtables_print_mac_and_mask(const unsigned char *mac, const unsigned char *mask); -- cgit v1.2.3