Commit Graph

44 Commits

Author SHA1 Message Date
Xiang Xiao
6e6c670190 Move _SF_BOUND and _SF_CONNECTED modification to common place 2020-01-31 13:45:14 -06:00
Xiang Xiao
6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
liuhuahang
ce634578dd This change implements the SO_ERROR socket option that is used to obtain the last error reported by the network.
Squashed commit of the following:

Author: Gregory Nutt <gnutt@nuttx.org>

    net/: Trivial changes to PR from review.  Biggest difference:  type of s_error changed to int16_t to save a byte or two.

Author: liuhuahang <liuhuahang@xiaomi.com>

    Implement SO_ERROR for getsockopt()
2019-12-24 08:09:55 -06:00
Gregory Nutt
b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt
2c2aa94b7d Squashed commit of the following:
net/: psock_recvfrom() is an internal interface and should not set the errno nor should it be a cancellation point.

    net/: psock_accept() is not a cancellation point.

    net/: psock_getsockopt() and psock_socket*9 are an internal interfaces and should not set the errno.

    net/: psock_getsockopt() is an internal interface and should not set the errno.

    net/: psock_listen() is an internal interface and should not set the errno.

    net/: psock_connect(( is an internal interface and should not set the errno nor should it be a cancellation point.

    net/: psock_bind() is an internal interface and should not set the errno.

    net/: psock_accept() is an internal interface and should not set the errno.
2017-09-30 08:18:08 -06:00
Gregory Nutt
cca15891c9 Networking: Fix some errors found by Coverity 2017-09-13 13:04:26 -06:00
Gregory Nutt
85b1ae4cf0 Socket interface: Added bind() and connect() interfaces. 2017-07-13 09:28:18 -06:00
Gregory Nutt
755b05ff30 TCP/IPv6: Fix a compile issue when IPv6, but not IPv4 is enabled. 2017-03-31 10:45:39 -06:00
Jussi Kivilinna
cd3c9634c8 Add user-space networking stack API (usrsock)
User-space networking stack API allows user-space daemon to
provide TCP/IP stack implementation for NuttX network.

Main use for this is to allow use and seamless integration of
HW-provided TCP/IP stacks to NuttX.

For example, user-space daemon can translate /dev/usrsock
API requests to HW TCP/IP API requests while rest of the
user-space can access standard socket API, with socket
descriptors that can be used with NuttX system calls.
2017-03-31 08:58:14 -06:00
Gregory Nutt
b52e4e5ecd Move cancellation point definitions to their own header file. 2016-12-10 09:08:26 -06:00
Gregory Nutt
bc3ca25cc7 Cancellation points: Close up some logic to eliminte some race conditions. 2016-12-10 08:36:58 -06:00
Gregory Nutt
16be9b332e More cancellation points 2016-12-09 15:17:58 -06:00
Gregory Nutt
7467329a98 Eliminate CONFIG_NO_NOINTS. Lots of files changed -> lots of testing needed. 2016-12-03 16:28:19 -06:00
Gregory Nutt
2d057c28c8 net: Disable priority inheritance on all semaphores used for signaling 2016-11-03 12:17:02 -06:00
Gregory Nutt
43eb04bb8f Without lowsyslog() *llinfo() is not useful. Eliminate and replace with *info(). 2016-06-20 11:59:15 -06:00
Gregory Nutt
86b79b33cf Reserver the name 'err' for other purposes 2016-06-11 14:40:07 -06:00
Gregory Nutt
fc3540cffe Replace all occurrences of vdbg with vinfo 2016-06-11 11:59:51 -06:00
Gregory Nutt
6209c51206 net/: More clean-up of spacing/alignment issues 2015-10-08 15:10:04 -06:00
Gregory Nutt
b1e09d4847 net/socket and net/tcp: Fix a problem in whent there are multiple network devices. Polls were being sent to all TCP sockets before. This is not good because it means that packets may sometimes be sent out on the wrong device. That is inefficient because it will cause retransmissions and bad performance. But, worse, when one of the devices is not Ethernet, it will have a different MSS and, as a result, incorrect data transfers can cause crashes. The fix is to lock into a single device once the MSS is locked locked down. 2015-08-27 09:06:46 -06:00
Gregory Nutt
530d229361 net/udp: Add support for send() with connected UDP sockets 2015-08-11 19:17:55 -06:00
Gregory Nutt
fca919f3d2 Networking: Fix some compilation issues noted with network is build with CONFIG_BUILD_KERNEL 2015-07-05 11:18:56 -06:00
Gregory Nutt
e22deff1ab TCP connect. Move the location where the socket is marked as connected in order to avoid a potential race condition 2015-05-31 12:24:24 -06:00
Gregory Nutt
b493dde4cf TCP networking: In the TCP connection operation, it was trying to setup the network monitor BEFORE the socket was successfully connected. This, of course, has ALWAYS failed because the socket is not yet connected and the TCP state is not yet correct for a connected socket. However, because of other changes net_startmonitor(0 no returns a failure condition that causes worse problems when trying to connect. The fix is to move the logic that starts the network monitor to AFTER the socket has been successfully connected. 2015-05-31 11:35:28 -06:00
Gregory Nutt
04a661a97c TCP networking: Add support for network driver events 2015-05-30 09:12:27 -06:00
Gregory Nutt
01d176af76 net_startmonitor.c always returned zero. In the case where a socket has already been closed, it correctly handled the disconnetion event but still returned OK. Returning OK causes the callers of net_startmonitor to assume that the connection was okay, undoing the good things that net_startmonitor did and causing the socket to be marked as connected. This behavior was noted by Pelle Windestam. 2015-05-28 08:23:51 -06:00
Gregory Nutt
0fc8d2fcc5 Unix domain: Add options to build in stream or datagram support separately 2015-01-31 07:58:51 -06:00
Gregory Nutt
62b706fa68 If a Unix domain socket is non-blocking, then the underlying FIFO should also be opened non-blocking 2015-01-30 12:43:37 -06:00
Gregory Nutt
ca2102febb Unix domain: A few fixes from early integration 2015-01-27 16:39:30 -06:00
Gregory Nutt
cbf0608513 Various fixes to get Unix domain sockets to build on the simulator without Ethernet 2015-01-27 14:11:46 -06:00
Gregory Nutt
c3f2023089 Networking: Add local Unix domain socket connection logic 2015-01-25 12:37:40 -06:00
Gregory Nutt
1c8dae4eee Correct calculation of initial MSS 2015-01-22 12:29:49 -06:00
Gregory Nutt
b187b4f381 Networking: Straighten up use if IPv6/IPv4 in TCP connection logic 2015-01-17 15:17:35 -06:00
Gregory Nutt
b80cdb3880 Fix a few warnings introduced with the last commit 2015-01-17 14:25:40 -06:00
Gregory Nutt
8f8259a0d6 Networking: UDP and TCP MSS depends on the IP header size (as well as the link layer header size) and cannot be represented with a single value. 2015-01-16 15:03:10 -06:00
Gregory Nutt
08de18c1a6 Network: Various fixes for clean compile with both Ethernet and SLIP 2014-11-15 13:52:39 -06:00
Gregory Nutt
2e55db369d Network: All logic will now handle varialbe length link layer protocol headers within incoming packets. This permits use of multiple network interfaces with differing data links. For example, ETHERNET + SLIP 2014-11-15 13:13:23 -06:00
Gregory Nutt
73f3ecf7e2 NET: Rename network interrupt event flags more appropriately: TCP_, UDP_, ICMP_, or PKT_ vs UIP_ 2014-07-06 17:22:02 -06:00
Gregory Nutt
2d52d70d4c NET: Move private definitions from include/nuttx/net/tcp to net/tcp/tcp.h 2014-07-06 12:34:27 -06:00
Gregory Nutt
60246e613b NET: emoved all includes of uip.h; added includes of ip.h wherever needed. Tried to fix problems of the now missing sneak inclusions because uip.h was removed. There are probably a few of these that were missed. 2014-07-04 19:13:08 -06:00
Gregory Nutt
a6b39d1879 NET: in-progress change... don't use 2014-07-04 16:38:51 -06:00
Gregory Nutt
fa68fcc843 NET: Rename uip_callback_s to devif_callback_s 2014-06-29 12:59:34 -06:00
Gregory Nutt
8e706eb4ff Rename many functions in net/devif from uip_* to devif_* 2014-06-28 18:36:09 -06:00
Gregory Nutt
5790c94ba3 Rename net/uip to net/devif. Rename uip/uip.h to devif/devif.h 2014-06-28 18:07:02 -06:00
Gregory Nutt
76fa58ee00 Move all socket-related files from net/ to net/socket. Move net/net.h to net/socket/socket.h 2014-06-28 17:25:18 -06:00