Commit Graph

2485 Commits

Author SHA1 Message Date
Xiang Xiao
1fb8c13e5e Replace nxsem_timedwait_uninterruptible with nxsem_tickwait_uninterruptible
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-15 13:55:58 +03:00
Xiang Xiao
9072eecc30 sched/wqueue: Change the return type of work_notifier_teardown to void
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-14 00:35:29 +03:00
Michael Jung
f208c4bbd4 Fix ENOENT errors when polling on Netlink socket
When a Netlink response is issued, which a task is currently polling for
on the corresponding AF_NETLINK socket, then the poll call will return
with a ENOENT error.  This is due to the fact that the Netlink response
notifier is automatically torn down after the notification.

Fixed by making netlink_notifier_teardown a best-effort function that
does not return a result code.

Signed-off-by: Michael Jung <michael.jung@secore.ly>
2022-05-14 00:35:29 +03:00
Fotis Panagiotopoulos
8ef20c230b icmp: Fixed replies to broadcasts. 2022-05-13 20:22:06 +08:00
JacobCrabill
3ddc019f8e net: Fix typos, update comments in Kconfigs 2022-05-06 08:54:58 +02:00
JacobCrabill
0a6181f4d7 net/can: Fix CONFIG errors in can_recvmsg 2022-05-06 08:54:58 +02:00
JacobCrabill
4610aee973 net/netdev: Add CONFIG_NETDEV_CAN_FILTER_IOCTL 2022-05-06 08:54:58 +02:00
Michael Jung
61f3bd10a5 Fix udp recvfrom to correctly return addrlen
According to POSIX the length of the source address of the received
message shall be stored in the object pointed to by the address_len
argument.

This patch fixes two places where this did not happen correctly.

Signed-off-by: Michael Jung <michael.jung@secore.ly>
2022-04-28 20:25:38 +08:00
田昕
670ea1e5fb net/tcp:make initial tcp port more random
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-04-27 19:46:23 +03:00
Xiang Xiao
ef1a98dd00 Remove the unneeded void cast
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-17 23:32:05 +03:00
zhanghongyu
4c693239c0 fix: usrsock iovec_do skip empty iov
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-14 02:47:31 +08:00
zhanghongyu
f60480a5db rpmsg_usrsock: Support the wireless ioctl which contain pointer 1/2
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-14 02:47:31 +08:00
Jiuzhu Dong
d87cf8d4ca fs/poll: change format for type pollevent_t
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-07 12:14:06 +08:00
Xiang Xiao
9785d6606c openamp: Change the dependence from OPENAMP to RPTUN
since all rpmsg driver need the extension api exposed by rptun driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-05 10:05:41 +03:00
Petro Karashchenko
e88a357fa7 net/utils: fix IPv4 checksum calculation
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-04 07:40:28 +09:00
hejianliang3
e9648d8a73 net:fix coverity warning
Signed-off-by: hejianliang3 <hejianliang3@xiaomi.com>
2022-04-03 14:37:53 +03:00
zhanghongyu
451c53daa4 usrsock: Move event field to usrsock_message_common_s
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-03 11:38:50 +09:00
zhanghongyu
c50d7e174f net: tcp/udp/icmp/icmpv6 add FIONSPACE support
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-02 13:39:38 +08:00
zhanghongyu
931a64717a fix:Temporarily remove udp send large pkt assert
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-02 10:40:22 +08:00
Xiang Xiao
e4b73d90d7 net/local: change 255 to UINT8_MAX
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-01 23:14:15 +08:00
zhanghu6
fb912da252 local socket: cancel assert about backlog exceed 255
Signed-off-by: zhanghu6 <zhanghu6@xiaomi.com>
2022-04-01 23:14:15 +08:00
YAMAMOTO Takashi
bc0ca51243 netdev_file_ioctl: Fix fcntl F_SETFL O_NONBLOCK regression
This fixes a regression caused by the following commit,
which prevents the file flag from being updated.

```
commit 28860b5242
Author: chao.an <anchao@xiaomi.com>
Date:   Sat Mar 19 14:47:37 2022 +0800

    net/netdev: fix switch case missing break

    Signed-off-by: chao.an <anchao@xiaomi.com>
```

