inetd needs "discard" service in /etc/services

Brooks Davis brooks at one-eyed-alien.net
Thu Mar 11 17:05:00 PST 2004


While updating my diskless setup, I was trying to determine the minimal
set of entries required in /etc/services in addition to a NIS "+" line
to get a system to boot cleanly.  I discovered that inetd depends on the
existence of the discard service.

The dependency is due to the fact that getaddrinfo is used to generate
sockaddr_in(6) struct's and it's not really up to the task when we know
neither the hostname or the service name.  For some reason, discard was
picked when IPv6 support was added and it's remained ever sense.  A
better organization of the code could work around this problem one of
several ways, but that's more work then I want to do at this time.

There also appears to be a secondary bug, probably in getaddrinfo that
means that even though we can look discard up in NIS when inetd is
started, it isn't being resolved there by getaddrinfo.

I would like to commit the following patch.  It changes the port from
discard to syslog and documents the dependency.  I choose syslog because
it really does need to be in /etc/services on most machines since it
starts before NIS.  I'll also file a PR against inetd in hopes that
someone gets board enough to fix it some day.

Any objections?

-- Brooks

Index: inetd.8
===================================================================
RCS file: /usr/cvs/src/usr.sbin/inetd/inetd.8,v
retrieving revision 1.78
diff -u -p -r1.78 inetd.8
--- inetd.8	29 Feb 2004 15:49:26 -0000	1.78
+++ inetd.8	12 Mar 2004 00:55:54 -0000
@@ -919,3 +919,13 @@ The
 .Fx
 TCP Wrappers support first appeared in
 .Fx 3.2 .
+.Sh BUGS
+The
+.Nm
+utility requires that the
+.Qq syslog
+service be defined in
+.Pa /etc/inetd.conf
+unless the
+.Fl a
+argument is given.
Index: inetd.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/inetd/inetd.c,v
retrieving revision 1.123
diff -u -p -r1.123 inetd.c
--- inetd.c	30 Oct 2003 22:56:44 -0000	1.123
+++ inetd.c	12 Mar 2004 00:51:19 -0000
@@ -404,7 +404,7 @@ main(int argc, char **argv)
 	 *   hostname or servname is non NULL.
 	 *   So when hostname is NULL, set dummy value to servname.
 	 */
-	servname = (hostname == NULL) ? "discard" /* dummy */ : NULL;
+	servname = (hostname == NULL) ? "syslog" /* dummy */ : NULL;
 
 	bzero(&hints, sizeof(struct addrinfo));
 	hints.ai_flags = AI_PASSIVE;

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20040311/75a44ad7/attachment.bin


More information about the freebsd-hackers mailing list