nuttx/net/udp
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
..
Kconfig net/udp: UDP write buffering is basically functional but needs a lot more verification. 2018-01-23 07:32:17 -06:00
Make.defs net/udp: Remove an unused variable warning. Add some comments. 2018-04-27 18:26:38 -06:00
udp_callback.c networking: IGMP: Remove special support for interrupt level processing (there is none) and fix some timer cancellation logic. In many files, correct comments. There is no interrupt level processing in the networking layer. 2017-09-02 10:27:03 -06:00
udp_conn.c net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00
udp_devpoll.c Standardization of some function headers. 2018-03-13 09:52:27 -06:00
udp_finddev.c net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00
udp_input.c net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00
udp_ipselect.c Be consistent... Use Name: consistent in function headers vs Function: 2017-04-21 16:33:14 -06:00
udp_netpoll.c net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00
udp_psock_send.c net/udp: Remove an unused variable warning. Add some comments. 2018-04-27 18:26:38 -06:00
udp_psock_sendto_buffered.c net/udp: Remove an unused variable warning. Add some comments. 2018-04-27 18:26:38 -06:00
udp_psock_sendto_unbuffered.c net/udp: Remove an unused variable warning. Add some comments. 2018-04-27 18:26:38 -06:00
udp_send.c net/udp: Fix another related error in UDP condition compilatino (was actually using TCP setting, not UDP setting). 2018-03-30 15:30:45 -06:00
udp_wrbuffer_dump.c This commit adds an as-of-yet untested implemented of UDP write buffering. 2018-01-22 18:32:02 -06:00
udp_wrbuffer.c Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
udp.h net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00