1
0
Fork 0
forked from nuttx/nuttx-update
Commit graph

3105 commits

Author SHA1 Message Date
Kian Karas
832a76542f net/netlink: improve comments 2024-11-04 18:18:28 +08:00
Kian Karas
105dd04ee5 net/netlink: fix netlink poll return value on success
Make sure the return value is zero on success - as described in the
documentation of the function.

It doesn't look like the "error" affected any code.
2024-11-04 18:18:28 +08:00
wangchen
90e2395d6c netlink:add tls cleanup protection to protect waitsem in netlink_get_response
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-11-03 02:55:43 +08:00
wangchen
807c3a16e3 tcp:set NET_TCP_NPOLLWAITERS default value to 2 & add warning of different events having same event bit
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-11-03 02:55:02 +08:00
ouyangxiangzhen
17c51c0667 userspace: Exclude nuttx/arch.h
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-01 16:59:37 +08:00
yintao
265978d16a net/rpmsg: Don't set POLLHUP if rpmsg channel has not been established
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-31 15:35:03 +08:00
zhanghongyu
d5d9c501fa tcp_input: if tcp->req > recvreq, send ack only when state is TCP_ESTABLISHED
we will drop packet when tcp_close_eventhandler
is register and invoke by tcp_input. then we will always early return and
never stop, the peer will only close the connection if we send reset packet.

precondition:
close -> register tcp_close_eventhandler;

tcp_input -> tcp_callback(TCP_NEWDATA) -> devif_conn_event -> tcp_close_eventhandler
-> flags &= ~TCP_NEWDATA -> NOT entry tcp_data_event -> conn->recvreq NOT increase

old flow:
tcp_input -> tcp->seqno greater than conn->rcvseq -> tcp_send(TCP_ACK)

with this patch:
tcp_input -> tcp->seqno greater than conn->rcvseq -> !TCP_ESTABLISHED
-> case TCP_FIN_WAIT_1 -> dev->d_len greater than 0 -> tcp_reset

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-31 15:31:01 +08:00
zhanghongyu
583ff3b962 net/usrsock: usrsock supports offload netlink
supports the usrsock client to subscribe netlink events,
so that it can detect events such as link connection changes.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-28 19:42:05 +08:00
Xiang Xiao
32784b0898 libc: Refine the arc4random_buf implementation
fill the buffer with getrandom instead random pool
and move the implementation to from crypto to libc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-26 18:04:21 -03:00
zhanghongyu
824dfacd08 net/local: fix used after free
now the lc_path of the client will not be the same as that of the server.
therefore, accept->peer = NULL will not be set when the client release
the conn, then when release accept conn, set
client->peer(accept->peer->peer) = NULL will cause used after free

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-22 23:34:43 +08:00
wangchen
addfe127a9 socketpair.c:Replace kmm with fs heap
due to https://github.com/apache/nuttx/pull/13722/commits, In the socketpair.c,fs_heap interface replaces kmm interface

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-10-16 20:56:39 +08:00
Jukka Laitinen
ef827e88a7 net: Copy out also can cmsg data into the end of packet
This has been broken at some point. Just fix it by copying the can frame and
the cmsg data into IOB, and fix devif_poll to copy out the full data.

The can drivers expect to find the timeout timestamp in the end of the frame.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-16 15:39:11 +08:00
Jukka Laitinen
313b2cd1ed net/netdev/netdev_default.c: Exclude socket can from default devices
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-16 15:39:11 +08:00
wangxiaoxin
2a99490ed6 add a flag of lin internal sleep/wakeup state
Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
2024-10-16 14:33:59 +08:00
daichuan
a75ca4acf3 modify for set conn status with connected when receive event USRSOCK_EVENT_SENDTO_READY 2024-10-16 07:55:10 +08:00
hujun5
a567148888 sched: add up_this_task and up_change_task macro stub
reason:
We can utilize percpu storage to hold information about the
current running task. If we intend to implement this feature, we would
need to define two macros that help us manage this percpu information
effectively.

