In connection-mode UDP sockets, a remote address is retained in the UDP connection structure. This determines both there send() will send the packets and which packets recv() will accept.
This same mechanism is used for connection-less UDP sendto: A temporary remote address is written into the connection structure to support the sendto() operation. That address persists until the next recvfrom() when it is reset to accept any address.
When UDP read-ahead buffering is enabled, however, that means that the old, invalid remote address can be left in the connection structure for some time. This can cause read-ahead buffer to fail, dropping UDP packets.
Shortening the time between when he remote address is reset (i.e., immediately after the sendto() completes) is not a solution, that does not eliminate the race condition; in only makes it smaller.
With this change, a flag was added to the connection structure to indicate if the UDP socket is in connection mode or if it is connection-less. This change effects only UDP receive operations: The remote address in the UDP connection is always ignored if the UDP socket is not in connection-mode.
No for connection-mode sockets, that remote address behaves as before. But for connection-less sockets, it is only used by sendto().
Squashed commit of the following:
net/icmp: Finishes off icmp_recvfrom().
net/icmp: Add readahead support for IPPROTO_ICMP sockets.
net/icmp: Add poll() support for IPPROTO_ICMP sockets.
net/icmp: Add a connection structure for IPPROTO_ICMP sockets.
net/icmp: Implements sendto for the IPPROTO_ICMP socket.
net/icmp: Move icmp_sendto() and icmp_recvfrom() to separate files. They are likely to be complex (when they are implemented).
net/icmp: Hook IPPROTO_ICMP sockets into network. Fix some naming collisions. Still missing basic ICMP send/receive logic.
configs: apps/system/ping current need poll() enabled.
configs: All defconfig files that use to enable low-level support must now enabled CONFIG_SYSTEM_PING.
net/icmp: Adds basic build framework to support IPPROTO_ICMP sockets.
sched/semaphore: Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable. Changed all references to sem_post in the OS to nxsem_post().
sched/semaphore: Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable. Changed all references to sem_destroy() in the OS to nxsem_destroy().
libc/semaphore and sched/semaphore: Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable. Changed all references to sem_setprotocol in the OS to nxsem_setprotocol(). sem_getprotocol() was not used in the OS