Discussion:
[Bug 233867] pf: Long freezes on NAT port exhaustion
b***@freebsd.org
2018-12-08 14:50:56 UTC
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233867

Bug ID: 233867
Summary: pf: Long freezes on NAT port exhaustion
Product: Base System
Version: 11.2-STABLE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: ***@FreeBSD.org
Reporter: ***@freebsd.org

A user reports that, in a large NAT setup with pf, the system will from time to
time stop passing traffic. This resolves itself after a few minutes.
Afterwards the pf counters show an abnormally large number of searches.
--
You are receiving this mail because:
You are the assignee for the bug.
b***@freebsd.org
2018-12-08 14:52:44 UTC
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233867

--- Comment #1 from Kristof Provost <***@freebsd.org> ---
Created attachment 199955
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=199955&action=edit
Test case demonstrating the problem

This test case provokes the problem.
It sets up NAT with only two usable ports, then creates three connections.
--
You are receiving this mail because:
You are the assignee for the bug.
b***@freebsd.org
2018-12-08 14:57:10 UTC
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233867

Kristof Provost <***@freebsd.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://bugs.freebsd.org/bu
| |gzilla/show_bug.cgi?id=1840
| |03
Status|New |Open

--- Comment #2 from Kristof Provost <***@freebsd.org> ---
The system loses network connectivity when it can't find a free source port in
pf_get_sport(). It keeps calling pf_map_addr(), trying to get a new IP to check
for available ports.

I believe this problem was introduced by the patch in PR# 184003.

Note that we're running NAT with PF_POOL_STICKYADDR, so we find a src_node, and
the early return is taken. This means we always return the same IP, and loop
through the available ports in pf_get_sport() again and again. This loop
continues until a state times out, and we do find a free port.
--
You are receiving this mail because:
You are the assignee for the bug.
b***@freebsd.org
2018-12-08 15:06:45 UTC
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233867

--- Comment #3 from Kristof Provost <***@freebsd.org> ---
Proposed fix in: https://reviews.freebsd.org/D18483
--
You are receiving this mail because:
You are the assignee for the bug.
b***@freebsd.org
2018-12-08 15:07:15 UTC
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233867

Kristof Provost <***@freebsd.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@tuxpowered.net
Assignee|***@FreeBSD.org |***@freebsd.org
--
You are receiving this mail because:
You are the assignee for the bug.
Loading...