Subject: Re: Merging entries from the IANA services list
To: NetBSD User-Level Technical Discussion List <>
From: Greg A. Woods <>
List: tech-userlevel
Date: 11/09/2006 14:45:25
At Mon, 9 Oct 2006 08:55:18 -0400,
Christos Zoulas wrote:
> On Oct 9,  7:57am, (David Laight) wrote:
> -- Subject: Re: Merging entries from the IANA services list
> | On Mon, Oct 09, 2006 at 04:36:54AM +0000, Christos Zoulas wrote:
> | > 
> | > We should import the whole IANA list.

I've been doing that now for quite a few years (and with /etc/protocols
too).  I don't do the update on as regular a basis as I should (since
I've not yet automated it, and the editing is monotonous).

	$ wc -l /etc/services
	   13978 /etc/services

(I do have a script to build /etc/protocols automatically though, and I
build it as a normal tool installed in /usr/sbin so that updates can be
done by the admin after the OS is delivered and installed.  The same is
intended for /etc/services -- I just need more round-toits.)

> | >  /etc/services can use a db file
> | > now, so the queries are going to be fast...

That would be nice, but I haven't found it to be essential.  In most
cases I think bsearch(3) lookup would be more than sufficient, and much
less resource intensive (i.e. keep two "binary" tables on disk, one for
lookups in each direction, and just mmap() them and bsearc() them).

I do have to keep a trimmed down copy for building boot media with though.

> | Except that it is a royal PINA when it converts dynamically allocated
> | port numbers to the names of procotols you've never heard of and are
> | very unilikely to ever run.
> We can have a file that blacklists ports so that we ignore them when
> we convert the IANA file to services.

That wouldn't work well since the anonymous list is not static.

	net.inet.ip.anonportmin = 49152
	net.inet.ip.anonportmax = 65535

The "Right Thing(tm)" might be to have getservbyport() simply not do any
lookup for a port in the _current_ anonymous range.  (Or is there an
even better way to find out which local ports were assigned as anonymous

						Greg A. Woods

H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <>
Planix, Inc. <>       Secrets of the Weird <>