Note: some applications like mbedtls uses F_GETFL to confirm
the nonblock-ness of the socket. This is critical for such
applications.
2022-04-01 16:35:12 +08:00
ligd
1796663e08 rpmsg_socket: fix kasan report error
==1598322==ERROR: AddressSanitizer: heap-use-after-free on address 0xf514f8a8 at pc 0x58ac3898 bp 0xd0b4d488 sp 0xd0b4d478
READ of size 4 at 0xf514f8a8 thread T0
    #0 0x58ac3897 in rpmsg_socket_pollnotify rpmsg/rpmsg_sockif.c:211
    #1 0x58ac512f in rpmsg_socket_ept_cb rpmsg/rpmsg_sockif.c:312
    #2 0x5787881c in rpmsg_virtio_rx_callback open-amp/lib/rpmsg/rpmsg_virtio.c:331
    #3 0x57886a67 in virtqueue_notification open-amp/lib/virtio/virtqueue.c:623
    #4 0x5786fb89 in rproc_virtio_notified open-amp/lib/remoteproc/remoteproc_virtio.c:340
    #5 0x5786bde3 in remoteproc_get_notification open-amp/lib/remoteproc/remoteproc.c:985
    #6 0x57755a50 in rptun_worker rptun/rptun.c:303
    #7 0x57755e51 in rptun_thread rptun/rptun.c:352
    #8 0x57730d4a in nxtask_start task/task_start.c:128
    #9 0xdeadbeee  (/memfd:pulseaudio (deleted)+0x15dbeee)

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-29 10:09:49 +08:00
ligd
ad9ba8f454 local_socket: default set block mode if accept() a new socket
reference:
https: //man7.org/linux/man-pages/man2/accept.2.html

1. default set block mode if accept() a new socket
2. local_socket support FIONBIO

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-28 23:26:34 +08:00
ligd
5b027f5260 net: netdev_ioctl handle FIONBIO
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-28 23:26:34 +08:00
Eero Nurkkala
b59dd92528 net/rpmsg: fix compile-time warning
Fix this compile-time warning:

rpmsg/rpmsg_sockif.c:381:24: warning: format '%d' expects argument of type 'int', but argument 3 has type 'ssize_t' {aka 'long int'} [-Wformat=]
  381 |                   nerr("circbuf_write overflow, %d, %d\n", written, len);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~
      |                                                            |
      |                                                            ssize_t {aka long int}

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-03-25 22:18:28 +08:00
Petro Karashchenko
68902d8732 pid_t: unify usage of special task IDs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-22 21:22:32 +08:00
chao.an
28860b5242 net/netdev: fix switch case missing break
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-19 10:14:35 +02:00
chao.an
660b80b329 net/sockopt: bypass the SO_RCVBUF/SO_SNDBUF to usrsock
SO_RCVBUF/SO_SNDBUF tightly coupled with stack

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-18 00:19:31 +08:00
chao.an
b0d553a068 net/local: correct the socket flags from client socket
socket flags from connect() should used from client

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-17 23:15:40 +08:00
chao.an
c2ba11d971 net/udp: clear the connection structure after free
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-16 13:46:02 +08:00
chao.an
40f056e92c net/local: correct the socket flags from server socket
newsock = accept(server, &addr, &addrlen);

replace the socket flags from newsock to server to ensure that
the nonblock flags is handled correctly

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-15 23:04:59 +09:00
Xiang Xiao
8b7d08f59a net: Reoder the initialize sequence(mac->ip->tcp/udp)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 19:24:17 +02:00
Xiang Xiao
7598070508 net: Remove the unnecessary initialization code
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 19:24:17 +02:00
Xiang Xiao
4d0fcc2526 net/igmp: Remove igmp_initialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 19:24:17 +02:00
Xiang Xiao
19ec0b4fe3 net/route: Remove net_init_fileroute
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 19:24:17 +02:00
Xiang Xiao
7028531e74 net/tcp: Remove tcp_listen_initialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 19:24:17 +02:00
Xiang Xiao
716e27cbeb net/local: Remove local_initialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 19:24:17 +02:00
Xiang Xiao
9c1fc8da4e net: Remove net_lockinitialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 19:24:17 +02:00
Xiang Xiao
b2c86f808d net: Remove psock_fcntl related code
since the nonblocking mode set through psock_ioctl now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-04 22:03:55 +02:00
Xiang Xiao
4a16cf71f9 Fix -Werror=nonnull-compare and -Werror=format-truncation=
Error: module/mod_insmod.c:203:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
  203 |   strncpy(modp->modname, modname, MODLIB_NAMEMAX);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wqueue/kwork_thread.c: In function 'work_start_lowpri':
Error: wqueue/kwork_thread.c:212:22: error: '%lx' directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Werror=format-truncation=]
  212 |   snprintf(args, 16, "0x%" PRIxPTR, (uintptr_t)wqueue);

local/local_sockif.c: In function 'local_getsockname':
Error: local/local_sockif.c:392:11: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  392 |           strncpy(unaddr->sun_path, conn->lc_path, namelen);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

chip/esp32_wifi_utils.c: In function 'esp_wifi_scan_event_parse':
Error: chip/esp32_wifi_utils.c:373:37: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
   memset(ap_list_buffer, 0x0, sizeof(ap_list_buffer));
                                     ^

stdio/lib_fputs.c: In function 'fputs':
Error: stdio/lib_fputs.c:99:9: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s == NULL || stream == NULL)
         ^
Error: stdio/lib_fputs.c:99:27: error: nonnull argument 'stream' compared to NULL [-Werror=nonnull-compare]
   if (s == NULL || stream == NULL)
                           ^

stdio/lib_vfprintf.c: In function 'vfprintf':
Error: stdio/lib_vfprintf.c:40:6: error: nonnull argument 'stream' compared to NULL [-Werror=nonnull-compare]
   if (stream)
      ^

