diff options
author | Florian Westphal <fw@strlen.de> | 2018-11-03 23:43:49 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-11-07 20:08:15 +0100 |
commit | 7bd9febf65e98eb1f4b4d51afa2479c442066235 (patch) | |
tree | 016e65d6e7fc85cda5baa28837e8e0f2c2c93240 /iptables/nft-bridge.c | |
parent | a10eb8861c8fdc8894a8c2f6baf4dd791d5ab4f0 (diff) |
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 <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/nft-bridge.c')
-rw-r--r-- | iptables/nft-bridge.c | 17 |
1 files changed, 4 insertions, 13 deletions
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) |