Subject: kern/10880: reserve port allocation scheme needs improvement
To: None <gnats-bugs@gnats.netbsd.org>
From: Matthias Scheler <tron@lyssa.zhadum.de>
List: netbsd-bugs
Date: 08/22/2000 09:04:13
>Number:         10880
>Category:       kern
>Synopsis:       reserve port allocation scheme needs improvement
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 22 09:05:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Matthias Scheler
>Release:        1.5 branch from 2000/08/01
>Organization:
Matthias Scheler                            http://www.sighardstrasse.de/~tron/
>Environment:
NetBSD colwyn.zhadum.de 1.5_ALPHA NetBSD 1.5_ALPHA (COLWYN) #0: Tue Aug  1 07:47:30 CEST 2000     tron@colwyn.zhadum.de:/src/sys/compile/COLWYN i386

>Description:
While entering multi user mode the inetd on a NetBSD 1.5_ALPHA system
complained that it couldn't get the "pop3s" port (995/tcp):

Aug 22 13:49:09 colwyn inetd[2453]: pop3s/tcp: bind: Address already in use

After some investigation I found out that one of the NFS locking daemons
was using that port. After entering "/etc/rc.d/nfslocking stop",
"/etc/rc.d/inetd restart" and "/etc/rc.d/nfslocking start" everything
worked fine again.

Obviously the reserve port selection scheme in the kernel(*) needs to be
improved. I've no real idea how to do it yet. Maybe it should be
possible to set the lowest and highes reserved port via "sysctl".

(*) Yes, it is the kernel which selects the port number. bindresvport(3)
    is *not* implemented via looping through the port ranges but via
    setsockopt(IP_PORTRANGE_LOW) these days.

>How-To-Repeat:
Try to use the port "pop3s" on a system which starts NFS server,
NFS locking and automounter.

>Fix:
Find a better scheme.

>Release-Note:
>Audit-Trail:
>Unformatted: