Subject: bin/3347: inetd closes file descriptor for the service marked as stream
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@ba2.so-net.or.jp>
List: netbsd-bugs
Date: 03/18/1997 12:03:37
>Number:         3347
>Category:       bin
>Synopsis:       Inetd closes file descriptor for the service marked as stream and wait, and select without opening again.  Also, (child) inetd fails to get client address if stream and wait.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 17 19:20:02 1997
>Last-Modified:
>Originator:     enami tsugutomo
>Organization:
	an individual
>Release:        NetBSD-current 1997 Mar. 15
>Environment:
System: NetBSD pavlov.enami.ba2.so-net.or.jp 1.2C NetBSD 1.2C (PAVLOV) #193: Sat Mar 15 12:39:45 JST 1997 enami@pavlov.enami.ba2.so-net.or.jp:/b/netbsd/kernel/compile/PAVLOV i386


>Description:
	Inetd closes file descriptor for the service marked as stream
	and wait, and select without opening again.  As a result, after
	the service exit, select fails repeatedly.

	Also, (child) inetd fails to get client address if stream and
	wait.

>How-To-Repeat:
	For example, enable identd in inetd.conf like this:
ident		stream	tcp	wait	nobody.kmem /usr/libexec/identd	identd -w -t60 -l -o -e -N

	Then, connect to it and watch log file.  Here is output of my
	/var/log/messages file.

Mar 15 17:38:00 pavlov /netbsd: /b: optimization changed from SPACE to TIME
Mar 15 18:00:02 pavlov syslogd: restart
Mar 15 19:20:16 pavlov innd: ME descriptors 64
Mar 15 19:20:16 pavlov innd: ME outgoing 51
Mar 15 19:20:16 pavlov inetd[26121]: warning: can't get client address: Socket is not connected
Mar 15 19:20:17 pavlov innd: ME ccsetup control:11
Mar 15 19:20:17 pavlov innd: ME lcsetup localconn:13
Mar 15 19:20:17 pavlov innd: ME rcsetup remconn:4
Mar 15 19:20:17 pavlov innd: overview spawned overview:16:proc:26128
Mar 15 19:20:17 pavlov innd: news01.so-net.or.jp opened news01.so-net.or.jp:15:file
Mar 15 19:20:17 pavlov innd: ME starting
Mar 15 19:20:17 pavlov identd[26131]: Connection from king-show
Mar 15 19:21:02 pavlov nnrpd[26927]: plants-doll.enami.ba2.so-net.or.jp connect
Mar 15 19:21:19 pavlov inetd[139]: select: Bad file descriptor
Mar 15 19:21:50 pavlov last message repeated 31 times
Mar 15 19:23:51 pavlov last message repeated 121 times
Mar 15 19:33:52 pavlov last message repeated 598 times
Mar 15 19:34:56 pavlov last message repeated 65 times

>Fix:
	This seems to because inetd is changed to close file descriptor
	just if it is stream (previously, it is closed if stream and nowait).
	But still pass to select after the server exited.

	Just backout changes or reopen file descriptor?
>Audit-Trail:
>Unformatted: