Page MenuHomeFreeBSD

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

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

Details

Summary

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
trying.

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kristof created this revision.Dec 8 2018, 3:06 PM
farrokhi accepted this revision as: farrokhi.Dec 9 2018, 8:40 AM

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.