nuttx/net/inet
Gregory Nutt fb8cf9373c net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering.
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().
2018-05-13 09:57:34 -06:00
..
inet_close.c Standardization of some function headers. 2018-03-13 09:52:27 -06:00
inet_globals.c Networking: Fix a compilation issue with CONFIG_NET_ICMPv6_AUTOCONF=y 2017-08-09 18:08:28 -06:00
inet_recvfrom.c net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00
inet_setipid.c networking: Move a little more to the inet/ subdirectory. 2017-08-07 13:03:23 -06:00
inet_sockif.c net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00
inet.h Standardization of some function headers. 2018-03-13 09:52:27 -06:00
ipv4_getsockname.c Standardization of some function headers. 2018-03-13 09:52:27 -06:00
ipv6_getsockname.c Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Kconfig
Make.defs Networking: Move two more TCP specific files from inet/ to tcp/. There is other TCP-specific logic in inet/ that should be moved sometime, but those are more entangled. 2017-08-29 09:25:22 -06:00