Petro Karashchenko
0a28b2a26e
net/bluetooth: fix parameter indentation
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-04-24 09:35:58 -07:00
zhanghongyu
9162800255
tcp_input: drop SYN when no free node in the backlog
...
Wait for the client to retransmit the ack before trying to allocate the
backlog
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-04-24 01:52:33 +08:00
Zhe Weng
1aceb1d872
net/tcp: Fix clear condition in ofoseg input
...
We have a case that an http server gives out-of-ordered ACKs, and NuttX client makes `ofoseg`s with length 0, trying to rebuild / put them into `ofosegs` array, which is not intended (no available data and should be skipped). This breaks later logic and finally crashed in `tcp_ofoseg_bufsize` (`ofosegs[i].data` is `NULL`, which should never happen in normal logic).
Note:
- `iob_trimhead` won't return `NULL` when it's applying on normal IOB.
- Keep `dev->d_iob == NULL` to avoid `iob_trimhead` changed.
- `iob_free_chain` will do nothing when applied to `NULL`.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-04-22 19:26:22 +08:00
zhanghongyu
6c73221dd4
forward: limit the forwarding range of broadcast packets
...
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-04-22 19:24:46 +08:00
Xiang Xiao
c6d210289f
procfs: remove procfs_ from procfs_operations variables
...
to aglin the naming style with other implementation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
149cafe450
procfs: Add g_ prefix to all procfs_operations
...
to conform the coding style
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
zhanghongyu
93c3b8f19e
tcp: add TCP_MAXSEG support
...
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-04-22 01:42:47 +08:00
zhanghongyu
bd4d7a1b76
tcp: accept conn inherits some properties of listener conn
...
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-04-22 01:42:47 +08:00
zhanghongyu
fdc6dbf176
netlink: add RTM_NEWADDR, RTM_DELADDR and RTM_GETADDR
...
We have projects that need to sense ip address changes in time,
and set ip address or clear ip address through netlink
so the relevant implementation is added.
The usage and command structure are consistent with linux
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-04-22 01:35:18 +08:00
Zhe Weng
9f8d587b64
net/rpmsg: Set family for rpaddr in ns_bind
...
The rpmsg addr get from socket accept has rp_family=0, which is not
intended, to avoid wrong logic in other place, set the rp_family
in ns_bind function.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-04-21 13:18:48 +03:00
zhangyuan21
c239d19df0
nuttx: add more dependent header file
...
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-04-11 09:13:32 +03:00
Zhe Weng
b058f37353
net/tcp: Reply RST when we cannot receive data
...
According to RFC 2525, Section 2.17:
"When an application closes a connection in such a way that it can no longer read any received data, the TCP SHOULD, per section 4.2.2.13 of RFC 1122, send a RST if there is any unread received data, or if any new data is received."
When our TCP socket is closed (even when the thread has exited), the peer can keep sending data and NuttX keeps replying ACK (we've tried for ~12h). This is not a good behavior (also different from Linux), so send RST instead of ACK for data receiving in FIN_WAIT.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-03-29 09:22:00 -03:00
Zhe Weng
61ff04b9e2
net/inet: Only setup poll for UDP when s_type == SOCK_DGRAM
...
Problem:
A SOCK_CTRL socket may be led to udp_pollsetup but never reaches
udp_pollteardown, it seems that we shouldn't call udp_pollsetup for
other socket types.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-03-29 09:18:36 -03:00
zhanghongyu
ec2b74df77
icmpv6: add RDNSS field support for send route advertise
...
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-03-17 16:50:37 -03:00
zhanghongyu
d9e009cb46
icmpv6: add route advertise RDNSS field handle when icmpv6_input
...
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-03-17 16:50:37 -03:00
zhangyuan21
fd9792b4bd
net: use NXRMUTEX_INITIALIZER for rmutex init
...
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-03-15 13:57:08 +01:00
Zhe Weng
7b0d80c94a
net/icmpv6: align structs to 2 bytes.
...
Fix following misaligned errors:
icmpv6/icmpv6_radvertise.c:145:21: runtime error: member access within misaligned address 0x573da9e6 for type 'struct icmpv6_router_advertise_s', which requires 4 byte alignment
0x573da9e6: note: pointer points here
00 00 00 01 85 00 d6 14 00 00 00 00 01 01 12 8c 25 08 9c f8 04 00 00 00 ff 02 00 00 00 00 00 00
^
icmpv6/icmpv6_radvertise.c:167:21: runtime error: member access within misaligned address 0x573da9fe for type 'struct icmpv6_mtu_s', which requires 4 byte alignment
0x573da9fe: note: pointer points here
af 78 ab 72 00 00 00 00 00 00 00 01 ff 00 00 01 04 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 01
^
icmpv6/icmpv6_radvertise.c:176:23: runtime error: member access within misaligned address 0x573daa06 for type 'struct icmpv6_prefixinfo_s', which requires 4 byte alignment
0x573daa06: note: pointer points here
00 00 05 dc ff 00 00 01 04 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 01 ff 08 9c f8 04 00 00 00
^
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-03-10 09:41:02 +01:00
Xiang Xiao
75ecbd4382
net/local: Return the unblock handle correctly in local_accept
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-09 09:17:19 +01:00
Zhe Weng
0e018308a3
net/pkt: Add readahead queue for pkt, call input for tx on sim
...
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-03-08 23:09:25 +02:00
Xiang Xiao
9f4a15110c
net: Finish FIONBIO default action if si_ioctl return OK
...
Continue the work: https://github.com/apache/nuttx/pull/6976
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-07 11:34:35 +02:00
Xiang Xiao
3c3dea5d7a
net: Make si_poll callback optional
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Xiang Xiao
c39be172da
net: Make si_accept callback optional
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Xiang Xiao
5dd037c599
net: Make si_connect callback optional
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Xiang Xiao
a97e2523a4
net: Make si_listen callback optional
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Xiang Xiao
2553b7701c
net: Remove the empty si_getpeername implementation
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Xiang Xiao
9b3715050b
net: Make si_getsockname callback optional
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Xiang Xiao
b3c1c55805
net: Make si_bind callback optional
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Zhe Weng
7111d23ae4
net/arp: Only parse ioctl request for valid cmd.
...
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-03-06 10:51:12 -03:00
Fotis Panagiotopoulos
5e625b9cdb
Performance optimizations in connection allocations.
2023-02-28 14:23:16 +01:00
Xiang Xiao
2c5f653bfd
Remove the tail spaces from all files except Documentation
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 13:24:24 -08:00
Zhe Weng
0069eefd4b
net/udp: Add drop count when limited by recv bufsize
...
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-02-24 14:36:01 +02:00
lilei19
38f64f559d
change strcpy to strlcpy
...
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-24 12:15:40 +08:00
ligd
c4ed55c6df
socket: divide errno & s_error
...
Reference:
https: //man7.org/linux/man-pages/man2/connect.2.html
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-02-23 16:40:19 +01:00
ligd
f9b6255895
local_socket: remove the wrong assertion in local_listen()
...
if 2 threads call local_alloc() time and then do local_listen()
will meet this assertion
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-02-23 22:46:48 +08:00
Zhe Weng
31b65844a2
usrsock: Do not return error when conn not found for an event
...
There might be some cases that we receive an event after socket is closed because of out-of-ordered rpmsg, since it may not cause problem, we may omit the error.
Also change log level to err when returning negated errno, because if we return negated errno, we'll directly trigger RPMSG_ASSERT outside, so we need at least an error message to indicate the reason.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-02-22 01:42:14 +08:00
chao an
fcefd16586
net/devif: fix null pointer reference found out by coverity
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-21 00:44:07 +08:00
Fotis Panagiotopoulos
b6eb3c828c
Removed obsolete option NET_ALLOC_CONNS.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
b5b7d24ba1
Improvements in CAN connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
9b4d784307
Improvements in sockets allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
cf15d6b63a
Improvements in Netlink connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
74bb921a19
Improvements in packet connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
22a82b3f51
Improvements in IEEE 802.15.4 connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
c5cc70a8b1
Improvements in Bluetooth connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
90a93a7474
Improvements in ICMPv6 connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
1c07a3a696
Improvements in ICMP connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
f207072121
Improvements in usrsock connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
7f3591b9cc
Improvements in UDP connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
8f9dfe0be1
Improvements in TCP connections allocation.
2023-02-20 09:06:46 +08:00
Fotis Panagiotopoulos
85ceb7920e
Typo fixes.
2023-02-17 11:17:11 -03:00
SPRESENSE
277e0b941a
include/sys/socket.h: Add SOCK_CTRL to socket type
...
SOCK_CTRL is added to provide special control over network drivers
and daemons. Currently, SOCK_DGRAM and SOCK_STREAM perform this control,
but these use socket resources. In the case of usersocket in particular,
this is a waste of the device's limited socket resources.
2023-02-16 12:13:01 +09:00