Date: Sun, 18 Jun 2017 09:03:44 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 220101] [patch] LibAlias: allocate NAT ports using exhaustive search Message-ID: <bug-220101-8@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D220101 Bug ID: 220101 Summary: [patch] LibAlias: allocate NAT ports using exhaustive search Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Keywords: patch Severity: Affects Many People Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: damjan.jov@gmail.com Created attachment 183594 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D183594&action= =3Dedit LibAlias: allocate NAT ports using exhaustive search Currently libalias allocates NAT ports from a pool of 32768 ports (from ALIAS_PORT_BASE to ALIAS_PORT_BASE + ALIAS_PORT_MASK), by randomly trying GET_NEW_PORT_MAX_ATTEMPTS (20) ports and returning the first unused one, otherwise failing. On a heavily loaded setup, as the number of ports in use approaches 32768, requests for ports will increasingly fail even though there are free ports. With 30000 ports in use, 17.12% of requests fail, with 31000 ports in use, 32.98% of requests fail, with 32000 ports in use, 62.23% of requests fail. This behavior is erratic, and both PF and IPFILTER allocate ports by exhaustively searching the entire port range from a random starting point (= eg. pf_get_sport() in sys/netpfil/pf/pf_lb.c), which is guaranteed to find a po= rt if any are available. The attached patch changes libalias to do the same. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-220101-8>