up_this_task: This macro is designed to read the contents of the percpu
              register to retrieve information about the current
              running task.This allows us to quickly access
              task-specific data without having to disable interrupts,
              access global variables and obtain the current cpu index.

up_update_task: This macro is responsible for updating the contents of
                the percpu register.It is typically called during
                initialization or when a context switch occurs to ensure
                that the percpu register reflects the information of the
                newly running task.

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-15 15:25:55 +08:00
liqinhui
4c85805be0 net/tcp: Reset the conn when receiving a ACK in the SYN_SENT state.
According to RFC793, Section 3.4, Page 33. In the SYN_SENT state, if receive a ACK without the SYN, we should reset the connection and retransmit the SYN.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2024-10-15 01:11:22 +08:00
yintao
d2fc3f21de net/rpmsg: use hash to handle rp_name
expand the user's rpname size
hash when exceed RPMSG_SOCKET_NAME_LEN due to the limitation of eptname

Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-13 11:33:04 +08:00
Xiang Xiao
cb2a6a3480 net/rpmsg: Minor cleanups
1.Simplify the message process in rpmsg_socket_send_single
2.Add more lock protection in rpmsg socket
3.Fix the style issue

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 11:33:04 +08:00
Xiang Xiao
3a32531a05 net/rpmsg: Remove all the special handle of "backlog == -1"
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 11:33:04 +08:00
Xiang Xiao
034215ab9c net/rpmsg: sendsize should be protected by sendlock not recvlock
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 11:33:04 +08:00
yintao
5b372a4706 rpmsg_sockif: add rpmsg_socket_ept_release for free conn
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-13 11:33:04 +08:00
Xiang Xiao
8ea51b3efc net/can: Save simple options to socket_conn_s
like other protocols(e.g. ip, tcp, udp)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 11:24:31 +08:00
wangchen
be17bf2f86 net:when work_cancel_sync is excuted,it releases net_lock
the modification is to solve the deadlock caused by work cancel not releasing netlock

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-10-13 02:05:26 +08:00
wangchen
b791e27a8d igmp_group.c:add work_cancel_sync in igmp_grpfree
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-10-13 02:05:26 +08:00
wangchen
78b64cc220 igmp_leave:add check of dev status in igmp_leavegroup
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-10-13 02:05:26 +08:00
wangchen
7dcbd235fc netdev:In netdev_default,If there is only one loopback network devices, it returns NULL
Referring to Linux,if there is only a loopback network device and the destination address does not belong to the loopback address, then the loopback network devices is not selected

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-10-13 02:02:54 +08:00
ligd
01676cb9cd local_socket: corrent send/recv return value after shutdown
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-12 09:57:20 +08:00
zhanghongyu
e4129d7f70 net/local: fix the return address is incorrect when accept
The argument addr is a pointer to a sockaddr structure.
This structure is filled in with the address of the peer socket,
as known to the communications layer.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-11 01:31:20 +08:00
hujun5
e249dd2672 arch: support customized up_cpu_index() in AMP mode
Some app with same code runs on different cores in AMP mode,
need the physical core on which the function is called.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-10-10 02:38:40 +08:00
fangzhenwei
a6f8730c51 local_sock: fix accept use-after-free
we should get next waiter before acceptor released

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2024-10-09 18:16:01 +08:00
zhangjun21
d21f10bea6 case SIOCGIWNAME: add filter out non-802.11 interfaces
netdev_wifr_ioctl SIOCGIWNAME cmd, need to filter out non-802.11 interfaces

