HomeFreeBSD

pf: Fix error handling when pf_map_addr() fails

Description

pf: Fix error handling when pf_map_addr() fails

When pf_map_addr() fails, for example for a NAT pool, we expect packet will
not be forwarded. The error returned by pf_map_addr() has been ignored in
pf_map_addr_sn(), though, causing packets being forwarded without NAT
applied. Catch the error, return the error to caller, let the caller handle
error counters for route-to pools just like it does for NAT pools. Add
tests for NAT and route-to rules.

Improve logging by not hardcoding function name and use func
instead.

Reviewed by: kp
Approved by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D50763

Details

Provenance
vegeta_tuxpowered.netAuthored on Jun 5 2025, 6:40 PM
Reviewer
kp
Differential Revision
D50763: pf: Fix error handling when pf_map_addr() fails
Parents
rG5031da20599b: bluetooth-config: Fix command line parsing
Branches
Unknown
Tags
Unknown