string/lib_strdup.c: In function 'strdup':
Error: string/lib_strdup.c:39:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

string/lib_strndup.c: In function 'strndup':
Error: string/lib_strndup.c:56:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

string/lib_strpbrk.c: In function 'strpbrk':
Error: string/lib_strpbrk.c:39:7: error: nonnull argument 'str' compared to NULL [-Werror=nonnull-compare]
   if (!str || !charset)
       ^~~~
Error: string/lib_strpbrk.c:39:15: error: nonnull argument 'charset' compared to NULL [-Werror=nonnull-compare]
   if (!str || !charset)
               ^~~~~~~~

string/lib_strrchr.c: In function 'strrchr':
Error: string/lib_strrchr.c:40:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

Error: time/lib_asctimer.c:73:50: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 12 [-Werror=format-truncation=]
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
                                                  ^~
time/lib_asctimer.c:73:21: note: directive argument in the range [-2147481748, 2147483647]
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
time/lib_asctimer.c:73:3: note: 'snprintf' output between 17 and 68 bytes into a destination of size 26
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            g_wday_name[tp->tm_wday], g_mon_name[tp->tm_mon],
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec,
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            1900 + tp->tm_year);
            ~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-02 15:55:38 +08:00
Alexander Lunev
404ceffae2 tcp: added debug asserts and logging to investigate the rare (conn->dev == NULL) bug in callback handlers 2022-02-26 11:48:07 -03:00
Alin Jerpelea
990cd877bc drivers: net: exclude BSD components from build
Unless ALLOW_BSD_COMPONENTS is enabled support will not be built

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-02-24 22:48:47 +08:00
chao.an
61fa5d70f5 devif/ipv6_input.c: fix compile warning
devif/ipv6_input.c: In function ‘ipv6_input’:
devif/ipv6_input.c:344:32: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
  344 |       if ((ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff00)) &&
      |                                ^
devif/ipv6_input.c:345:32: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
  345 |           (ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff01)) &&
      |                                ^
devif/ipv6_input.c:346:32: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
  346 |           (ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff02)))
      |                                ^

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-18 16:05:20 +08:00
chao.an
f073ed3a44 net/tcp: add support for send timeout on buffer mode
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-18 16:04:55 +08:00
chao.an
1911ae2192 net/tcp: add interface tcp_wrbuffer_timedalloc()
add new interface to support alloc wrbuffer with timeout

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 21:27:39 +01:00
chao.an
a92d5f622e net/ioballoc: add support of alloc with timeout net_iobtimedalloc()
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 21:27:39 +01:00
chao.an
c73df52c46 net/socket: fix shadow variable
socket/setsockopt.c: In function ‘psock_socketlevel_option’:
socket/setsockopt.c:168:38: warning: declaration of ‘conn’ shadows a previous local [-Wshadow]
  168 |               FAR struct tcp_conn_s *conn;
      |                                      ^~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 17:55:16 +01:00
raiden00pl
cbbe1c661e net/can/can_recvmsg.c: fix unused variable 'conn' error 2022-02-14 10:42:01 +08:00
raiden00pl
5b678ab12e net/can/can_setsockopt.c: fix assertion, value can be NULL 2022-02-13 23:16:00 +08:00
Alexander Lunev
774994b951 net/tcp: support for FIN+ACK case in tcp send event handlers 2022-02-13 03:20:18 +08:00
chao.an
98833affd0 net/can: remove psock reference from can connect
remove the psock back reference since timestamp
has been migrated to can_conn_s

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-11 21:22:55 +08:00
chao.an
369f7cc451 net/rpmsg: fix the NULL pointer reference on nonblock accept
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-11 21:22:45 +08:00
chao.an
e749f6ca7e net/tcp/monitor: do not migrate the state to close
1. remove the unnecessary interfaces tcp_close_monitor()

socket flags(s_flags) is a global state for net connection
remove the incorrect update for stop monitor

2. do not start the tcp monitor from duplicated psock

the tcp monitor has already registered in connect callback

------------------------------------------------------------
This patch also fix the telnet issue reported by:
https://github.com/apache/incubator-nuttx/pull/5434#issuecomment-1035600651

the orignal session fd is closed after dup, the connect state
has incorrectly migrated to close:

