HomeFreeBSD

pfctl: fix parsing of '10/8'

Description

pfctl: fix parsing of '10/8'

FreeBSD's getaddrinfo() differs a little from OpenBSD's, and it will resolve
'10' to IPv4 address '0.0.0.10', wheres OpenBSD's will just fail. As a result we
work out that '10/8' is '0.0.0.0/8', rather than the intended '10.0.0.0/8'.

Reverse the order of operations: attempt to parse the address with
inet_net_pton() first and only use getaddrinfo() if that fails.

Sponsored by: Rubicon Communications, LLC ("Netgate")

Details

Provenance
kpAuthored on Jul 1 2025, 3:18 PM
Parents
rGcbca60158062: pfctl: Merge host_v{4,6}() into simpler host_ip()
Branches
Unknown
Tags
Unknown