Subject: Re: NetBSD's inetd
To: None <tech-net@NetBSD.ORG>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 12/15/1997 12:35:34
> Just looking at inetd.c [...]

> With any gap between [accept and getpeername], there is the potential
> for the remote-end information to be lost if someone sends in a RST.

Then this is a kernel bug.  As long as userland can still potentially
ask for that information, there is no excuse for the kernel to throw it
away regardless of what the peer does.  (Well, okay, "the current code
does it that way" may qualify as an excuse.  I should probably say
there is no _justification_ for such egregious behavior.)

Even if you _do_ get that from accept(), it merely shrinks the window;
it does not eliminate it.  The peer can still complete the three-way
handshake and then RST the connection before user-land wakes up from
select() and gets around to calling accept().

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B