drivers/net/telnet.c:
 977 static int telnet_session(FAR struct telnet_session_s *session)
 ...
 1031   ret = psock_dup2(psock, &priv->td_psock);
 ...
 1082   nx_close(session->ts_sd);

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-11 18:56:40 +09:00
chao.an
eac13a113d net/udp: remove psock hook to avoid invalid reference
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
8fb2468785 net/tcp: remove the socket hook reference from netdev callback
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
0d19a3a248 net/inet: move socket timestamp into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
9317626c32 net/inet: move socket linger into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
3fce144aeb net/inet: move recv/send timeout into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
cc6add58dc net/inet: move socket options into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
1659513edb net/inet: move socket error into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
99cde13a11 net/inet: move socket flags into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
1b0f85c5bc net/ieee802154: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
43ca28da36 net/can: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
8366c87c5b net/bluetooth: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
8f63596063 net/tcp: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
af1cf5eaae net/local: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
3d62d5106d net/local: remove duplicate assert condition
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
63173dadbb net/pkt: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
e02711e114 net/icmpv6: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
2026450333 net/udp: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
1f4de9e13c net/icmp: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
f7bf28deac net/usrsock: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
69c4f6651e net/netlink: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
39e142243d net/tcp/udp: move the send callback into tcp/udp structure
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an
b16e022ead netdev/lladdrsize: remove invalid duplicate case
error:
--------------------------------------
netdev/netdev_lladdrsize.c: In function ‘netdev_lladdrsize’:
netdev/netdev_lladdrsize.c:148:7: error: duplicate case value
  148 |       case NET_LL_BLUETOOTH:
      |       ^~~~
netdev/netdev_lladdrsize.c:119:7: note: previously used here
  119 |       case NET_LL_BLUETOOTH:
      |       ^~~~

BLUETOOTH_HDRLEN has been removed by:
---------------------------------
|commit aae0d92598
|Author: Gregory Nutt <gnutt@nuttx.org>
|Date:   Sun Apr 1 15:21:58 2018 -0600
|
|wireless/bluetooth and net/bluetooth:
|
|Clean up some garbage left in Kconfig file that broke 'make menuconfig'.
|Clean up some craziness with Bluetooth frame length definitions.

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-07 20:08:26 +08:00
chao.an
83f8996c39 net/sixlowpan: fix compile warning
sixlowpan/sixlowpan_input.c: In function ‘sixlowpan_dispatch’:
sixlowpan/sixlowpan_input.c:629:3: warning: implicit declaration of function ‘pkt_input’;
                                   did you mean ‘ipv6_input’? [-Wimplicit-function-declaration]
  629 |   pkt_input(&radio->r_dev);
      |   ^~~~~~~~~
      |   ipv6_input

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-07 19:22:25 +08:00
chao.an
7480cc2835 net/devif: remove invalid NET_IPv4_REASSEMBLY definition
NET_IPv4_REASSEMBLY has been removed by:
--------------------------------------------------------
|  commit 68b526b335
|  Author: Brennan Ashton <bashton@brennanashton.com>
|  Date:   Tue Dec 1 22:59:00 2020 -0800
|
|      tcp: Remove incomplete support for TCP reassembly
--------------------------------------------------------

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-07 18:31:31 +08:00
Xiang Xiao
108a5004c5 net/local: Rename NET_LOCAL_PATH_PREFIX to NET_LOCAL_VFS_PATH
align with other similiar config which suffix with _VFS_PATH

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-06 19:42:00 +01:00
raiden00pl
bc178344a9 net/can: add an option to control CAN EXTID support 2022-02-06 17:09:11 +08:00
chao.an
56b5ae0640 net/tcp/netdev/mld: correct the netlock handling
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-03 11:09:18 -03:00
Alexander Lunev
b2f3cefe3d sim/netdev,tapdev: implemented emulation of TX done and RX ready interrupts
and removed two tcp_send_txnotify() calls from tcp_sendfile (they are not needed anymore).

As a result, the TX throughput of both the tcp_send_buffered and tcp_send_unbuffered
is significantly boosted in case of TUN/TAP network device.
2022-01-28 18:16:42 +08:00
Alexander Lunev
2a6de301ee net/tcp: transformed NET_TCP_FAST_RETRANSMIT_WATERMARK option to boolean.
According to RFC 5681 (3.2) the TCP Fast Retransmit algorithm should start
if the threshold of 3 duplicate ACKs is reached.
Thus the threshold should be a constant, not an integer option.
2022-01-26 11:50:48 +08:00
Alexander Lunev
8be9cb9f72 net/tcp/sendfile: notify the device driver of the availability of TX data on TCP retransmission
(as well as on sending normal TCP packets).
2022-01-26 02:01:25 +08:00
Alexander Lunev
7e748e63dd net/tcp/tcp_sendfile: optimized out sendfile_txnotify() function 2022-01-26 02:01:06 +08:00
Alexander Lunev
ad25c43983 net/tcp/sendfile: fast retransmit on duplicate acknowledgments (RFC 5681).
(the same as it was implemented in tcp_send_unbuffered.c)
2022-01-25 16:30:38 +08:00
Alexander Lunev
eec94132c4 net/tcp/sendfile: removed excessive overwrites of conn->sndseq
(conn->sndseq was updated in multiple places that was unreasonable and complicated).
This optimization is the same as it was done for tcp_send_unbuffered.
2022-01-22 00:43:53 +08:00
Alexander Lunev
338b122b2b net/tcp/sendfile: fixed an issue with unackseq calculation.
Wrong unackseq calculation locked conn->tx_unacked at non-zero values
even if all ACKs were received.
This issue is the same as it was with tcp_send_unbuffered.
2022-01-22 00:42:29 +08:00
Alexander Lunev
c9e32dd4a4 tcp: fixed warning: ISO C90 forbids mixed declarations and code 2022-01-22 00:41:42 +08:00
Alexander Lunev
64dd669749 net/tcp/sendfile: retransmit only one the earliest not acknowledged segment
(according to RFC 6298 (5.4)). The issue is the same as it was in tcp_send_unbuffered.c.
2022-01-20 18:37:39 +08:00
Petro Karashchenko
08043fb5bc net: unify FAR keyword usage for all net buffer memory mapped buffers
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-20 01:42:56 +08:00
chao.an
086fb829fd net/usrsock: fix build warning
usrsock/usrsock_sockif.c:72:3: warning:
initialization of ‘int (*)(struct socket **)’ from incompatible pointer type
‘int (*)(struct socket *, int,  void *, size_t)’ {aka ‘int (*)(struct socket *, int,  void *, long unsigned int)’} [-Wincompatible-pointer-types]
   72 |   usrsock_ioctl               /* si_ioctl */
      |   ^~~~~~~~~~~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-19 12:09:53 +01:00
