[Asterisk-Dev] EAGAIN - recvfrom - bad udp checksum

Peter Svensson psvasterisk at psv.nu
Wed Nov 3 03:07:33 MST 2004


On Wed, 3 Nov 2004, Olle E. Johansson wrote:

> Yes, but do you also have insights on FreeBSD and other BSD's - is EAGAIN
> really a signal of a bad UDP checksum there as well or is it another issue?

One of the causes of EAGAIN in linux when reading from a udp socket is 
that the checksum was corrupt. There are other potential sources of that 
particular error message. A signal arriving while in the read handler in 
the kernel is certainly allowed to cause the read to return EAGAIN. 

Then there is the big source of EAGAIN - non blocking sockets. Even an 
indication of readable from select apparently does not guarantee that a 
subsequent read will not return EAGAIN. This has been the source of some 
discussion on the linux-kernel mailing list.

As far as I know Linux is the only os that adds the udp checksum error 
case to the list of possible causes of EAGAIN. All others discard the 
packet silently.

The EAGAIN error should probably be interpreted as that no data is
available this time. Even on linux it can only be used to detect checksum
errors if all other causes are accounted for (such as non-blocking
sockets, no signals etc).

Peter





More information about the asterisk-dev mailing list