From 7bd9febf65e98eb1f4b4d51afa2479c442066235 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Sat, 3 Nov 2018 23:43:49 +0100 Subject: libxtables: add and use mac print helpers This changes ebtables-nft to consistently print mac address with two characters, i.e. 00:01:02:03:04:0a, not 0:1:2:3:4:a. Will require another bump of vcurrent/vage. Suggested-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal --- iptables/nft-bridge.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'iptables/nft-bridge.c') diff --git a/iptables/nft-bridge.c b/iptables/nft-bridge.c index a616f845..92e3f3b6 100644 --- a/iptables/nft-bridge.c +++ b/iptables/nft-bridge.c @@ -45,21 +45,12 @@ void ebt_cs_clean(struct iptables_command_state *cs) } } -/* 0: default, print only 2 digits if necessary - * 2: always print 2 digits, a printed mac address - * then always has the same length - */ -int ebt_printstyle_mac; - static void ebt_print_mac(const unsigned char *mac) { - if (ebt_printstyle_mac == 2) { - int j; - for (j = 0; j < ETH_ALEN; j++) - printf("%02x%s", mac[j], - (j==ETH_ALEN-1) ? "" : ":"); - } else - printf("%s", ether_ntoa((struct ether_addr *) mac)); + int j; + + for (j = 0; j < ETH_ALEN; j++) + printf("%02x%s", mac[j], (j==ETH_ALEN-1) ? "" : ":"); } static bool mac_all_ones(const unsigned char *mac) -- cgit v1.2.3