Alexander Lunev
6bb7a92a9a net/tcp/tcp_send*: added debug asserts for TCP_ACKDATA, TCP_REXMIT and TCP_DISCONN_EVENTS flags 2022-01-19 10:45:38 +08:00
Alexander Lunev
79e609a8c8 net/tcp/sendfile: swapped the location of TCP_DISCONN_EVENTS and TCP_ACKDATA conditions towards tcp_send_unbuffered.c unification 2022-01-19 00:13:38 +08:00
Petro Karashchenko
9551de7115 net: use HTONS, NTOHS, HTONL, NTOHL macro in kernel code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-18 10:59:47 +01:00
Alexander Lunev
5b13797cce net/tcp/tcp_send*: reliably obtain the TCP connection pointer in TCP event handlers
Do not use pvconn argument to get the TCP connection pointer because pvconn is
normally NULL for some events like NETDEV_DOWN. Instead, the TCP connection pointer
can be reliably obtained from the corresponding TCP socket.
2022-01-18 16:14:38 +08:00
Alexander Lunev
f61f276120 net/tcp/sendfile: TCP retransmission could not start because of incorrect snd_ackcb callback handling:
Both the snd_ackcb and snd_datacb callbacks were created and destroyed right after sending every packet.
Whenever TCP_REXMIT event occurred due to TCP send timeout, TCP_REXMIT was ignored because
snd_ackcb callback had been destroyed by the time.
The issue is fixed as follows:
- both the snd_ackcb and snd_datacb callbacks are combined into one snd_cb callback
  (the same way as in tcp_send_unbuffered.c).
- the snd_cb callback lives until all requested data (via sendfile) is sent,
  including all ACKs and possible retransmissions.

As a positive side effect of the code optimization / fix, sendfile TCP payload throughput is increased.
2022-01-18 02:03:40 +08:00
chao.an
a9d0dd7051 net/netlink: fix build warning if disable CONFIG_NETLINK_ROUTE
netlink/netlink_sockif.c: In function ‘netlink_sendmsg’:
netlink/netlink_sockif.c:676:10: warning: unused variable ‘len’ [-Wunused-variable]
  676 |   size_t len = msg->msg_iov->iov_len;
      |          ^~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-17 13:34:49 +08:00
chao.an
0d7f12c489 net/icmp: fix build break if enable NET_ALLOC_CONNS
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-17 13:34:49 +08:00
Alexander Lunev
0f080cdeaf net/tcp/sendfile: NET_TCP_WRITE_BUFFERS and NET_SENDFILE were inconsistent with each other:
tcp_sendfile() reads data directly from a file and does not use NET_TCP_WRITE_BUFFERS data flow
even if CONFIG_NET_TCP_WRITE_BUFFERS option is enabled.
Despite this, tcp_sendfile relied on NET_TCP_WRITE_BUFFERS specific flow control variables that
were idle during sendfile operation. Thus it was a total inconsistency.

E.g. because of the issue, TCP socket used by sendfile() operation never issued
FIN packet on close() command, and the TCP connection hung up.

