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 | |
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')
-rw-r--r-- | iptables/nft-bridge.c | 17 | ||||
-rwxr-xr-x | iptables/tests/shell/testcases/ebtables/0002-ebtables-save-restore_0 | 4 |
2 files changed, 6 insertions, 15 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) diff --git a/iptables/tests/shell/testcases/ebtables/0002-ebtables-save-restore_0 b/iptables/tests/shell/testcases/ebtables/0002-ebtables-save-restore_0 index eeb7d835..b23c1ee1 100755 --- a/iptables/tests/shell/testcases/ebtables/0002-ebtables-save-restore_0 +++ b/iptables/tests/shell/testcases/ebtables/0002-ebtables-save-restore_0 @@ -75,8 +75,8 @@ DUMP='*filter -A foo -p ARP --arp-op Request -j ACCEPT -A foo -p ARP --arp-ip-src 10.0.0.1 -j ACCEPT -A foo -p ARP --arp-ip-dst 10.0.0.0/8 -j ACCEPT --A foo -p ARP --arp-mac-src fe:ed:ba:be:0:1 -j ACCEPT --A foo -p ARP --arp-mac-dst fe:ed:ba:0:0:0/ff:ff:ff:0:0:0 -j ACCEPT +-A foo -p ARP --arp-mac-src fe:ed:ba:be:00:01 -j ACCEPT +-A foo -p ARP --arp-mac-dst fe:ed:ba:00:00:00/ff:ff:ff:00:00:00 -j ACCEPT -A foo -p IPv4 --ip-src 10.0.0.1 -j ACCEPT -A foo -p IPv4 --ip-dst 10.0.0.0/8 -j ACCEPT -A foo -p IPv4 --ip-tos 0x10 -j ACCEPT |