Re: Sendmail 8.9.0 claims a Linux kernel bug

Richard B. Johnson (root@chaos.analogic.com)
Thu, 25 Jun 1998 08:55:49 -0400 (EDT)


On Thu, 25 Jun 1998, Rogier Wolff wrote:

> Richard B. Johnson wrote:
> >
> > lotherend = socksize;
> > do {
> > t = accept(DaemonSocket,
> > (struct sockaddr *)&RealHostAddr, &lotherend);
> > while (t < 0);
> >
>
> The "existing" code in sendmail implies that someone had problems with
> this going into an infinite CPU-consuming loop.
>
>
> Roger.

I think it's worse than that. I think somebody thought that they could
do a better job of networking than the kernel itself. If the above code
goes into an infinite loop, there is something wrong with the socket,
like it wasn't bound to an address (should have been checked previously),
or something wrong with the code (value of 'lotherend' wrong). Once
the code is known to work, the other junk that was probably added to
find coding errors, should have been removed.

There has been a problem with BSD documentation that seems to imply that
you can't use the same socket twice in accept(). However, what the
documentation (and the code) says, is that you can't use the returned
connected socket for a subsequent accept(). It also states that the
caller's socket remains "open", i.e., its status has not been changed.

It is prefectly correct to wait "forever" for a connection. When a
connection has been established, the struct sockaddr_in structure
and its length is modified. Therefore, you can't accept any new
connections using this modified structure. The structure needs to
be rebuilt and the length modified before calling accept again. However
the original socket that has already been bound to an address can be
used forever. Most BSD socket network code I've seen closes this socket
and then opens a new one which is not efficient.

Cheers,
Dick Johnson
***** FILE SYSTEM MODIFIED *****
Penguin : Linux version 2.1.105 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu