Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 1999 11:59:55 -0400 (EDT)
From:      Brian Feldman <green@unixhelp.org>
To:        Dag-Erling Smorgrav <des@flood.ping.uio.no>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: select(2) breakage
Message-ID:  <Pine.BSF.4.10.9906131150400.27047-100000@janus.syracuse.net>
In-Reply-To: <xzp7lp8t86y.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On 13 Jun 1999, Dag-Erling Smorgrav wrote:

> Brian Feldman <green@unixhelp.org> writes:
> > On 13 Jun 1999, Dag-Erling Smorgrav wrote:
> > > connect() normally uses the 1024-5000 range. Try the following:
> > > 
> > > # sysctl -w net.inet.ip.portrange.last=40000
> > > 
> > > and see if it solves the EAGAIN problem.
> > 
> > Actually, this is the perfect explanation. I think that this should go in
> > the FAQ. Why in the world are we limiting the ports we can use other than
> > from 1-1023?
> 
> I have no idea. The only use I've ever had for this is the
> predictability of FTP data port numbers, since ftpd will normally use
> the high range (49152-65535). Useful for designing firewalls, and if
> you don't like opening such a wide port range, you can whittle it down
> to a handful (say, one thousand) of ports with judicious use of sysctl.
> 
> I couldn't find any reference to this in RFC 793, 1122, 1123, 1700 or
> 2577. Remind me to build a glimpse index of my RFC collection...
> 
> This still doesn't explain select()'s failure to time out, although I
> should point out that you forgot to increase FD_SETSIZE before
> including <sys/types.h>, and I'm not sure your computation of
> highestsock is correct, since there's no guarantee that fdvec is
> sorted. I haven't tested your code though, I just looked over it
> quickly.

I have two copies. One has FD_SETSIZE increased to 30004 and a vector size
of 30000. The other has FD_SETSIZE default (1024) and a vector of 512.
The guarantee of fdvec is sorted is that Unix behavior is to allocate the
next available fd, so highestsock is correct. The program is correct,
except I didn't have a linefeed in the select() status printing, so it DID
time out successfully, but you didn't see the status report.

> 
> BTW, you should check for errno == EINTR when select() returns -1.

The perror() is the status report for select() when -1.

> 
> DES
> -- 
> Dag-Erling Smorgrav - des@flood.ping.uio.no
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 

 Brian Feldman                _ __ ___ ____  ___ ___ ___  
 green@unixhelp.org                _ __ ___ | _ ) __|   \ 
     FreeBSD: The Power to Serve!      _ __ | _ \._ \ |) |
         http://www.freebsd.org           _ |___/___/___/ 
 "<green_> THAT'S WRONG WRONG WRONG!"



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9906131150400.27047-100000>