Commit Graph

13 Commits

Author SHA1 Message Date
Gregory Nutt
706a6a2c19 Trivial typo fixes 2018-06-23 06:20:25 -06:00
Gregory Nutt
daa04c2eae net/udp: Fix yet another confusion between raddr and laddr introduced in a recent change. 2018-06-22 10:14:47 -06:00
Gregory Nutt
66db9f09f6 Fix a typo introduced in 1b6990b69f. Also some minor design improvment. 2018-06-22 10:09:47 -06:00
Gregory Nutt
1b6990b69f net/udp: When sending a broadcast (or multicast) packet do not attempt to look up the device by the destination IP address. Rather, use the locally bound address for these cases to select the correct network device. 2018-06-22 08:19:17 -06:00
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
Gregory Nutt
bd7c84b23e Remove CONFIG_NETDEV_MULTINIC. This increases code size by a little, but greatly reduces the complexity of the network code. 2017-08-08 14:24:12 -06:00
Gregory Nutt
2ada7d5892 IPv6: Remove comparisons to the address with all ones set. IPv6 does not support broadcast addresses and certainly not in that form. Replace with multicast addresses beginning with 0xff02. 2017-08-07 11:50:50 -06:00
Gregory Nutt
d5207efb5a Be consistent... Use Name: consistent in function headers vs Function: 2017-04-21 16:33:14 -06:00
Gregory Nutt
b0ea870bcc Remove some empty code section comments 2016-02-25 18:34:36 -06:00
Gregory Nutt
04a661a97c TCP networking: Add support for network driver events 2015-05-30 09:12:27 -06:00
Gregory Nutt
ab50e9d04d Networking: Get rid of g_ipv4_allzeroaddr and g_ipv4_alloneaddr. It is more efficient and more intuitive to use INADDR_ANY and INADDR_BROADCAST 2015-05-29 15:16:11 -06:00
Gregory Nutt
34509a9ad5 UDP should use dev=NULL if the address in the lookup is INADDR_ANY 2015-05-29 14:56:44 -06:00
Gregory Nutt
2102892e7b Fix missing file and some compilation errors from the last UDP committ 2015-05-29 10:45:41 -06:00