As a result of the fix, simultaneously enabled CONFIG_NET_TCP_WRITE_BUFFERS and
CONFIG_NET_SENDFILE options can coexist.
2022-01-17 01:42:41 +08:00
Petro Karashchenko
8d3bf05fd2 include: fix double include pre-processor guards
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-16 11:11:14 -03:00
Alexander Lunev
8042de1145 net/devif/devif_callback.c: devif_callback_free() call is not needed anymore in devif_callback_alloc() 2022-01-06 22:47:18 +08:00
Xiang Xiao
e27962a997 net/devif: Fix the memory leak in case of netdev isn't alive
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-05 22:01:13 +08:00
raiden00pl
a8ca1ec026 SocketCAN: add CAN error definitions 2022-01-05 18:32:46 +08:00
chao.an
4603d108be net/usrsock: add support for CONFIG_NET_ALLOC_CONNS
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-05 12:39:00 +08:00
chao.an
cbe9352f41 net/usrsock: remove the connections limit
replace xid type to uint64_t to avoid connections limit

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-05 12:38:42 +08:00
chao.an
504f1d1b5f net/misc: add support for CONFIG_NET_ALLOC_CONNS
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-04 14:36:07 +08:00
chao.an
a1bf9ca88b net/icmp[v6]: add support for CONFIG_NET_ALLOC_CONNS
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-04 14:36:07 +08:00
raiden00pl
6185377eec net/devif/devif_cansend.c: fix assertion for max data len 2022-01-03 08:52:49 -03:00
raiden00pl
649619b8f8 net/can/can_recvmsg.c: fix warning 2022-01-03 08:52:49 -03:00
Xiang Xiao
43c28c4456 net/usrsock: Fix the compile warning
In file included from usrsock/usrsock_bind.c:32:
usrsock/usrsock_bind.c: In function ‘usrsock_bind’:
usrsock/usrsock_bind.c:183:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  183 |       nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                            |
      |                                                            ssize_t {aka long int}
usrsock/usrsock_bind.c:183:54: note: format string is defined here
  183 |       nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                                                     ~^
      |                                                      |
      |                                                      int
      |                                                     %ld
CC:  usrsock/usrsock_connect.c
CC:  usrsock/usrsock_dev.c
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_event’:
usrsock/usrsock_dev.c:488:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  488 |             nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                    |
      |                                                    size_t {aka long unsigned int}
usrsock/usrsock_dev.c:488:40: note: format string is defined here
  488 |             nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
      |                                       ~^
      |                                        |
      |                                        int
      |                                       %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:488:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
  488 |             nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       ~~~~~~~~~~~~
      |                                                         |
      |                                                         long unsigned int
usrsock/usrsock_dev.c:488:45: note: format string is defined here
  488 |             nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
      |                                            ~^
      |                                             |
      |                                             int
      |                                            %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_datareq_response’:
