nuttx/net
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
..
arp Standardization of some function headers. 2018-03-13 09:52:27 -06:00
bluetooth include/nuttx/wireless/bluetooth: Move Bluetooth header files from include/nuttx/wireless to include/nuttx/wireless/bluetooth for symmetry with other wireless technologies. 2018-04-29 12:43:09 -06:00
devif This comment adds (1) basic support for AF_BLUETOOTH sockets. The logic compiles but is still incomplete. Support for Bluetooth is general is still dependent on CONFIG_EXPERMIMENTAL because it is not yet ready for used. 2018-03-31 14:55:03 -06:00
icmp Standardization of some function headers. 2018-03-13 09:52:27 -06:00
icmpv6 Standardization of some function headers. 2018-03-13 09:52:27 -06:00
ieee802154 net/ieee802154: Add some missing logic in connect(). 2018-03-31 09:28:24 -06:00
igmp Standardization of some function headers. 2018-03-13 09:52:27 -06:00
inet net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00
ipforward Standardization of some function headers. 2018-03-13 09:52:27 -06:00
local Standardization of some function headers. 2018-03-13 09:52:27 -06:00
loopback Fix IPv6 loopback driver that depended on the removed g_ipv6_allonesaddr. Noted by Masayuki Ishikawa 2017-08-09 06:59:55 -06:00
neighbor Standardization of some function headers. 2018-03-13 09:52:27 -06:00
netdev include/nuttx/wireless/bluetooth: Move Bluetooth header files from include/nuttx/wireless to include/nuttx/wireless/bluetooth for symmetry with other wireless technologies. 2018-04-29 12:43:09 -06:00
pkt Standardization of some function headers. 2018-03-13 09:52:27 -06:00
procfs Trivial fix in some comments. 2017-09-20 10:06:26 -06:00
route Standardization of some function headers. 2018-03-13 09:52:27 -06:00
sixlowpan net/sixlowpan: Fix a nasty, byte-ordering/endian-ness problem. The root cause has been found and corrected. And a half dozen or so bandaid fixes were reverted. 2018-04-17 15:34:12 -06:00
socket net/socket: Missing semicolon in last fstat() change. 2018-04-30 09:57:43 -06:00
tcp net/udp: Remove an unused variable warning. Add some comments. 2018-04-27 18:26:38 -06:00
udp net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering. 2018-05-13 09:57:34 -06:00
usrsock Standardization of some function headers. 2018-03-13 09:52:27 -06:00
utils Merged in masayuki2009/nuttx.nuttx/fix_smp_bugs (pull request #615) 2018-03-20 12:34:38 +00:00
.gitignore
Kconfig net/Kconfig: Remove some trivial kruft from Kconfig file. 2018-04-03 08:13:11 -06:00
Makefile This comment adds (1) basic support for AF_BLUETOOTH sockets. The logic compiles but is still incomplete. Support for Bluetooth is general is still dependent on CONFIG_EXPERMIMENTAL because it is not yet ready for used. 2018-03-31 14:55:03 -06:00
net_initialize.c This comment adds (1) basic support for AF_BLUETOOTH sockets. The logic compiles but is still incomplete. Support for Bluetooth is general is still dependent on CONFIG_EXPERMIMENTAL because it is not yet ready for used. 2018-03-31 14:55:03 -06:00
README.txt This comment adds (1) basic support for AF_BLUETOOTH sockets. The logic compiles but is still incomplete. Support for Bluetooth is general is still dependent on CONFIG_EXPERMIMENTAL because it is not yet ready for used. 2018-03-31 14:55:03 -06:00

README
======

Directory Structure
===================

  nuttx/
   |
   `- net/
       |
       +- arp        - Address resolution protocol (IPv4)
       +- bluetooth  - PF_BLUETOOTH socket interface
       +- devif      - Stack/device interface layer
       +- icmp       - Internet Control Message Protocol (IPv4)
       +- icmpv6     - Internet Control Message Protocol (IPv6)
       +- ieee802154 - PF_IEEE802154 socket interface
       +- inet       - PF_INET/PF_INET6 socket interface
       +- ipforward  - IP forwarding logic
       +- local      - Unix domain (local) sockets
       +- loopback   - Local loopback
       +- neighbor   - Neighbor Discovery Protocol (IPv6)
       +- netdev     - Socket network device interface
       +- pkt        - "Raw" packet socket support
       +- sixlowpan  - 6LoWPAN implementation
       +- socket     - BSD socket interface
       +- route      - Routing table support
       +- tcp        - Transmission Control Protocol
       +- udp        - User Datagram Protocol
       +- usrsock    - User socket API for user-space networking stack
       `- utils      - Miscellaneous utility functions

    +-------------------------------------------------------------------++------------------------+
    |                     Application layer                             || usrsock daemon         |
    +-------------------------------------------------------------------++------------------------+
    +-------------------------------------------------------------------++----------------+ +-----+
    |                   Socket layer (socket/)                          || /dev/usrsock   | |     |
    +-------------------------------------------------------------------++----------------+ |     |
    +------------++--------------------------------------------------++-------------------+ |     |
    |  Network   || Protocol stacks (arp, ipv6, icmp, pkt, tcp, udp) || usrsock/          | |     |
    |   Device   |+--------------------------------------------------++-------------------+ |     |
    | Interface  |+------------------------------------++---------------------------------+ |     |
    | (netdev/)  ||  Network Device Interface (devif/) || Utilities                       | |     |
    +------------++------------------------------------++---------------------------------+ |     |
    +----------------------------------------------------------------+                      |     |
    |                    Network Device Drivers                      |                      | HAL |
    +----------------------------------------------------------------+                      +-----+
    +----------------------------------------------------------------+ +--------------------------+
    |                    Networking Hardware                         | |  Hardware TCP/IP Stack   |
    +----------------------------------------------------------------+ +--------------------------+