Skip site navigation (1)Skip section navigation (2)
Date:      13 Jun 1999 17:46:13 +0200
From:      Dag-Erling Smorgrav <des@flood.ping.uio.no>
To:        Brian Feldman <green@unixhelp.org>
Cc:        Dag-Erling Smorgrav <des@flood.ping.uio.no>, hackers@FreeBSD.ORG
Subject:   Re: select(2) breakage
Message-ID:  <xzp7lp8t86y.fsf@flood.ping.uio.no>
In-Reply-To: Brian Feldman's message of "Sun, 13 Jun 1999 11:01:26 -0400 (EDT)"
References:  <Pine.BSF.4.10.9906131100140.26380-100000@janus.syracuse.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

BTW, you should check for errno == EINTR when select() returns -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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzp7lp8t86y.fsf>