usrsock/usrsock_dev.c:657:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  657 |       nwarn("%dth buffer not large enough (need: %d, have: %d).\n",
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  660 |             conn->resp.datain.iov[iovpos].iov_len);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          size_t {aka long unsigned int}
usrsock/usrsock_dev.c:657:61: note: format string is defined here
  657 |       nwarn("%dth buffer not large enough (need: %d, have: %d).\n",
      |                                                            ~^
      |                                                             |
      |                                                             int
      |                                                            %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:678:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  678 |           nwarn("%dth buffer not large enough "
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  682 |                 conn->resp.datain.iov[iovpos].iov_len);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                              |
      |                                              size_t {aka long unsigned int}
usrsock/usrsock_dev.c:679:45: note: format string is defined here
  679 |                 "(need: %" PRId32 ", have: %d).\n",
      |                                            ~^
      |                                             |
      |                                             int
      |                                            %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_req_response’:
usrsock/usrsock_dev.c:745:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  745 |       nwarn("message too short, %d < %d.\n", len, hdrlen);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                              |
      |                                              size_t {aka long unsigned int}
usrsock/usrsock_dev.c:745:34: note: format string is defined here
  745 |       nwarn("message too short, %d < %d.\n", len, hdrlen);
      |                                 ~^
      |                                  |
      |                                  int
      |                                 %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_write’:
usrsock/usrsock_dev.c:858:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  858 |           nwarn("message too short, %d < %d.\n", len,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                  |
      |                                                  size_t {aka long unsigned int}
usrsock/usrsock_dev.c:858:38: note: format string is defined here
  858 |           nwarn("message too short, %d < %d.\n", len,
      |                                     ~^
      |                                      |
      |                                      int
      |                                     %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:858:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
  858 |           nwarn("message too short, %d < %d.\n", len,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  859 |                 sizeof(struct usrsock_message_common_s));
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 long unsigned int
usrsock/usrsock_dev.c:858:43: note: format string is defined here
  858 |           nwarn("message too short, %d < %d.\n", len,
      |                                          ~^
      |                                           |
      |                                           int
      |                                          %ld
CC:  usrsock/usrsock_getpeername.c
In file included from usrsock/usrsock_getpeername.c:32:
usrsock/usrsock_getpeername.c: In function ‘usrsock_getpeername’:
usrsock/usrsock_getpeername.c:190:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  190 |       nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                            |
      |                                                            ssize_t {aka long int}
usrsock/usrsock_getpeername.c:190:54: note: format string is defined here
  190 |       nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                                                     ~^
      |                                                      |
      |                                                      int
      |                                                     %ld
CC:  usrsock/usrsock_event.c
CC:  usrsock/usrsock_getsockname.c
In file included from usrsock/usrsock_getsockname.c:32:
usrsock/usrsock_getsockname.c: In function ‘usrsock_getsockname’:
usrsock/usrsock_getsockname.c:190:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  190 |       nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                            |
      |                                                            ssize_t {aka long int}
usrsock/usrsock_getsockname.c:190:54: note: format string is defined here
  190 |       nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                                                     ~^
      |                                                      |
      |                                                      int
      |                                                     %ld
CC:  usrsock/usrsock_getsockopt.c
CC:  usrsock/usrsock_poll.c
CC:  usrsock/usrsock_recvmsg.c
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c: In function ‘usrsock_recvmsg’:
usrsock/usrsock_recvmsg.c:321:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  321 |               nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                                    |
      |                                                                    ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:321:62: note: format string is defined here
  321 |               nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                                                             ~^
      |                                                              |
      |                                                              int
      |                                                             %ld
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c:343:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  343 |                   nerr("net_timedwait errno: %d\n", ret);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                     |
      |                                                     ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:343:47: note: format string is defined here
  343 |                   nerr("net_timedwait errno: %d\n", ret);
      |                                              ~^
      |                                               |
      |                                               int
      |                                              %ld
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c:384:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  384 |           nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                                |
      |                                                                ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:384:58: note: format string is defined here
  384 |           nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                                                         ~^
      |                                                          |
      |                                                          int
      |                                                         %ld
CC:  usrsock/usrsock_sendmsg.c
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c: In function ‘usrsock_sendmsg’:
usrsock/usrsock_sendmsg.c:302:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  302 |               nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                                    |
      |                                                                    ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:302:62: note: format string is defined here
  302 |               nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                                                             ~^
      |                                                              |
      |                                                              int
      |                                                             %ld
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c:324:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  324 |                   nerr("net_timedwait errno: %d\n", ret);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                     |
      |                                                     ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:324:47: note: format string is defined here
  324 |                   nerr("net_timedwait errno: %d\n", ret);
      |                                              ~^
      |                                               |
      |                                               int
      |                                              %ld
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c:364:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  364 |           nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                                |
      |                                                                ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:364:58: note: format string is defined here
  364 |           nwarn("usrsock_setup_request_callback failed: %d\n", ret);
      |                                                         ~^
      |                                                          |
      |                                                          int
      |                                                         %ld

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-03 11:19:32 +08:00
Alexander Lunev
e9ab3adf23 net/tcp(unbuffered): advance sndseq by +1 because SYN and FIN occupy one sequence number (RFC 793) 2022-01-03 12:18:44 +09:00
Alexander Lunev
0afb1d8dbb net/tcp(unbuffered): fast retransmit on duplicate acknowledgments 2022-01-02 23:25:09 +08:00
chao.an
f345f3dc2e net/devif_callback: add support for CONFIG_NET_ALLOC_CONNS
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-02 01:25:14 +08:00
chao.an
3b490d4e3a net/icmp: post the semaphore if multiple references
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-02 01:23:23 +08:00
chao.an
26370cd2f7 net/udp: add support for CONFIG_NET_ALLOC_CONNS
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-01 20:40:02 +08:00
chao.an
38b7b3d26a net/tcp: add support for CONFIG_NET_ALLOC_CONNS 2022-01-01 20:40:02 +08:00
chao.an
581b67ade3 net: add config to support allocate connect dynamically
add config CONFIG_NET_ALLOC_CONNS to support allocate connect.
Use this feature if the number of connections can not be determined at
compile time. When enabled the stack will be compiled without the static
pre-allocate connection list and all connection instances will be dynamically
allocated from heap at run time.

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-01 20:40:02 +08:00
Alexander Lunev
2b60468845 net/tcp(unbuffered): removed excessive overwrites of conn->sndseq
(conn->sndseq was updated in multiple places that was unreasonable and complicated).
2021-12-29 05:35:23 -06:00
Norman Rasmussen
48311cc61f Fix unaligned memory access when creating ICMP Port Unreachable messages
commit 3b69d09c80 corrected the
unreachable handling for net/udp/icmp but introduced an unaligned store.
This splits the uint32_t data field into a two element uint16_t data
field to avoid the unaligned store.
2021-12-28 03:51:53 -06:00
Petro Karashchenko
3ccb657dc2 nuttx: remove space befone newline in logs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-27 21:01:19 -06:00
Alexander Lunev
e68ffb9f99 net/tcp(unbuffered): fixed an issue with unackseq calculation.
Wrong unackseq calculation locked conn->tx_unacked at non-zero values
even if all ACKs were received. Thus unbuffered psock_tcp_send() never completed.
2021-12-27 20:59:48 -06:00
Alexander Lunev
19dc121a4f net/tcp(unbuffered): fixed an issue with tx_unacked overflow that occurred if NET_TCP_WINDOW_SCALE option was enabled.
If the remote TCP receiver advertised TCP window size greater than 64 KB
and TCP ACK packets returned to the NuttX TCP sender with a significant delay,
tx_unacked variable overflowed and further TCP send stalled forever
(until TCP re-connection).
2021-12-27 11:05:01 -06:00
Xiang Xiao
dfcb3cea59 Replace self defined macros with NET_SOCK_[FAMILY|TYPE|PROTOCOL]
NET_SOCK_* is defined by nuttx/net/netconfig.h and then can be shared

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-21 11:02:33 -03:00
Juha Niskanen
422ceec99b Fix typos in comments and Kconfig files
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-12-21 03:26:16 -06:00
chao.an
1e83c83bf3 net/usrsock: increase the send/recv() length limit to UINT32_MAX
change request type to uint32_t to the impove the throughput

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-21 03:14:25 -06:00
Xiang Xiao
c562263205 net: Move if_nametoindex and if_indextoname to libc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-19 10:08:57 -06:00
chao.an
b10dcf7c0d net/udp: fix the invaild udp destination address
If the udp socket not connected, it is possible to have
multi-different destination address in each iob entry,
update the remote address every time to avoid sent to the
incorrect destination.

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-17 11:25:06 -06:00
chao.an
0ee7400fdf net/tcp: fix send deadlock if disconnect
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-16 01:29:10 -06:00
Petro Karashchenko
51a2db6ffc Kconfig: improve uniformity
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-14 07:32:48 -06:00
ligd
5c5bd7161c socket_rpmsg: fix ept_cb crash on server side
after correct:
client:                 server
connect                 ns_bind --> create new conn --> create_ept
                        accept  --> set conn->psock to newpsock

Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 21:15:59 -06:00
ligd
4a5d577483 socket_rpmsg: add socket_rpmsg_ioctl support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 21:15:59 -06:00
ligd
aab5d3d390 rpmsg_socket: handle block/nonblock while send/recv
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 21:15:59 -06:00
ligd
be70ab2ebb rpmsg_scoket: handle race condition on ept_cb RPMSG_SOCKET_CMD_SYNC
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 21:15:59 -06:00
ligd
d0486be2a3 socket_rpmsg: fix conn->psock NULL in ept_cb
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 21:15:59 -06:00
ligd
68bbcf74c4 local_socket: filename use "/var/socket/xx" instead of "/var/socketxx"
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 02:37:11 -06:00
songlinzhang
22df553443 net/arp: clean the arp table when netdev carrier off
Fix the arp address changed if netdev renew, since the
arp table should be cleared when the netdev carrier off

Signed-off-by: songlinzhang <songlinzhang@xiaomi.com>
2021-11-27 06:19:50 -06:00
chao.an
3b69d09c80 net/udp/icmp: correct the unreadchable handling
Reference RFC1122:
https://datatracker.ietf.org/doc/html/rfc1122
----------------------------------------------

4.1.3  SPECIFIC ISSUES

  4.1.3.1  Ports

    If a datagram arrives addressed to a UDP port for which
    there is no pending LISTEN call, UDP SHOULD send an ICMP
    Port Unreachable message.

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-11-26 08:47:54 -06:00
Alin Jerpelea
4ca25d8a4d net: usrsock: Haltian Ltd: update licenses to Apache
Gregory Nutt has submitted the SGA
Haltian Ltd has submitted the SGA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-11-15 06:49:32 -06:00
Alexander Lunev
1e07b6d528 net/tcp(unbuffered): retransmit only one the earliest not acknowledged segment
(according to RFC 6298 (5.4)).
2021-11-10 12:21:07 -06:00
YAMAMOTO Takashi
ecd6a3572b net/tcp/Kconfig: Remove NET_TCP_SPLIT
While it's a neat idea, it doesn't work well in reality.

* Many of modern tcp stacks don't obey the "ack every other packet"
  rule these days. (Linux, macOS, ...)

* Even if a traditional TCP implementation is assumed, we can't
  predict/control which packets are acked reliably. For example,
  window updates can easily mess up our strategy.
2021-11-04 13:32:57 -05:00
YAMAMOTO Takashi
28d168e1b8 tcp_send_unbuffered.c: Fix nxstyle errors 2021-11-04 13:32:57 -05:00
YAMAMOTO Takashi
1550a525e9 tcp_send_unbuffered.c: unifdef -UCONFIG_NET_TCP_SPLIT 2021-11-04 13:32:57 -05:00
ligd
022c06766a socket_rpmsg: use ns_bound to send SYNC packet
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-04 13:29:51 -05:00
ligd
883d66b906 socket_rpmsg: fix save rp_name error when accept
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-04 13:29:51 -05:00
ligd
00ef4fca51 rpmgs_socket: set RPMSG_SOCKET_NAME_SIZE to 16 for handing prefix
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-04 13:29:51 -05:00
ligd
59ae421314 socket_rpmsg: support SOCK_SEQPACKET
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-04 13:29:51 -05:00
ligd
bb41af3935 rpmsg_socket: move rpmsg_send out of lock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-04 13:29:51 -05:00
ligd
391ccdc42b local_socket: recv should return 0 NOT -ECONNRESET if remote closed
ref:
https://man7.org/linux/man-pages/man2/recv.2.html

Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-02 08:59:06 +01:00
ligd
1970ce5116 local_socket: set lc_peer when accept() instead of connect()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-02 08:59:06 +01:00