Page MenuHomeFreeBSD

pf: Prevent infinite looping over tables in round-robin pools
ClosedPublic

Authored by vegeta_tuxpowered.net on Jun 10 2025, 3:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 5, 3:07 PM
Unknown Object (File)
Sun, Apr 5, 2:42 PM
Unknown Object (File)
Sat, Apr 4, 3:17 PM
Unknown Object (File)
Fri, Apr 3, 2:27 AM
Unknown Object (File)
Fri, Mar 13, 11:30 PM
Unknown Object (File)
Mar 3 2026, 4:55 PM
Unknown Object (File)
Mar 2 2026, 8:15 PM
Unknown Object (File)
Feb 16 2026, 6:41 PM

Details

Summary

In FreeBSD each redirection pool (struct pf_kpool) consists of multiple
hosts (struct pf_addr_wrap). In OpenBSD that is not the case, and a
round-robin pool having a table as a host loops infinitely only over
that single table.

In FreeBSD once all addresses from a table are returned the pool must
iterate to the next host. Add a custom flag to have pfr_pool_get() break
its loop once it reaches the last index. Use this flag in round-robin
pools. When changing pool's host set index to 0 to always start
iterating each table from beginning.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable