Page MenuHomeFreeBSD

pf: Fix endless loop on NAT exhaustion with sticky-address

Authored by kp on Dec 8 2018, 3:06 PM.



When we try to find a source port in pf_get_sport() it's possible that
all available source ports will be in use. In that case we call
pf_map_addr() to try to find a new source IP to try from. If there are
no more available source IPs pf_map_addr() will return 1 and we stop

However, if sticky-address is set we'll always return the same IP
address, even if we've already tried that one.
We need to check the supplied address, because if that's the one we'd
set it means pf_get_sport() has already tried it, and we should error
out rather than keep trying.

PR: 233867

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Tested and can confirm this resolves the issue of endless loop with PF_POOL_STICKYADDR when all available ephemeral ports are exhausted.

This revision is now accepted and ready to land.Dec 9 2018, 8:40 AM
This revision was automatically updated to reflect the committed changes.