The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f0cf95809b407b4a8e81beed1642f27b0810ce44
commit f0cf95809b407b4a8e81beed1642f27b0810ce44 Author: Kristof Provost <k...@freebsd.org> AuthorDate: 2025-06-27 12:30:11 +0000 Commit: Kristof Provost <k...@freebsd.org> CommitDate: 2025-07-02 07:40:52 +0000 pfctl: Fill netmask AF-independently in print_host() Instead of masking the host address in two different ways, just fill it no matter the address family. In case of AF_INET, setting the extra 96 bit does not hurt. While here, stop resetting `af' for no reason and move up the variable declaration. OK benno sashan Obtained from: OpenBSD, kn <k...@openbsd.org>, 53f568abff Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pf_print_state.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 821c0745748a..433d1d4e0b7b 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -167,19 +167,14 @@ print_name(struct pf_addr *addr, sa_family_t af) void print_host(struct pf_addr *addr, u_int16_t port, sa_family_t af, int opts) { + struct pf_addr_wrap aw; + if (opts & PF_OPT_USEDNS) print_name(addr, af); else { - struct pf_addr_wrap aw; - memset(&aw, 0, sizeof(aw)); aw.v.a.addr = *addr; - if (af == AF_INET) - aw.v.a.mask.addr32[0] = 0xffffffff; - else { - memset(&aw.v.a.mask, 0xff, sizeof(aw.v.a.mask)); - af = AF_INET6; - } + memset(&aw.v.a.mask, 0xff, sizeof(aw.v.a.mask)); print_addr(&aw, af, opts & PF_OPT_VERBOSE2); }