Re: UDP recvmsg blocks after select(), 2.6 bug?

Chris Friesen
2004-10-07T22:56:37Z

David S. Miller wrote:
> Chris Friesen <cfriesen@nortelnetworks.com> wrote:

>>What I had in mind was that the non-blocking file descriptor have select()
>>return without verifying the checksum, and if it was discovered to be bad at
>>recvmsg() time, we return EAGAIN.
>
>
> That's what we do. In net/ipv4/udp.c:udp_recvmsg()

Yes. I realize this, and agree with that behaviour.

However, you chopped off what I consider the interesting part of my post. I
propose that if we call select() on a blocking file descriptor, we verify the
checksum before saying that the socket is readable. Then, at recvmsg() time, if
it hasn't been checked already we would check it (to allow for the case of
blocking socket without select()).

This allows for easy porting of apps that expect a blocking recvmsg() after
select() to always succeed.

Thus, you end up with:

nonblocking socket -- exactly as current
blocking socket without select -- exactly as current
blocking socket with select -- checksum verified before select() returns

Chris