From 84331e3ed3f8eb9d53c00c221113ad16b209968a Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 31 Jan 2019 16:12:55 +0100 Subject: arptables-nft: Don't print default h-len/h-type values Default values for --h-len and --h-type being printed for rules where user didn't provide them is unexpected and confusing. The drawback is the opposite: If user provided either of them with their default value, they are later omitted when listing rules. Though since unlike legacy arptables we can't distinguish between not specified and specified with default value, we can't fix both - so choose to optimize for the more likely case. Fixes: 5aecb2d8bfdda ("arptables: pre-init hlen and ethertype") Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- iptables/nft-arp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'iptables/nft-arp.c') diff --git a/iptables/nft-arp.c b/iptables/nft-arp.c index 3dc0b953..438646de 100644 --- a/iptables/nft-arp.c +++ b/iptables/nft-arp.c @@ -537,7 +537,7 @@ after_devsrc: after_devdst: - if (fw->arp.arhln_mask != 0) { + if (fw->arp.arhln_mask != 255 || fw->arp.arhln != 6) { printf("%s%s", sep, fw->arp.invflags & ARPT_INV_ARPHLN ? "! " : ""); printf("--h-length %d", fw->arp.arhln); @@ -561,7 +561,7 @@ after_devdst: sep = " "; } - if (fw->arp.arhrd_mask != 0) { + if (fw->arp.arhrd_mask != 65535 || fw->arp.arhrd != htons(1)) { uint16_t tmp = ntohs(fw->arp.arhrd); printf("%s%s", sep, fw->arp.invflags & ARPT_INV_ARPHRD -- cgit v1.2.3