Signed-off-by: zhangjun21 <zhangjun21@xiaomi.com>
2024-10-09 12:43:54 +08:00
Xiang Xiao
6493022047 netlink: Remove the dead code in netlink_close
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-09 12:38:54 +08:00
Xiang Xiao
06d5fe6b33 netlink: Format and algin netlink.h
refactor only, no functional change.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-09 12:38:54 +08:00
Xiang Xiao
b068e2357a circbuf: Move from mm/circbuf to libs/libc/misc
so that it can be used by userspace program.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-09 08:41:49 +08:00
wangxiaoxin
983f263ea6 add can/lin controller status
Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
2024-10-09 08:39:14 +08:00
ligd
f7f8f6c104 rpmsg_socket: add shutdown support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 08:36:19 +08:00
yintao
583dd00034 net/rpmsg: add SO_SNDBUF and SO_RCVBUF support
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-09 02:22:02 +08:00
zhangjun21
16124b0926 fix snprintf truncation warnings
gcc7.1 adds truncation warning, netdev_ifconf.c fix snprintf truncation warnings

Signed-off-by: zhangjun21 <zhangjun21@xiaomi.com>
2024-10-08 22:31:32 +08:00
daichuan
c32c8da761 fix compile warning with implicit declaration of function 'icmp_reply'
Signed-off-by: daichuan <daichuan@xiaomi.com>
2024-10-08 22:30:11 +08:00
daichuan
eebe18b802 fix compile warning with ipt_sockopt.c and ip6t_sockopt.c: implicit declaration of function 'popcount'
Signed-off-by: daichuan <daichuan@xiaomi.com>
2024-10-08 22:30:11 +08:00
Xiang Xiao
77821fb7eb net: Remove IFF_DOWN flag to compatible with Linux/*BSD
turn off interface by checking IFF_UP flag isn't set:
https://github.com/apache/nuttx/issues/1838

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-08 10:15:16 +08:00
Xiang Xiao
7c839d7a09 rptun: Remove include/nuttx/rptun/openamp.h
and use include/nuttx/rpmsg/rpmsg.h instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-07 00:44:28 +08:00
chenrun1
e0df067d3c accept4:move function from net to fs
Summary:
  Implementation in accept4 is special, the requested newsock is saved as filep->priv. This will cause sock_file_close to use fs_heap_free filep->priv during close. When fs_heap is configured, the released memory will not be on fs_heap, causing a crash.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-30 16:30:56 +08:00
zhanghongyu
8bb1e30884 net/arp: modify some flow of arp return failure.
If arp search fails once, subsequent searches for the ip will directly
return failure, and sends an asynchronous arp request to try to update
arp table in the future. In this way, the psock_sendmsg interface will
not block for a long time each time because arp cannot be obtained.

This scenario is triggered when a udp socket frequently attempts to
access an ip address that does not exist on the LAN.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-09-30 15:43:02 +08:00
wangchen
48ecb6f922 devif:fix issue about devif_callback being released wrongly,resulting in no access to it
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-09-28 16:06:36 +08:00
zhangshuai39
5e74ed8d34 net/tcp: Fix TCP keepalive time unit misuse problem
Summary:
  The conn->keeptimer units is decisecond,but its unit is treated as
half-second in the tcp_timer & tcp_get_timeout function.
  Therefore conn>keeptimer needs to be divided by 5(DSEC_PER_HSEC)
to match half-second units.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2024-09-25 10:04:41 -03:00
SPRESENSE
6a825f1ee7 net/usrsock: Clear usockid when USRSOCK_EVENT_ABORT is received
When usrsock receives a USRSOCK_EVENT_ABORT, it determines that
the usrsock daemon's socket is closed. Then usrsock clears the usockid.
2024-09-24 23:09:20 +08:00
wangyingdong
84f326a66b Fix the bug that netlink receive wait does not hang up
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2024-09-19 03:19:15 +08:00
Xiang Xiao
f76c2ed83b can: Add g_ prefix to can_dlc_to_len and len_to_can_dlc.
detail: Add g_ prefix to can_dlc_to_len and len_to_can_dlc to
follow NuttX coding style conventions for global symbols,
improving code readability and maintainability.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-09-18 23:50:11 +08:00