UDP recvmsg blocks after select(), 2.6 bug?
Quoted 11 lines · Joris
Quoted 1 line · Andries Brouwer
Does this really happen?
Yes. Finally got my raw-udp-with-wrong-checksum sending program to work over localhost and it hangs recvfrom pretty good.
Quoted 1 line
All kernel versions?
Quick guess: probably since late 2.4. Source of 2.4.27
udp.cis similar to 2.6.9, but 2.4.17 returns EAGAIN even for blocking sockets, apparently this was "fixed" later on.
It would be nice to know how other operating systems behave when receiving UDP packets with bad checksums. Can someone try BSD and Solaris?
- Dan
Signature · 2 lines
My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change
Quoted 3 lines · Dan Kegel
It would be nice to know how other operating systems behave when receiving UDP packets with bad checksums. Can someone try BSD and Solaris?
It does not matter - this behaviour should not be depended upon. There are lots of other reasons why a packet might in fact not be available, kernels are allowed to drop UDP packets at will.
Signature · 2 lines
http://www.PowerDNS.com Open source, database driven DNS Software http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Quoted 9 lines · bert hubert
Quoted 3 lines · Dan Kegel
It would be nice to know how other operating systems behave when receiving UDP packets with bad checksums. Can someone try BSD and Solaris?
It does not matter - this behaviour should not be depended upon. There are lots of other reasons why a packet might in fact not be available, kernels are allowed to drop UDP packets at will.
I've been lurking and reading this thread with great interest. I had been leaning towards thinking the kernel was wrong, until I read this email.
This is a very excellent point.
From: "Adam Heath" <[email protected]>
Sent: Thursday, October 07, 2004 09:28
Quoted 8 lines · bert hubert
Quoted 7 lines · Dan Kegel
Quoted 4 lines
It would be nice to know how other operating systems behave when receiving UDP packets with bad checksums. Can someone try BSD and Solaris?
Quoted 8 lines
Quoted 3 lines
It does not matter - this behaviour should not be depended upon. There are lots of other reasons why a packet might in fact not be available, kernels are allowed to drop UDP packets at will.
I've been lurking and reading this thread with great interest. I had been leaning towards thinking the kernel was wrong, until I read this email.
This is a very excellent point.
No, it isn't. If the kernel drops a UDP packet, select() should not return indicating available data.
--ms
Quoted 11 lines · Martijn Sipkema
Quoted 8 lines
Quoted 3 lines
It does not matter - this behaviour should not be depended upon. There are lots of other reasons why a packet might in fact not be available, kernels are allowed to drop UDP packets at will.
I've been lurking and reading this thread with great interest. I had been leaning towards thinking the kernel was wrong, until I read this email.
This is a very excellent point.
No, it isn't. If the kernel drops a UDP packet,
select()should not return indicating available data.
The kernel can drop a packet after select() returns, and before read() is called. That's the whole point of *U*DP.
From: "Adam Heath" <[email protected]>
Sent: Thursday, October 07, 2004 11:07
Quoted 9 lines · Martijn Sipkema
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
It does not matter - this behaviour should not be depended upon. There are lots of other reasons why a packet might in fact not be available, kernels are allowed to drop UDP packets at will.
I've been lurking and reading this thread with great interest. I had been leaning towards thinking the kernel was wrong, until I read this email.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
This is a very excellent point.
No, it isn't. If the kernel drops a UDP packet,
select()should not return indicating available data.The kernel can drop a packet after
select()returns, and beforeread()is called. That's the whole point of *U*DP.
I don't think that is the point of UDP and I don't think the kernel should do that, but there are two options for handling this:
If recvmsg() blocks until valid data is available then so should select(). If recvmsg() returns an error on invalid data then select() would indicate the socket() as ready without knowing if the data was valid.
--ms