From tmb@blackmans.org  Fri Nov 16 10:23:00 2001
Return-Path: <tmb@blackmans.org>
Received: from mailhost1.dircon.co.uk (mailhost1.dircon.co.uk [194.112.32.65])
	by hub.freebsd.org (Postfix) with ESMTP id 55A3A37B41A
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 16 Nov 2001 10:22:59 -0800 (PST)
Received: from mail.blackmans.org (dx000662.dircon.co.uk [195.157.223.19] (may be forged))
	by mailhost1.dircon.co.uk (8.9.3/8.9.3) with ESMTP id SAA14124
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 16 Nov 2001 18:22:57 GMT
Received: by mail.blackmans.org (Postfix, from userid 1001)
	id 6E3D7183A; Thu, 15 Nov 2001 19:26:57 +0000 (GMT)
Message-Id: <20011115192657.6E3D7183A@mail.blackmans.org>
Date: Thu, 15 Nov 2001 19:26:57 +0000 (GMT)
From: Mark Blackman <mark@blackmans.org>
Reply-To: Mark Blackman <mark@blackmans.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Add point about net.inet.tcp.portange.{first,last} sysctl tunable to tuning(7) manpage
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         32041
>Category:       docs
>Synopsis:       Add point about net.inet.tcp.portange.{first,last} sysctl tunable to tuning(7) manpage
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 16 10:30:01 PST 2001
>Closed-Date:    Sun Dec 08 17:07:28 PST 2002
>Last-Modified:  Sun Dec 08 17:07:28 PST 2002
>Originator:     Mark Blackman
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
Gnomes of Zurich
>Environment:
System: FreeBSD maddog 4.4-STABLE FreeBSD 4.4-STABLE #124: Fri Nov 2 04:05:32 GMT 2001 root@maddog:/usr/obj/usr/src/sys/BASIC i386

>Description:
tuning(7) doesn't mention the net.inet.tcp.portange.{first,last}
sysctl tunables and probably ought to as at least one published
benchmark failed because the benchmarkers were unaware of its
existence.

http://www.samag.com/documents/s=1147/sam0108q/


>How-To-Repeat:
Read the man page and fail to realize that 
net.inet.tcp.portange.{first,last} might need adjustment.


>Fix:
--- tuning.7	Sat Nov  3 03:32:43 2001
+++ -	Thu Nov 15 19:10:11 2001
@@ -332,6 +332,32 @@
 connections.
 .Pp
 The
+.Em net.inet.ip.portrange.first
+and
+.Em net.inet.ip.portrange.last
+tunables default to 1024 and 5000, respectively. These, like many other
+sysctl tunables, are designed to limit the use of kernel resources
+(i.e. port number space) unless there is an explicit requirement for
+more than this reasonable default.  These are the port numbers
+allocated to sockets which were created with a 
+.Xr socket 2
+call where
+the port number parameter was zero.  This default range of ports (3977
+in total) is likely to be insufficient for a machine running a number
+of client programs of whatever description. The 'first' tunable can't
+be set below 1024, but may be set higher.
+The 'last' tunable will usually be the one that requires tweaking on
+a machine with numerous clients (that don't make use of the IP_PORTRANGE
+.Xr setsockopt 2
+option). Assuming you have enough file descriptors and your client
+code uses
+.Xr perror 3 ,
+you will see a message like "Can't assign requested address"
+(EADDRNOTAVAIL) or "Resource temporarily unavailable" (EAGAIN) if this is set
+too low for your application. See /usr/src/sys/netinet/in.h for more
+discussion.
+.Pp
+The
 .Em kern.ipc.somaxconn
 sysctl limits the size of the listen queue for accepting new tcp connections.
 The default value of 128 is typically too low for robust handling of new
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: silby 
State-Changed-When: Mon Mar 18 17:43:47 PST 2002 
State-Changed-Why:  
Good point, that probably was the reason the benchmark failed at  
3000 connections. 

I'll commit this patch (with a few additions) soon. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32041 
State-Changed-From-To: analyzed->closed 
State-Changed-By: dillon 
State-Changed-When: Sun Dec 8 17:06:51 PST 2002 
State-Changed-Why:  
Closed by request, recent changes to tuning(7) covers the port range 
issue nicely. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32041 
>Unformatted:
