Date: Thu, 13 Mar 2008 19:30:02 GMT From: Max Laier <max@love2party.net> To: freebsd-pf@FreeBSD.org Subject: Re: kern/121668: connect randomly fails with EPERM with some pf rules Message-ID: <200803131930.m2DJU2Px004712@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/121668; it has been noted by GNATS. From: Max Laier <max@love2party.net> To: bug-followup@freebsd.org, lfrigault@agneau.org Cc: Subject: Re: kern/121668: connect randomly fails with EPERM with some pf rules Date: Thu, 13 Mar 2008 20:26:39 +0100 > sysctl net.inet.tcp.nolocaltimewait=1 > not needed, but helps to reproduce the problem with client and server > on the same computer. Okay, now this is just asking for trouble. pf does thorough checks on TCP states, one of which is to enforce the 2MSL quite time before port reuse. If you set above sysctl you specificly ask FreeBSD to break that rule and thus cause pf to bark. You can also hit the issue if you have a large number of (consecutive) connections between two hosts (e.g. [poorly configured] squid -> www-backends, mysql, ...). The sollution is to: 1) Reduce the connection spree and use one permanent connection 2) Increase the ephemeral port range net.inet.ip.portrange.hi{first,last} 3) Decrease the pf state timeout tcp.{closing,closed} in order to relax the check. You can do this globaly and on a per-rule basis. -- Max
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803131930.m2DJU2Px004712>