summaryrefslogtreecommitdiffstats
path: root/iptables
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2023-11-08 03:58:42 +0100
committerPhil Sutter <phil@nwl.cc>2023-11-09 15:55:16 +0100
commit59062564de9d4a3a8ed8b2e0010338dc6d2f1408 (patch)
tree0d99e77ae63a04dc384aa5e72b9f5fea3fa24331 /iptables
parenta3ae0dc4b34046e0d7893841e86b93c4c010632f (diff)
arptables: Fix formatting of numeric --h-type output
Arptables expects numeric arguments to --h-type option in hexadecimal form, even if no '0x'-prefix is present. In contrast, it prints such values in decimal. This is not just inconsistent, but makes it impossible to save and later restore a ruleset without fixing up the values in between. Assuming that the parser side can't be changed for compatibility reasons, fix the output side instead. This is a day 1 bug and present in legacy arptables as well, so treat this as a "feature" of arptables-nft and omit a Fixes: tag. Signed-off-by: Phil Sutter <phil@nwl.cc> Acked-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables')
-rw-r--r--iptables/nft-arp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/iptables/nft-arp.c b/iptables/nft-arp.c
index 8521cc4f..83aec500 100644
--- a/iptables/nft-arp.c
+++ b/iptables/nft-arp.c
@@ -323,9 +323,9 @@ after_devdst:
if (tmp == 1 && !(format & FMT_NUMERIC))
printf("--h-type %s", "Ethernet");
else
- printf("--h-type %u", tmp);
+ printf("--h-type 0x%x", tmp);
if (fw->arp.arhrd_mask != 65535)
- printf("/%d", ntohs(fw->arp.arhrd_mask));
+ printf("/0x%x", ntohs(fw->arp.arhrd_mask));
sep = " ";
}