git: e044f67a66c8 - main - pfctl: improve bitmask printing
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 19 Sep 2024 20:21:15 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e044f67a66c82721b419949132fc48261ee39555 commit e044f67a66c82721b419949132fc48261ee39555 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2024-08-29 11:48:41 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2024-09-19 20:20:12 +0000 pfctl: improve bitmask printing In some cases the netmask gets set to a full 128 bit mask even if no address family is selected; don't print the v6 mask if it's a v4 address. Obtained from: OpenBSD, mcbride <mcbride@openbsd.org>, f6d7b41f07 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46584 --- sbin/pfctl/pf_print_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 0b862273fab3..96da1e109fa8 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -128,7 +128,7 @@ print_addr(struct pf_addr_wrap *addr, sa_family_t af, int verbose) PF_AZERO(&addr->v.a.mask, AF_INET6))) { int bits = unmask(&addr->v.a.mask, af); - if (bits != (af == AF_INET ? 32 : 128)) + if (bits < (af == AF_INET ? 32 : 128)) printf("/%d", bits); } }