Commit Graph

2043 Commits

Author SHA1 Message Date
Nathan Hartman
a5e643b0cd Fix typos in comments and documentation. 2020-03-16 20:01:11 -06:00
YAMAMOTO Takashi
213c81aebd Fix a typo in kconfig text 2020-03-12 11:38:18 +01:00
chao.an
0376cddd6d net: move the _SF*/_SS* definitions to net.h
Build break caused by 23b8b39799
2020-03-04 21:37:34 -06:00
GAEHWILER Reto
2ba2846ced net/tcp/tcp_input.c: Fix of faulty TCP sequence increments
Sequence numbers must not be incremented in the case of retransmitted packets
2020-03-03 09:15:18 -06:00
Juha Niskanen
f3490e42c3 Fix typos in comments 2020-03-03 09:11:57 -06:00
Nathan Hartman
8ee6be0780 net/icmp/icmp_input.c: Fix memset() implicit decl warning 2020-02-25 12:17:55 -06:00
Gregory Nutt
1f1356a2f5 net/icmp/icmp_input.c: Clear sin_zero
This should have been part of commit 861efdf8a3 but was overlooked.
2020-02-25 09:32:54 -06:00
patacongo
861efdf8a3
net/: Whenever the network initializes an IPv4 address, it must clear sin_zero. 2020-02-25 15:53:39 +01:00
chao.an
42d97079de net/netlink/netlink_route.c: Correct the return value 2020-02-25 07:33:18 -06:00
Alan Carvalho de Assis
d74ca3ab82 Make the tcp_backlog error message clear
The tcp_backlog is used when there is not process running to accept a new connection, but it is limited by the number of allocated backlog containers. The current error message induces the user to believe there is not free memory to allocate a new container, but actually the containers were allocated during the initialization and were available until the last element of the list has been removed to use.
2020-02-24 11:35:01 -06:00
Xiang Xiao
cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao
bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Xiang Xiao
f7ef08cdc1 net/usrsock: Don't return -ESHUTDOWN even usrsockdev_is_opened return false
since usrsock_conn_s::resp::result contain more detailed info and fix the below error in usrsocktest:
Testing group "WakeWithSignal" =>
	[TEST ASSERT FAILED!]
		In function "do_usrsock_blocking_connect_thread":
		line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
			got value: 110
			should be: 113
	[TEST ASSERT FAILED!]
		In function "do_usrsock_blocking_connect_thread":
		line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
			got value: 110
			should be: 113
	[TEST ASSERT FAILED!]
		In function "do_usrsock_blocking_connect_thread":
		line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
			got value: 110
			should be: 113
	[TEST ASSERT FAILED!]
		In function "do_wake_test":
		line 567: Assertion `(bool)((usrsocktest_test_failed)) == (bool)(false)' failed.
			got value: 1
			should be: 0
	Group "WakeWithSignal": [FAILED]
2020-02-22 07:33:01 -06:00
Xiang Xiao
8c8771a29d net/socket: Don't skip return -ENETDOWN in usrsock case
Fix the below error in usrsocktest:
Testing group "WakeWithSignal" =>
	[TEST ASSERT FAILED!]
		In function "do_usrsock_blocking_socket_thread":
		line 122: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((115))' failed.
			got value: 123
			should be: 115
	[TEST ASSERT FAILED!]
		In function "do_wake_test":
		line 567: Assertion `(bool)((usrsocktest_test_failed)) == (bool)(false)' failed.
			got value: 1
			should be: 0
	Group "WakeWithSignal": [FAILED]
2020-02-22 07:30:58 -06:00
Masayuki Ishikawa
e9fe1f84af net: socket: Enable parameter check (addr and addrlen) in getsockname.c
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-02-21 01:43:12 -06:00
chao.an
d07afc934e fcntl: add O_CLOEXEC/FD_CLOEXEC support 2020-02-20 08:20:38 -06:00
chao.an
c65d8e6a23 net/socket: add MSG_DONTWAIT support
MSG_DONTWAIT (since Linux 2.2)
  Enables nonblocking operation; if the operation would block, the
  call fails with the error EAGAIN or EWOULDBLOCK. This provides
  similar behavior to setting the O_NONBLOCK flag (via the fcntl(2)
  F_SETFL operation), but differs in that MSG_DONTWAIT is a per-call
  option, whereas O_NONBLOCK is a setting on the open file description
  (see open(2)), which will affect all threads in the calling process
  and as well as other processes that hold file descriptors referring
  to the same open file description.
2020-02-19 12:21:28 -06:00
Juha Niskanen
15b78abccf Fix typos in comments 2020-02-14 08:50:45 -06:00
Gregory Nutt
0b25b96759 net/netlink/netlink_route.c: Fix a typo. 2020-02-13 15:04:45 -03:00
Gregory Nutt
7409f57d40 net/pkt: Fix inconsistent use of FAR
Also run all .c and .h files through nxstyle (with -m 0)
2020-02-13 15:10:34 +08:00
Gregory Nutt
3c0b49448a Network Loopback Driver: A configuration option to control packet size.
Historically, the loopback driver used the largest packet size of all enabled link layer protocols.  This permitted packets to be forward via the loopbak device with no major loss of performance.  However, in experimenting with configurations where no other link layer protocols were enabled, this means the loopback packet size was set to the smallest possible size, to the SLIP minimum of 296 bytes.  This resulted in terrible loopback performance.

    This commit adds an option to increase the loopback packet size with the option CONFIG_NET_LOOPBACK_PACKETSIZE.

    The loopback driver packet buffer should be quite large.  The larger the loopback packet buffer, the better will be TCP performance of the loopback transfers.  The Linux loopback device historically used packet buffers of size 16Kb, but that was increased in recent Linux versions to 64Kb.  Those sizes may be excessive for resource constrained MCUs, however.

    The network still enforces the lower limit that is the maximum packet size of all enabled link layer protocols.  But this new option permits the loopback packet size to be increased from that.

    * net/Kconfig:  Adds CONFIG_NET_LOOPBACK_PKTSIZE option
    * include/nuttx/net/netconfig.h:  Assures that the packet size that is used is at least as large as the largest packet size of other link layer protocols.
    * drivers/net/loopback.c:  Use that larger packet size.
    * boards/sim/sim/sim/configs/tcploop/defconfig:  Set the loopback packet size to 1500
2020-02-10 22:17:32 -03:00
Gregory Nutt
10721c0826 Kconfig: Move the ARCH_PHY_INTERRUPT option to net/Kconfig and make it
unconditionally selectable.
2020-02-09 00:55:41 +00:00
liuhaitao
5f7a797e89 net/igmp/igmp.h: include <nuttx/semaphore.h> to fix build break
Build nucleo-144/f767-netnsh fail with below error:
In file included from igmp/igmp_initialize.c:54:
./igmp/igmp.h:130:3: error: unknown type name 'sem_t'
  130 |   sem_t                sem;     /* Used to wait for message transmission */
      |   ^~~~~
