Commit Graph

48 Commits

Author SHA1 Message Date
Gregory Nutt 9400cf2cd1 sched/group: On task creation, do not clone uninitialized descriptors.
Sockets are created in two steps:

1. The socket is allocated, then
2. The socket is initialized.

In SMP mode, there is a possibility that a pthread executing one CPU may create a new task while a pthread on another CPU has allocated the socket but not yet initialized it.  This commit updates the socket clone test to assure that the socket is both allocated and initailized.

Without the change, it is possible that uninitialized sockets could be cloned, leading to errors later in the newly started task.
2020-04-28 21:27:05 +01:00
Gregory Nutt 6941f916ce net/socket: For consistency in naming, change the name of sock_release() to psock_release(). 2018-11-27 07:50:09 -06:00
Gregory Nutt b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt e4dd33280d Squashed commit of the following:
psock_close() and net_close() are internal OS functions and should not set the errno variable.

    psock_ioctl() and netdev_ioctl() are internal OS functions and should not set the errno variable.

    net_dupsd() and net_dupsd2() are internal OS functions and should not set the errno variable.

    net/ and fs/: net_vfcntl(), file_fcntl(), file_dup(), and file_dup2() are all internal OS interfaces and should not modify the errno value.
2017-09-30 10:41:21 -06:00
Gregory Nutt 833ee2275d Socket interface: Added close() interface. 2017-07-13 12:15:15 -06:00
Gregory Nutt d5207efb5a Be consistent... Use Name: consistent in function headers vs Function: 2017-04-21 16:33:14 -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 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 2a751068e6 Without lowsyslog() *llerr() is not useful. Eliminate and replace with *err(). 2016-06-20 12:44:38 -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 f4fcdcdb4d net/: Change some *err() message to *info() messages if what was a *dbg() message does not indicate and error condition. 2016-06-11 17:37:21 -06:00
Gregory Nutt e99301d7c2 Rename *lldbg to *llerr 2016-06-11 14:55:27 -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 4f208600aa Replace confusing references to uIP with just 'the network' 2016-05-30 09:31:44 -06:00
Gregory Nutt 2c95fef501 Remove some empty code section comments 2016-02-26 07:35:55 -06:00
Gregory Nutt 8db55f6493 Back out most of previous commit 2016-02-26 06:45:37 -06:00
Gregory Nutt 0b441ff1f4 net/: Add basic IEEE 802.15-4 socket support 2016-02-25 14:01:22 -06:00
Andrew Webster 4875c6bbe3 TCP: check for connection before deleting it
It is possible for a socket to have no connection, for example if a TCP
socket is waiting in accept.  This checks for this condition in case the
socket is closed from a different thread.
2016-01-22 15:59:15 -06:00
Andrew Webster f1ef2c6cde TCP: attempt to flush the write buffers before closing
When a socket is closed, it should make sure that any pending write
data is sent before the FIN is sent.  It already would wait for all
sent data to be acked, however it would discard any pending write
data that had not been sent at least once.

This change adds a check for pending write data in addition to unacked
data.  However, to be able to actually send any new data, the send
callback must be left.  The callback should be freed later when the socket
is actually destroyed.
2016-01-22 15:58:02 -06:00
Gregory Nutt f348e68069 Update to use 64-bit timer when available 2016-01-21 11:54:26 -06:00
Gregory Nutt 6209c51206 net/: More clean-up of spacing/alignment issues 2015-10-08 15:10:04 -06:00
Gregory Nutt cc340aaa92 TCP networking: Since the network monitor now allocates a callback structure, it is critical to make sure that the networking monitor is stopped when the socket is closed or any other loss of connection. What was innocuous before would now be a memory leak 2015-05-30 11:49:55 -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 b756df982d net/: Lots of build problems introduced into multiple NIC support. Many places where conditional logic based on CONFIG_NETDEV_MULTINIC is confused with CONFIG_NET_MULTILINK. Lots of code changed with IPv6 that was never compiled with MULTINIC enabled. Still some problem with parameter passing. 2015-02-09 18:15:34 -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 c3f2023089 Networking: Add local Unix domain socket connection logic 2015-01-25 12:37:40 -06:00
Gregory Nutt 3b64518049 Networking: A litle more Unix domain socket logic 2015-01-25 07:36:16 -06:00
Gregory Nutt 666ee755da Hook local socket functions into socket creation and close logic 2015-01-24 15:19:50 -06:00
Gregory Nutt cfbe12adb2 Networking: Fix some errors detected by Travis in configuration that have TCP on and UDP off and vice versa 2015-01-17 17:00:19 -06:00
Gregory Nutt 820509eadc Networking: Fix accept() so that it returns the correct IP address for the selected socket IP domain. 2015-01-17 09:27:05 -06:00
Gregory Nutt 4ad5998db3 net/socket and net/tcp: When we are ready to receive data or when we have outgoing data ready to be sent, we need to the notify the appropriate device driver of this condition. The notifying socket will be configured as either PF_INET or PF_INET6 and must look up the correct driver using the correct IP domain. 2015-01-17 08:33:14 -06:00
Gregory Nutt 5e938941a6 Networking: Replace all references to net_ipaddr_t with either in_addr_t on net_ipv6addr_t. The goal is to support both IPv4 and IPv6 simultaneously. This requires that the two types be distinct and not conditionally typedef'ed to net_ipaddr_t. 2015-01-16 12:30:18 -06:00
Gregory Nutt bee89be4f4 Networking: Drivers can have both IPv4 and IPv6 addesses, but a socket can only only one or the other; The socket connnection structures need to include a union of IPv4 and IPv6 addresses for the local address binding and for the remote address connections 2015-01-16 10:01:54 -06:00
Gregory Nutt b36dbe1d89 Add logic to netdev_findbyaddr() to return the correct network device for the case where a broadcast address is used. This change caused trivial ripples through other files because additional parameters are required for netdev_findbyaddr() when CONFIG_NET_MULTINIC 2014-11-23 11:00:22 -06:00
Gregory Nutt caba61999a Remove CONFIG_DISABLE_CLOCK 2014-08-07 12:35:24 -06:00
Gregory Nutt cab24a4bd8 Add inclusion of assert.h to so files that use DEBUGASSERT 2014-07-21 18:46:47 -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 b77fda2c95 NET: Rename TCP state values: UIP_ -> TCP_ 2014-07-06 16:10:26 -06:00
Gregory Nutt 47a502a5e2 NET: Most of the contents of include/nuttx/net/udp.h moved to net/pkt/udp.h 2014-07-05 14:40:29 -06:00
Gregory Nutt dc8cba763d NET: Most of the contents of include/nuttx/net/pkt.h moved to net/pkt/pkt.h 2014-07-05 13:59:22 -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