make[1]: *** [igmp_initialize.o] Error 1

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-02-02 18:33:42 -08:00
Xiang Xiao
c5b1554d84 Remove NETDEV_LOOPBACK option, NET_LOOPBACK is enough 2020-02-02 08:25:06 -06:00
Xiang Xiao
2d7c072723 Remove duplicated NET_SLIP option from drivers/net/Kconfig 2020-02-02 08:24:50 -06:00
Xiang Xiao
5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao
c1b0aa118c Remove psock_send and sockfd_socket from net/socket/socket.h
Since both is already declared in include/nuttx/net/net.h and fix other minor issue in network socket layer.
2020-01-31 13:45:15 -06:00
Xiang Xiao
0fc7668d65 sendto should always call send if to == NULL || tolen <= 0
Since UDP socket may bind the target with connect call
2020-01-31 13:45:15 -06:00
Xiang Xiao
7e67add999 Implment SO_ACCEPTCONN 2020-01-31 13:45:15 -06:00
Xiang Xiao
cf2ddbb2b1 Replace set_errno to _SO_SETERRNO
Missed in a previous commit
2020-01-31 13:45:14 -06:00
Xiang Xiao
6e6c670190 Move _SF_BOUND and _SF_CONNECTED modification to common place 2020-01-31 13:45:14 -06:00
Xiang Xiao
709dc19350 Move the lock from psock_release to sockfd_release
Since the kernel psock doesn't bind to any socketlist
2020-01-31 13:45:14 -06:00
Xiang Xiao
0b860726db Ensure psock_socket and psock_accept initialize s_crefs to 1
This simplifies the caller usage
2020-01-31 13:45:14 -06:00
Xiang Xiao
9f9566c0eb Rename net_clone/net_dupsd[2] to psock_dup2/net_dup[2] like vfs 2020-01-31 13:45:14 -06:00
Xiang Xiao
80277d1630
Refine the preprocessor conditional guard style (#190) 2020-01-31 19:07:39 +01:00
Xiang Xiao
68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Xiang Xiao
b80fb6befc net/utils: Fix the wrong mask calculation in net_ipv6_pref2mask 2020-01-30 07:47:07 -06:00
Xiang Xiao
174df6b793 net/utils/net_dsec2tick.c: Rturn type should unsigned int 2020-01-30 07:45:14 -06:00
Xiang Xiao
affc32c9d1 net/: Fix net checksum related issue
1. Remove the unused and unimplemented ipv6_chksum declaration
2. Update NET_ARCH_CHKSUM description to align with the implementation
3. Declare all checksum function prototype regardless CONFIG_NET_ARCH_CHKSUM
4. Remove the CONFIG_NET_ARCH_CHKSUM guard for tcp_ipv[4|6]_chksum
2020-01-30 07:44:36 -06:00
Greg Nutt
6b413ec241 net/tcp: Fix errors found in build testing.
Author: Gregory Nutt <gnutt@nuttx.org>

    net/tcp: Fix errors found in build testing.

    Recent re-organization moved some functions from net/inet to net/tcp and net/udp.  This include references to nxsem_wait(), SEM_PRIO_NONE, and other internal NuttX semaphore functions.  These all failed to compile because nuttx/semaphore.h was not included in any of the files.
2020-01-22 12:29:26 -03:00
Gregory Nutt
6d4b86ff06 net/tcp/tcp.h: Correct spacing error introduced with the last PR. 2020-01-21 08:30:39 -06:00
Xiang Xiao
e75b5e9d86 net/tcp and udp: Move tcp/udp recvfrom into tcp/udp folder
Move tcp/udp recvfrom into tcp/udp folder and remove inet_recvfrom.c
2020-01-21 08:30:39 -06:00
Xiang Xiao
e869a10c18 net/tcp, udp: Move tcp/udp close operation into tcp/udp folder
Move tcp/udp close operation into tcp/udp folder and remove inet_close.c
2020-01-21 08:30:39 -06:00
Xiang Xiao
677536ccf5 net/udp: Rename udp_psock_sendto_xxx.c to udp_sendto_xxx.c like TCP
Rename udp_psock_sendto_xxx.c to udp_sendto_xxx.c like TCP and remove udp_psock_send.c
2020-01-21 08:30:39 -06:00
chao.an
a4aa8ae491 wqueue/notifier: update the work notifier usage
usage changed after commit 90c52e6f8f

Change-Id: Ifb0d739b046a6794b5b3ac177f489fb9a1c5c799
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-01-21 14:16:19 +08:00
Juha Niskanen
a762c06ed9 Fix typos and some incorrect comments
Author: Alan Carvalho de Assis <acassis@gmail.com>

    Run nxstyle against .c and .h files and fix it

Author: Juha Niskanen <juha.niskanen@haltian.com>

    Fix typos and some incorrect comments
2020-01-20 09:32:36 -03:00
Xiang Xiao
3e230ca9eb net/inet/inet_recvfrom.c: Correct the return value (#121)
NuttX follows OpenGroup.org: https://pubs.opengroup.org/onlinepubs/009695399/functions/recv.html :

[EAGAIN] or [EWOULDBLOCK]
The socket's file descriptor is marked O_NONBLOCK and no data is waiting to be received; or MSG_OOB is set and no out-of-band data is available and either the socket's file descriptor is marked O_NONBLOCK or the socket does not support blocking to await out-of-band data.

ETIMEDOUT is not a valid error to be returned from recv() or recvfrom().
2020-01-17 11:26:47 -06:00
chao.an
2d0baa779d net/udp: break the network lock to avoid deadlock
Author: chao.an <anchao@xiaomi.com>

    net/udp: break the network lock to avoid deadlock

      network deadlock when udp sendto() storm is coming

    net/close: force wait tx drain to complete

      atomic send() and close() will causes data to be discarded directly

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-01-16 14:26:48 -03:00
patacongo
21ea255ea4 net/devif/devif_poll.c: Correct a new warning found in build testing. devif/devif_poll.c:768:7: warning: unused variable 'hsec' [-Wunused-variable] (#97) 2020-01-14 03:11:43 +01:00
Xiang Xiao
f8bcd58be2 Fix format warn (#96)
* fix warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int'
* fix warning: implicit declaration of function 'up_init_exidx'
2020-01-13 16:41:09 -06:00
patacongo
3a3539f2be net/: Fix some new problems found by the current nxstyle with .c files in the net/ directory. (#92) 2020-01-13 21:26:04 +01:00
Gregory Nutt
cf5d17f795 tools/nxstyle: Added logic to parse section headers (#90)
* tools/nxstyle:  Added logic to parse section headers (like Included files, Pre-processor Definitions, etc.) and to assure that the section headers are correct for the file type.  Also (1) verify that #include appears only in the 'Included Files' section and that (2) #define only occurs in the Pre-processor definition section.

    Right now, there are several places where that rule is not followed.  I think most of these are acceptable so these failures only generate warnings, not errors.  The warning means that we need to go look at the offending #define or #include and decide if it is a acceptable usage or not.
2020-01-13 18:08:45 +00:00
patacongo
51cbc85535 net/: Run current nxstyle against all .c files under net/. Correct new problems identified by nxstyle. This is primarily a verification of the nxstyle changes (which all look good). (#89)
Co-authored-by: Gregory Nutt <gnutt@nuttx.org>
2020-01-12 21:17:29 +01:00
Gregory Nutt
bb5ad4df23 net/tcp/tcp_getsockopt.c: Fix compilation failure found in build testing. Error: invalia application of 'sizeof' to incomplete type 'struct timeval'. Fixed by including sys/time.h. Same problem and same fix as for setsockopt earlier." 2020-01-11 17:20:02 -03:00
Gregory Nutt
3374772580 net/tcp/tcp_setsockopt.c: Fix compilation failure found in build testing. Error: invalia application of 'sizeof' to incomplete type 'struct timeval'. Fixed by including sys/time.h. 2020-01-11 16:29:25 -03:00
Gregory Nutt
45a83e9481 net/tcp/tcp_send_unbuffered.c: Correct a bad signal number
There is no errno ETIMEOUT.  Probably should be ETIMEDOUT.
2020-01-11 15:36:51 -03:00
Gregory Nutt
98f431d8d8 net/: Run all .c files under net/ through tools/nxstyle and fix all resulting complaints. 2020-01-11 13:41:33 -03:00
chao.an
bb09471d63 inet_close: ensure the TCP_CLOSE can be delivered normally
Change-Id: I657433806d5dc851ce9bd7722f191f467f9ad458
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-01-11 08:24:49 -06:00
Xiang Xiao
5c5c08efcd network: simplify the timeout process logic
1.Consolidate absolute to relative timeout conversion into one place(_net_timedwait)
2.Drive the wait timeout logic by net_timedwait instead of devif_timer
This patch help us remove devif_timer(period tick) to save the power in the future.

Change-Id: I534748a5d767ca6da8a7843c3c2f993ed9ea77d4
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-11 08:24:49 -06:00
Xiang Xiao
346336bb9e Make the read ahead buffer unselectable
Here is the email loop talk about why it is better to remove the option:
https://groups.google.com/forum/#!topic/nuttx/AaNkS7oU6R0

Change-Id: Ib66c037752149ad4b2787ef447f966c77aa12aad
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-11 08:24:49 -06:00
chao.an
97bead5496 net: complement wireless handling as ethernet
Change-Id: I13cc4cbfc1e305e17c0630f11a1173afe96e8a03
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-01-11 08:04:18 -03:00
Juha Niskanen
260af07717 net/usrsock/usrsock_dev.c: Fix uninitialized return value introduced in 6a3c2ade. 2020-01-09 07:31:40 -06:00
junmin-kim
db3826bf2c Fix typo in the sockfd_socket description 2020-01-09 07:38:02 -03:00
Gregory Nutt
afc2bffb7d net/icmpv6/icmpv6_netpoll.c: Fix two warnings found in build testing
Description:

Fix two warnings found in build testing: (1) Need to include nuttx/semaphore.h
from prototype of nxsem_post() and (2) need to initialize return value of function.
Uninittialized garbage was being returned on success.Fix two warnings found in
build testing: (1) Need to include nuttx/semaphore.h from prototype of
nxsem_post() and (2) need to initialize return value of function.
Uninittialized garbage was being returned on success.
2020-01-07 18:49:55 -03:00
Xiang Xiao
981d7004fa Remove inet_setipid since nobody use it
Change-Id: I8c1ed7308678d9d2e11cadedd78f7755b8f7aa99
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-06 07:45:59 -06:00
Nathan Hartman
f9f8c6a79b net/icmp/icmp_netpoll.c: Fix return of uninitialized 'ret' when no error occurs. That is, on what should be a successful return from this function, an uninitialized value was returned, which may indicate an undeserved error. 2020-01-02 14:40:08 -06:00
Nathan Hartman
c854b1f039 net/icmp/icmp_netpoll.c: Fix warning: implicit declaration of nxsem_post(). This appeared after include of nuttx/kmalloc.h was removed recently. 2020-01-02 14:37: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
Masayuki Ishikawa
6e7c761fc8 net: tcp: Fix compile error in tcp.h 2020-01-02 09:36:25 -06:00
Xiang Xiao
02b652ce1c Minor fix (#23)
* fix ieee802154/ieee802154_input.c:179:7: error: too few arguments to function 'iob_free'
       iob_free(container->ic_iob);
       ^~~~~~~~

ieee802154/ieee802154_input.c:180:7: error: too many arguments to function 'ieee802154_container_free'
       ieee802154_container_free(container, IOBUSER_NET_SOCK_IEEE802154);
       ^~~~~~~~~~~~~~~~~~~~~~~~~

* fix udp/udp_netpoll.c:327:10: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]

* fix local/local_netpoll.c:154:15: warning: implicit declaration of function 'nxsem_post'; did you mean 'sem_post'? [-Wimplicit-function-declaration]
               nxsem_post(fds->sem);
               ^~~~~~~~~~
               sem_post
2020-01-02 09:35:50 -06:00
Xiang Xiao
5fb5a9dfdd psock_udp_sendto should call udp_wrbuffer_tryalloc for nonblock socket (#20)
net/udp/udp_wrbuffer.c:  Add new function udp_wrbuffer_tryalloc()
net/udp/udp_psock_sendto_buffered.c:  If the socket was opened with O_NONBLOCK, then use udp_wrbuffer_tryalloc() so that the caller will not wait for a write buffer.  Return EGAIN if udp_wrbuffer_tryalloc() failes.
2019-12-31 09:52:40 -06:00
Xiang Xiao
90c52e6f8f Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>

    Run all .h and .c files modified in last PR through nxstyle.

Author: Xiang Xiao <xiaoxiang@xiaomi.com>

    Net cleanup (#17)

    * Fix the semaphore usage issue found in tcp/udp

    1. The count semaphore need disable priority inheritance
    2. Loop again if net_lockedwait return -EINTR
    3. Call nxsem_trywait to avoid the race condition
    4. Call nxsem_post instead of sem_post

    * Put the work notifier into free list to avoid the heap fragment in the long run.  Since the allocation strategy is encapsulated internally, we can even refine the implementation later.

    * Network stack shouldn't allocate memory in the poll implementation to avoid the heap fragment in the long run, other modification include:

    1. Select MM_IOB automatically since ICMP[v6] socket can't work without the read ahead buffer
    2. Remove the net lock since xxx_callback_free already do the same thing
    3. TCP/UDP poll should work even the read ahead buffer isn't enabled at all

    * Add NET_ prefix for UDP_NOTIFIER and TCP_NOTIFIER option to align with other UDP/TCP option convention

    * Remove the unused _SF_[IDLE|ACCEPT|SEND|RECV|MASK] flags since there are code to set/clear these flags, but nobody check them.
2019-12-31 09:26:14 -06:00
chao.an
8dd4b27973 tcp_conn: Check if the remote address is unspecified
Change-Id: I6f547bb4bfb3bb621573db9097a531ce2260e794
Signed-off-by: chao.an <anchao@xiaomi.com>
2019-12-24 10:48:00 -06:00
Xiang Xiao
87cf5c58ae Correct some problems with network timed events when there are multiple network devices in the configuration.
Squashed commit of the following:

Author: Gregory Nutt <gnutt@nuttx.org>

    Ran nxstyle against many of the affected files.  But this job was too big for today.  Many of the network drivers under arch are highly non-compiant and generate many, many faults from nxstyle.  Those will have to be visited again another day.

Author: Xiang Xiao <xiaoxiang@xiaomi.com>

    This effects all network drivers as well as timing related portions of net/: devif_poll_tcp_timer shouldn't be skipped in the multiple card case.  devif_timer will be called multiple time in one period if the multiple card exist, the elapsed time calculated for the first callback is right, but the flowing callback in the same period is wrong(very short) because the global variable g_polltimer is used in the calculation.  So let's pass the delay time to devif_timer and remove g_polltimer.
2019-12-24 10:37:30 -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
Nathan Hartman
9655730ef8 Fix various typos and spelling errors. 2019-12-12 07:41:51 -06:00
Gregory Nutt
e5e52446ca net/tcp/tcp_send.c: Trival update to some comments. 2019-12-11 11:19:32 -06:00
Gregory Nutt
c2642eef3c net/tcp/tcp_appsend.c: Enhance delayed ACK algorithm with behavior of Windows delayed ACK described at https://support.microsoft.com/en-nz/help/214397/design-issues-sending-small-data-segments-over-tcp-with-winsock: 'If there are data to be sent in the same direction as the ACK before the second data packet is received and the delay timer expires, the ACK is piggybacked with the data segment and sent immediately.' 2019-12-09 08:45:52 -06:00
Gregory Nutt
6a0ab27bd5 net/tcp/tcp_appsend.c: Update some comments. 2019-12-09 06:06:17 -06:00
Gregory Nutt
8cd5e04d53 net/tcp: Minor design improvement to TCP delayed ACKs. 2019-12-08 14:17:55 -06:00
Gregory Nutt
66ef6d143a This commit adds an initial implemented of TCP delayed ACKs as specified in RFC 1122.
Squashed commit of the following:

    net/tmp:  Rename the unacked field of the tcp connection structure to tx_unacked.  Too confusing with the implementation of delayed RX ACKs.

    net/tcp:  Initial implementation of TCP delayed ACKs.

    net/tcp:  Add delayed ACK configuration selection.  Rename tcp_ack() to tcp_synack().  It may or may not send a ACK.  It will always send SYN or SYN/ACK.
2019-12-08 13:13:51 -06:00
Gregory Nutt
16b1c276bd net/netlink/netlink_conn.c: Fix some really basic errors in the redesign of the asynchronous Netlink response logic. 2019-11-28 16:14:59 -06:00
Gregory Nutt
4ae09a3b80 net/netlink: Redesign the logic that handles notifications of when response data is available. Signal handlers are sub-optimal inside the OS (especially after the preceding change which forces the hand). Instead, use the work queue notifiers as is done with all other network notifiers. 2019-11-28 14:20:40 -06:00
Gregory Nutt
69318b1024 Re-implements reverted commit 344f7bc9f6 in a way that should not have the undesired side-effect. include/nuttx/sched.h: Add a bit to the TCB flags to indicat the thread is a user thread in a syscall. sched/nuttx/nxsig_dispatch.c: Delay dispatching to signal handlers if within a system call. In all syscall implementations: Process delayed signal handling when exiting system call. 2019-11-28 12:47:36 -06:00
Gregory Nutt
cbdd590c82 Revert "include/nuttx/sched.h: Add storage for a previous signal mask. arch/: In all syscall implementations, block all signals before dispatching a system call; resotre signal mask when the system call returns."
Using the sigprocmask() for this purpose has too many side-effects.

This reverts commit 344f7bc9f6.
2019-11-28 11:57:54 -06:00
Gregory Nutt
344f7bc9f6 include/nuttx/sched.h: Add storage for a previous signal mask. arch/: In all syscall implemenations, block all signals before dispatching a system call; resotre signal mask when the system call returnes. 2019-11-28 10:51:29 -06:00
Gregory Nutt
d1593bb336 Squashed commit of the following:
net/netlink/netlink_sockif.c:  At implementation of response available signal handler needed for POLLIN logic.
    net/netlink/netlink_sockif.c:  Add logic to set up signal handler to receive the response notification.
2019-11-27 21:30:01 -06:00
Gregory Nutt
a8f3c3651a net/netlink/netlink_conn.c: Use nxsig_queue() instead of nxsig_kill() so that we can pass a reference to the connection structure with the signal. 2019-11-27 19:31:23 -06:00
Xiang Xiao
e1e192fc33 net/: icmp[v6] fix ping[6] complain 'WARNING: Received after timeout'. The root cause is that icmp[v6]_pollsetup monitors ICMP[v6]_NEWDATA, but icmp[v6]_input reports ICMP[v6]_ECHOREPLY. This change lets icmp[v6]_input report report ICMP[v6]_NEWDATA to fix this issue and remove ICMP[v6]_ECHOREPLY to avoid the wrong usage in the future. 2019-11-27 08:09:51 -06:00
Xiang Xiao
250bde034d net/: icmp[v6]_pollsetup should always return POLLWRNORM if the caller requests it since ICMP[v6] doesn't utilize IOB buffer for sending and always needs to wait for an ICMP[v6]_POLL. 2019-11-27 08:04:14 -06:00
Xiang Xiao
ea666877f2 net/devif/devif_callback.c: Restore cf9f2c56cb. That restored change plus the following additional commits reolves the issue raised by Valmantas Palikša. 2019-11-27 07:59:52 -06:00
Gregory Nutt
93ed8b66d9 net/netlink: Add partial support for the NETLINK poll() operation. Still missing is some signal handling logic that actually wakes up the poll() when an asynchronous NETLLINK response is available.
So although the poll() implemenation is still not yet usable, the commit is useful because it (1) does not harm, and (2) incidentally fixes a few other issues in the NETLONK response queuing that I noted in the process.
2019-11-26 18:52:22 -06:00
Xiang Xiao
8214973f80 net/usrsock/usrsock_poll.c: usrsock_pollsetup() doesn't need logic and with fds->events since line 279 will do the same thing:
fds->revents &= (~(POLLOUT | POLLIN) | info->fds->events);
2019-11-25 11:44:58 -06:00
Xiang Xiao
1905e01fda net/: ICMP/ICMPv6/TCP/UDP poll shouldn't set POLLHUP and POLLOUT at the same time the standard require that only report POLLHUP:
https://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html.
2019-11-25 09:59:50 -06:00
Xiang Xiao
34ec7c97eb net/icmp/icmp_netpoll.c and icmpv6/icmpv6_netpoll.c: ICMP/ICMPv6 should always report POLLHUP and POLLERR, regardless of requested 'events'. 2019-11-25 09:57:49 -06:00
Xiang Xiao
af9c67ab58 net/tcp/tcp_netpoll.c and net/udp/udp_netpoll.c: In [tcp|udp]_iob_work fix the wrong condition logic (& vs &&). 2019-11-25 09:32:24 -06:00
Gregory Nutt
f1ffb300da net/devif/devif_callback.c: This commit reverts the core of commit cf9f2c56cb pending further investigation. Valmantas Palikša reports that this change cause timeout errors during pinging. 2019-11-25 07:34:41 -06:00
Xiang Xiao
506b83f8d9 net/inet/inet_close.c: In tcp_close_eventhandler(), check TCP_NEWDATA flag before process and don't eat the flag for TCP_DISCONN_EVENTS 2019-11-24 10:41:11 -06:00
Xiang Xiao
98fc60eb75 [tcp|udp]_poll_eventhandler check psock_[tcp|udp]_cansend before report POLLOUT. Change the unbuffered psock_[tcp|udp]_cansend return OK to unify the code logic and remove the unnecessary [tcp|udp]_poll_txnotify call. 2019-11-24 10:30:48 -06:00
Xiang Xiao
673f812c4e net/tcp/tcp_netpoll.c: Monitor TCP_POLL/TCP_NEWDATA/TCP_BACKLOG per the request like UDP counterpart. 2019-11-24 10:20:01 -06:00
Xiang Xiao
893fc6e1cf net/udp/udp_netpoll.c: Report POLLHUP and POLLERR in 'revents' regardless the requested 'events' set. Per Opengroup.org, these bits must be ignored in the 'events' set. 2019-11-24 10:18:08 -06:00
Xiang Xiao
cf9f2c56cb et/devif/devif_callback.c: devif_event_trigger shouldn't return true if triggers & DEVPOLL_MASK equal zero() 2019-11-24 10:11:19 -06:00
Gregory Nutt
9efadaefc1 net/tcp: Be consistent with units of TIME_WAIT. Units were unspecified in tcp/Kconfig, but assumed to be in units of half seconds in tcp/timer.h. include/nuttx/netconfig does not indicate the units but is apparently assuming seconds. This commit unifies all delays to clearly specified units of seconds. 2019-11-24 09:19:54 -06:00
Xiang Xiao
e0307fcd8f boards/sim/sim/sim/src/sim_bringup.c: Mount tmpfs to CONFIG_LIBC_TMPDIR in sim_bringup if CONFIG_FS_TMPFS is defined. 2019-11-23 07:58:50 -06:00
Gregory Nutt
bc8d964cb9 net/netlink: Add some comments about 'Input Parameters' 2019-11-19 20:46:43 -06:00
Gregory Nutt
b72f7cf47f net/netlink/netlink_route.c: Fix a case where #if was used but #ifdef was intended. 2019-11-19 09:47:57 -06:00
Gregory Nutt
b659c74440 net/netlink/netlink_sockif.c: Netlink sockets may be set to non-blocking. 2019-11-19 07:50:46 -06:00
Gregory Nutt
936d69da1f net/netlink and include/nuttx/net/netlink.h: Make netlink_add_response() a globally access part of the network interface. This is necesssary to support netlink components that reside outside of the net/ sandbox. 2019-11-18 21:12:50 -06:00
Gregory Nutt
a7a1b0888e net/netlink/netlink_route.c: Remove dangling whitespace at the end of lines. 2019-11-18 10:47:35 -06:00
Gregory Nutt
6479775721 net/netlink/netlink_conn.c: Add support for asynchronous Netlink responses. 2019-11-18 09:48:14 -06:00
Gregory Nutt
ab78f0ca0a include/netpacket/netlink.h: Backout some preliminary NETLINK_CRYPTO definitions. These are premature (but may come back). 2019-11-17 10:47:24 -06:00
Gregory Nutt
82a4111a2b include/netpacket/netlink.h: Add definitions that will be needed for future NETLINK_CRYPTO support. 2019-11-14 09:18:11 -06:00
Gregory Nutt
9d6c607afc net/netlink/netlink_route.c: Add some comments. 2019-11-12 10:36:05 -06:00
Gregory Nutt
3e1937b49b net/netlink: Add options to disable individual NETLINK_ROUTE commands. This will probably become quite large and will need to be higher tunable for smaller platforms. 2019-11-12 10:19:42 -06:00
Gregory Nutt
3811a0f5cc net/netlink/netlink_route.c: Update some comments. 2019-11-12 07:59:43 -06:00
Gregory Nutt
ecbd5a85d7 net/netlink: Fixes from testing with new apps/examples/netlink_route. 2019-11-11 13:38:11 -06:00
Gregory Nutt
71a968ad71 net/netlink/netlink_route.c: Add missing routing table list terminating response. 2019-11-10 15:00:05 -06:00
Gregory Nutt
3a8a829088 net/netlink/netlink_route.c: Add support for obtaining the entire routing table. 2019-11-10 14:11:44 -06:00
Gregory Nutt
bda0a9c6a7 net/netlink: Fix offset in rtattr. include/net/route.h: Correct form and naming of sruct rtentry. include/netpacket/netlink.h: Add some definitions that will be needed to access routing tables. 2019-11-10 12:35:15 -06:00
Gregory Nutt
8c85ecf531 net/netlink/netlink_route.c: Add support for the NETLINK_ROUTE RTM_GETLINK command that is used to obtain a list of all devices in the UP state. 2019-11-09 17:36:30 -06:00
Gregory Nutt
b6756eb5fe Trivial update to some comments. 2019-11-08 12:06:29 -06:00
Gregory Nutt
dbbabcd33c Squashed commit of the following:
net/netlink/netlink_route.c:  Add Netlink socket NETLINK_ROUTE support for getting a snopshot of the Neighbor table.

    net/neighbor/neighbor_snapshot.c:  Add neighbor_snapshot() that will eventually be used by the Netlink sockets.  Also fixed naming violation 'struct neighbor_entry' -> 'struct neighbor_entry_s'.

    include/nuttx/net/neighbor.h:  Expose format of the IPv6 neighbor table for use with Netlink sockets.
2019-11-08 11:16:04 -06:00
Gregory Nutt
d31411189e net/netlink/Kconfig: Remove dependency on EXPERIMENTAL. Although the Netlink implementation is still only fragmentary, there is no usable functionality there and no reason for it to depend on EXPERIMENTAL. Also minor changes to the menu organization so that the Netlink options appear the same was as do other network options. 2019-11-07 14:10:35 -06:00
Gregory Nutt
38e527deeb net/netlink: Fix cosmetic issues, mostly typo fixes. 2019-11-04 14:06:07 -06:00
Gregory Nutt
6d13705e93 net/netlink: The NETLINK_ROUTE logic needs to return the first queued response and not attempt to match up reponses with requests. That is the Linux compatible way. Also, use queue.h functions for list management and fix an error in arp_snapshot(). 2019-11-04 09:02:14 -06:00
Gregory Nutt
7bd045130c net/netlink/: Misc bugfixes from initial testing using NSH 'arp -t' command. 2019-11-03 19:27:58 -06:00
Gregory Nutt
2991987018 net/netlink/netlink_route.c (mostly): This completes a minimal netlink implementation that will retrieve the ARP table.
net/netlink:  Add basic hooks (only) to support the NETLINK_ROUTE protocol.
2019-11-03 13:59:42 -06:00
Gregory Nutt
3b275fcf4e net/: Run nxstyle against all C files. 2019-10-25 11:31:42 -06:00
Gregory Nutt
1ba23bb75c net/udp/udp_psock_sendto_buffered.c: Add a check for the device that is polling. In the multiple network device case, this check is necessary to prevent sending the UDP packet to the wrong device. This change addresses the buffered case and is the companion to commit 6c46c48e4b. 2019-10-18 16:04:33 -06:00
Gregory Nutt
6c46c48e4b net/udp/udp_psock_sendto_unbuffered.c: Add a check for the device that is polling. In the multiple network device case, this check is necessary to prevent sending the UDP packet to the wrong device. This change addresses only the unbuffered case. The buffered case is more complex. See patch attached to issue 172. 2019-10-18 14:20:34 -06:00
Gregory Nutt
93452d70ef net/inet/inet_close.c: Fix a warning found in build testing. 2019-09-28 12:57:26 -06:00
Gregory Nutt
81aecdce1e net/igmp/igmp_send.c: Fix a typo in a debug statement. Noted by Bernd Walter. 2019-09-25 13:46:24 -06:00
Gregory Nutt
0b9416a40c net/inet/inet_close.c: Still fussing with f3ab9abe51. Re-analyze all disconnection events, update comments, removed one of two non-standard return values. A failure is returned only in cases where the socket was not actually closed. 2019-09-25 08:16:37 -06:00
Gregory Nutt
8e079d73d9 Update a comment. 2019-09-25 07:39:49 -06:00
Gregory Nutt
f3ab9abe51 net/inet/inet_close.c: Fixes two problems, both noted by Bernd Walter:
1) The change of commit ed9fe70024 left some dangling logic and incorrect, confusing comments.  Prior to that commit the 'pstate' variable was non-NULL only when doing a lingering close.  Comments to this effect as well as tests of pstate should also have been updated.  These are confusing and inappropriate, but do not lead to incorrect behavior.

2) Eliminate an incomplete test when a disconnection event. When a disconnection event occurs, the close logic MUST always terminate the wait.  The conditional test was not incorrect, however, it lacked 'else' logic and would simply ignore that disconnection event in some cases.  That is bad because there may not be another disconnection event and that can lead to hangs (or at least very, very long delays).
2019-09-25 07:24:20 -06:00
Bernd Walter
0008ff33b3 net/icmpv6/icmpv6_rnotify.c: Correct a bad index in debug output. 2019-09-25 06:29:02 -06:00
Bernd Walter
338f09acfc drivers/net and net/: Use ntoh() when printing IPv6 addresses so that the addresses appear in friendlier host order vs. network order. 2019-09-24 10:06:42 -06:00
Xiang Xiao
9830791960 net/icmpv6/icmpv6_poll.c: Fix typo error in icmpv6_poll. 2019-09-24 09:28:07 -06:00
Xiang Xiao
b4e7ca5aac net/icmpv6/icmpv6_autoconfig.c: cmpv6_autoconfig() error handling must not overwrite overwrite the error code. 2019-09-20 12:51:37 -06:00
Xiang Xiao
6c484847d5 net/: Decouple autoconfig and icmpv6 socket to avoid the invalid kconfig combination. 2019-09-20 12:45:05 -06:00
Gregory Nutt
23e1d2e403 Dispatch ICMP_POLL to device's callback list too since icmpv6_neighbor still append the callback into this list. 2019-09-20 07:54:10 -06:00
Juha Niskanen
e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Xiang Xiao
5fd8f78bf9 net/ipforward, tcp, and udp: Fix a chicken and egg problem by eliminating the check of the arp/neighbor tables before packet transmission
1. For buffered tcp/udp case, if CONFIG_NET_ARP_SEND/CONFIG_NET_ARP_IPIN/CONFIG_NET_ICMPv6_NEIGHBOR isn't enabled and the table doesn't contain ip<->ethaddr mapping yet, the logic will skip the realtransmission and then arp/neighbor can't steal the final buffer to generate arp/icmpv6 packet.
2.for all other case, the tcp layer or user program should already contain the retransmit logic, the check is redundancy and may generate many duplicated packets if arp/icmpv6 response is too slow because the cursor stop forward. If user still concern about the very first packet lost, he could fix the issue by enabling CONFIG_NET_ARP_SEND/CONFIG_NET_ICMPv6_NEIGHBOR at begin.
2019-09-18 12:33:41 -06:00
Nathan Hartman
366053e464 Fix typos, 1 in a #define, others in comments. This changes one definition: _MQ_TIMEDRECIEVE is changed to _MQ_TIMEDRECEIVE. It appears this symbol is not used anywhere. 2019-09-11 08:56:56 -06:00
Gregory Nutt
c5066f9f4c net/ipforward/ipv4_forward.c: Correct some errors introduced with commit a52ceac13e. Noted by Adam Porter. 2019-09-06 16:01:38 -06:00
Gregory Nutt
7871e983b8 net/tcp/tcp_send.c: Commit a52ceac13e broke IPv4 sending. In cp_send.c:tcp_ipv4_sendcomplete(), ‘ipv4->vhl’ now needs to be configured before call to tcp_ipv4_chksum(). Noted by Jussi Kivilinna in comit comments. 2019-09-06 09:48:42 -06:00
Juha Niskanen
822bb06967 Fix some typos. Also minor update to stm32f7/nucleo-144/README.txt and stm32l4/nucleo-l496zg/README.txt board documentation. 2019-09-05 08:12:50 -06:00
Gregory Nutt
100fe59ff2 net/arp/arp.h: Remove an unused structure definition. 2019-09-01 17:49:44 -06:00
Gregory Nutt
d596e56c3d net/local/local_conn.c: Removed un-ncessary memset(). Connection structure is allocated with kmm_zalloc() which will clear all memory. 2019-09-01 11:23:40 -06:00
Gregory Nutt
6266e067e9 net/: Re-order the content of all address-family socket 'connection' structures so that they begin with a comomon prologue. This permits better use of logic for different address family types. 2019-09-01 08:47:01 -06:00
Gregory Nutt
a52ceac13e net/: Now handles reception of IPv4 packets with larger IPv4 headers containing options. 2019-08-31 12:25:30 -06:00
Gregory Nutt
9bdde04636 net/Kconfig: Ethernet packet buffer size cannot be permitted to go below 1294 is IPv6 is selected. 2019-08-31 09:08:32 -06:00
zhangyuan7
b33fc302f0 net/inet and net/tcp: Fix tcp close flow; free the connection after all tcp close process finished. 2019-08-30 06:44:43 -06:00
Gregory Nutt
ac151e05e7 Fix warnings found in build testing. 2019-08-27 16:20:39 -06:00
zhangyuan7
ba598841e5 net/tcp/Kconfig, include/nuttx/net/netconfig.h: Make RTO and WAIT_TIME configurable. This fix is not really correct: TCP RTO really should be calculated dynamically for each TCP connection: http://sgros.blogspot.com/2012/02/calculating-tcp-rto.html. 2019-08-26 11:03:27 -06:00
biantao
f1c46b4498 net/tcp/tcp_send.c: Fix RST packet with wrong ack number. 2019-08-26 10:16:43 -06:00
Gregory Nutt
27e4bfffd4 Update some comments and README files. 2019-08-24 13:06:43 -06:00
Anthony Merlino
c024a1f569 Merged in antmerlino/nuttx/xbee-prefix (pull request #1009)
drivers/ieee802154/xbee: Add configuration option for setting the default prefix to use when bringing up the network and setting the IP address.

# Conflicts:
#	drivers/wireless/ieee802154/xbee/xbee_netdev.c

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-19 22:24:32 +00:00
Anthony Merlino
70404ed0dc Merged in antmerlino/nuttx/iobinstrumentation (pull request #1001)
Iobinstrumentation

* mm/iob: Introduces producer/consumer id to every iob call. This is so that the calls can be instrumented to monitor the IOB resources.

* iob instrumentation - Merges producer/consumer enumeration for simpler IOB user.

* fs/procfs: Starts adding support for /proc/iobinfo

* fs/procfs: Finishes first pass of simple IOB user stastics and /proc/iobinfo entry

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-16 22:42:25 +00:00
Anthony Merlino
fc1780d63e Merged in antmerlino/nuttx/sixlowpan-removeconversions (pull request #997)
ieee802154/sixlowpan: Removes unnecessary conversions that were happening due to a misunderstanding of byte ordering with EUI-64

# Conflicts:
#	drivers/wireless/ieee802154/xbee/xbee_netdev.c

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-16 01:26:44 +00:00
Anthony Merlino
7c06438315 Merged in antmerlino/nuttx/ipforward (pull request #981)
net/ipforward: Check if interface is up early on when forwarding to avoid extra work.

As noticed in a previous wireless commit, when forwarding is enabled and a packet comes in, the packet is attempted to be sent on each other netdev without regard for whether it is in the UP state. Of course this is eventually caught, but it can be caught earlier to avoid unnecessary work, especially in the 6LoWPAN case where a useless packet conversion will occur.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-10 17:53:06 +00:00
David Sidrane
1e90dd9284 net/socket/getpeername: Fixed warning in DEBUG code. 2019-08-07 07:53:56 -06:00
Juha Niskanen
d5382cde17 net/udp/udp_psock_sendto_buffered.c: Fixes a copy-paste error in the new SO_LINGER code: CONFIG_TCP_NOTIFIER to CONFIG_UDP_NOTIFIER. 2019-08-05 07:42:14 -06:00
Nathan Hartman
68d43d3679 Fix typos. 2019-08-04 14:50:28 -06:00
David S. Alessio
20e8a83c5f net/udp/udp_txdrain.c: Add missing header file. 2019-07-29 08:12:55 -06:00
Gregory Nutt
124212624d net: Minor fix in error checking in TCP/UDP Tx drain logic 2019-07-28 07:39:55 -06:00
Gregory Nutt
361d85ae35 net/tcp and udp: Fix errors in the new implementation of SO_LINGER. The tcp_drain() and udp_drain() functions were casting the working argument to the wrong type, resulting in hangs and abnormal behavior. There is a complexity in the tcp drain logic when the remote peer closes the socket before all Tx data has been flushed. Sometimes we are not notified of this case and wait the entire timeout unnecessarily. There is a workaround in place in tcp_txdrain(), but this really should be revisited. 2019-07-27 10:26:52 -06:00
Masayuki Ishikawa
5fd5cc0b0a Merged in masayuki2009/nuttx.nuttx/change_udp_broadcast (pull request #954)
net/udp: Remove net stack dependency from CONFIG_NET_BROADCAST

This change allows us to use CONFIG_NET_BROADCAST without network
stack. (i.e. usrsock application can use broadcast)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-26 14:05:03 +00:00
Bernd Walter
5d01ce6c58 net/icmpv6/icmpv6_autoconfig.c: Use ntohs() to convert IPv6 address from network to host order int network debug output. 2019-07-06 07:02:51 -06:00
Gregory Nutt
1346f29151 net/: Fix alignment and spacing problems found by tools/nxstyle. 2019-07-02 18:02:23 -06:00
Gregory Nutt
574595dc32 Still fixing new warnings found in build testing. 2019-07-01 15:56:34 -06:00
Gregory Nutt
8774977f4d Fix warnings found in build testing. 2019-07-01 15:22:42 -06:00
Gregory Nutt
077d164b14 /net/inet: Simplify design of change in last commit. 2019-07-01 14:07:12 -06:00
Gregory Nutt
de5a6163d5 This commit implements a proper version of SO_LINGER. Not sufficiently tested on initial commit.
Squashed commit of the following:

    net/: Fix some naming inconsistencies, Fix final compilation issies.

    net/inet/inet_close():  Now that we have logic to drain the buffered TX data, we can implement a proper lingering close.

    net/inet,tcp,udp:  Add functions to wait for write buffers to drain.

    net/udp:  Add support for notification when the UDP write buffer becomes empty.

    net/tcp:  Add support for notification when the TCP write buffer becomes empty.
2019-07-01 12:25:32 -06:00
Gregory Nutt
ded1900927 include/nuttx/net/net.h: Fix some long lines. 2019-07-01 09:18:38 -06:00
Gregory Nutt
b0f751897c net/inet/inet_close.c: Extend some comments. 2019-07-01 08:24:39 -06:00
Gregory Nutt
5e36627366 Update TODO list and fix an error in conditional compilation that I introduced with the last commit. 2019-07-01 08:12:51 -06:00
Gregory Nutt
5af5fc4409 net/inet/inet_close.c: Last PR remove SO_LINGER socket option. SO_LINGER was always enabled is CONFIG_NET_SOLINGER was selected. 2019-07-01 07:37:41 -06:00
Masayuki Ishikawa
ed9fe70024 Merged in masayuki2009/nuttx.nuttx/fix_tcp_active_close (pull request #923)
net/inet: Fix tcp active close in inet_close.c

In previous implementation, FIN packet was not sent when a socket
is actively closed (e.g. telnetd or webserver) without SO_LINGER.
This issue happens because the socket closing sequence waits for
the status.cl_sem only if lingering timeout is set. However,
in many server use-cases, SO_LINGER is not usually set and even
in these cases, FIN packet must be sent correctly.

This PR changes the logic in inet_close.c so that it can wait
for status.cl_sem regardless of SO_LINGER. Instead, if SO_LINGER
is set, it waits for the semaphore with timeout option.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-01 13:25:47 +00:00
Gregory Nutt
d0c569d7b5 net/tcp/tcp_send_buffered.c: Fix a warning reported in build testing. 2019-06-21 13:48:27 -06:00
Juha Niskanen
abc49a6a13 arch/arm/src/stm32l4: if SRAM3 is used as heap, do not power it off in stop 2 mode. 2019-06-13 05:52:40 -06:00
Gregory Nutt
ee9e8c6bc2 udp\udp_callback.c: Fix another C89 compatibility problem. Empty initializers are not permitted. Caused ez80 build failure. 2019-06-03 09:23:19 -06:00
Masayuki Ishikawa
fd387b6b8c Merged in masayuki2009/nuttx.nuttx/fix_usrsock (pull request #879)
net/usrsock: Fix debug logs and remove DEBUGASSERT from usrsockdev_do_request()

In a client mode, socket() will be the first request for usrsockdev_do_request().
However, in a server mode, the first request to accepted sockets will be recv()
or others which depend on applications. So I think we should remove this
DEBUGASSERT from usrsockdev_do_request().

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-06-03 11:43:43 +00:00
Gregory Nutt
2cf195e6d1 configs: Fix included path used in all arch/z80 XDS-II builds (ez80 and z8). 2019-06-02 16:16:44 -06:00
Gregory Nutt
2767e80459 Squashed commit of the following:
ez80:  Fixing a few more compile problems.  I am afraid that the 5.3.0 compiler it too buggy to use.
    ez80:  Additional build-related fixed.
    eZ80:  Updating to use the newest ZDSII 5.3.0 toolchain.
2019-06-02 11:05:31 -06:00
Valmantas Paliksa
d3cedfb823 net/tcp/tcp_send_buffered.c: Fix deadlock in iob_copyin when iob buffers are exhausted and network lock is taken. 2019-05-31 07:29:17 -06:00
Gregory Nutt
b49be4bb20 Squashed commit of the following:
arch/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    sched/ audio/ crypto/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    Documentation/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    fs/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    graphics/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    net/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    drivers/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    include/, syscall/, wireless/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    configs/:  Remove all references to CONFIG_DISABLE_POLL.  Standard POSIX poll can no longer be disabled.
2019-05-21 18:57:54 -06:00
Ivan Ucherdzhiev
82cb456e02 net/sixlowpan/sixlowpan_hc06.c: Correct an endian-ness problem in HC06 decompression. 2019-05-08 06:59:22 -06:00
Jukka Laitinen
285fb555d0 net/socket/getsockname.c: Fix addrlen check in socket debug features. Getsockname checked erroneously a pointer agains 0, where the intention was to dereference the pointer and to check the length. This causes also a compilation failure if the code is compiled with CONFIG_DEBUG_FEATURES and with -Werror flag set. 2019-04-30 06:22:07 -06:00
Gregory Nutt
c999d12bba net/utils: net_lock() and net_restorelock() not return a value. That values is the standard zero on success; negated errno value on failure. This return value is only needed for -ECANCELED. That cancellation indication needs to ripple all the way back to the highest levels where the cancellation can be acted on. This commit only adds the return value; it does not add checking for the return values of net_lock() and net_restorelock() at higher levels. That is required too. 2019-04-14 09:37:25 -06:00
Gregory Nutt
d701dc6a4a net/dev/devif_poll.c: Fix compile error introduced by c9b73f5139. Typo: DEVIF_ICMP6, not DEVIF_ICMPV6. 2019-03-19 16:46:11 -06:00
zhangyuan7
81a3ec250e net/local: Fixed deadlock issue by replacing nxsem_wait() with net_lockedwait() so that we do not wait with the network locked. 2019-03-19 09:54:22 -06:00
zhangyuan7
656c20fd4a net/local/local_connect.c: Initialize lc_result before giving lc_waitsem 2019-03-19 09:52:40 -06:00
anchao
a418b63e07 net/udp/udp_callback.c: Initialize address structure to avoid random values in padding. 2019-03-19 09:49:54 -06:00
anchao
c9b73f5139 net/icmp and icmpv6: Bind icmp callback from device to connection. Resolves the issue that bind() could not be called before send() 2019-03-19 09:43:32 -06:00
zhangyuan7
b161682adc net/usrsock: Add mutual exclusion so that only user can perform a socket request 2019-03-19 09:23:08 -06:00
Gregory Nutt
ba859ad302 tools/nxstyle.c: Don't complain about certain lowercase characters in otherwise uppercase pre-processor identifers: IPv6, IPv4, ICMPv6, IGMPv2, p as a decimal point, d signifying a divisor. It was a bad idea to let the door open a crack for there. While they improve readability, the inconsistently also causes other problems. 2019-03-12 14:22:52 -06:00
Gregory Nutt
f6b00e1966 tools/nxstyle.c: Fix logic error that prevent detecion of '/' and '/=' as operators. net/: Minor updates resulting from testing tools/nxstyle. 2019-03-11 12:48:39 -06:00
Gregory Nutt
a76e137ce2 Squashed commit of the following:
sched/init/nx_start.c:  Add support for CONFIG_BOARD_DRIVER_INITIALIZE.  If this option is selected then nx_start() will call a board-provided function board_driver_initialize() immediately after calling up_initialize().

    Rename CONFIG_BOARD_INITIALIZE to CONFIG_BOARD_LATE_INITIALIZE.

    Raname board_initialize() to board_late_initialize()
2019-02-18 15:32:00 -06:00
Gregory Nutt
69056d4053 net/: The value ERROR should never be returned from internal OS functions. That is reserved for returning values to appliations with the errno value set. Within the OS, errors are returned with a negated errno value ALWAYS. 2019-02-14 15:38:36 -06:00