Commit Graph

3327 Commits

Author SHA1 Message Date
SPRESENSE 72b67832ea Makefile: Remove make depend files by make distclean
Intermediate files of make depend like .ddc and .dds may remain
when make is interrupted. Remove them using make distclean.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2026-02-16 16:27:57 +01:00
zhangyuan29 c99fa1994f net/utils: add union name for tasking compiler compatibility
Some compilers like Tasking do not support anonymous unions/structs.
Add explicit names to the anonymous union and struct members in
snoop_packet_header_s and update all references accordingly.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2026-02-12 10:49:44 -03:00
shichunma 3fb776e45c net/netdev: a valid netdev for ipv4 should have ipv4 addr configured
It's not a valid netdev if without ipv4 address.

Signed-off-by: Jerry Ma <shichunma@bestechnic.com>
2026-02-02 13:57:56 +08:00
zhaohaiyang1 f653ffd723 forward: Add IFF_NOSRC_FORWARD and IFF_NODST_FORWARD flags.
* IFF_NOSRC_FORWARD: Controls whether device prohibits forwarding packets inputs
* IFF_NODST_FORWARD: Controls whether device prohibits forwarding packets outputs

This allows users to selectively enable/disable forwarding on specific
devices, improving network flexibility and security.
Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2026-01-31 02:37:58 +08:00
yintao 741324d73c net/rpmsg: add err handle when rpmsg_socket_unbind called
After waiting, it is necessary to check if the connection
has been disconnected

Signed-off-by: yintao <yintao@xiaomi.com>
2026-01-29 09:15:33 -03:00
yintao 3fa55fb72e net/rpmsg: support POLLHUP when unbind
rpmsg_socket_ns_unbind should notify pollhup when reconnect
Otherwise, uv_poll can't UV_DISCONNECT
eg:
if (revent & POLL_ERROR || revent & POLL_DISCONNECT)
           xxxx();

Signed-off-by: yintao <yintao@xiaomi.com>
2026-01-29 09:15:33 -03:00
zhanghongyu d5d6b65213 Revert "net: limit TCP and UDP send/recv buffer usage with throttled IOB"
This reverts commit fa652f9c24.

When testing iperf on boards such as ESP32-C6, ESP32-C3, and ESP32,
blocking issues are encountered, so the patch is reverted.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-23 14:40:06 -03:00
Bartosz Wawrzynek 585d954d0b boards/sim: Fix watchdog callback
drivers: Fix types and sx127x driver rx
net/pkt: Fix type

Small fixes.

Signed-off-by: Bartosz <bartol2205@gmail.com>
2026-01-23 09:46:02 +08:00
zhanghongyu fa652f9c24 net: limit TCP and UDP send/recv buffer usage with throttled IOB
The main content of this submission is to limit both the TX/RX buffers
of TCP/UDP to throttled IOBs, avoiding impacts on the sending and
receiving of control-type messages.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-21 20:06:47 +08:00
zhanghongyu 646010d0a0 net/bluetooth: fix rmutex deadlock
the lock in the "bluetooth_conn" was not initialized, which resulted in
a blocking situation when attempting to hold the lock for the first
time.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-21 19:24:02 +08:00
daichuan a82ee60da8 usrsock: Check RECVFROM_AVAIL before setting POLLIN in pollsetup
In usrsock_pollsetup, only set POLLIN if USRSOCK_EVENT_RECVFROM_AVAIL is set when remote is closed, avoiding invalid POLLIN events.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 22:37:10 +08:00
daichuan 7a4a6ce4ce usrsock: Avoid frequent POLLIN when remote close during accept.
Clear USRSOCK_EVENT_RECVFROM_AVAIL flag when remote closes connection during accept to prevent repeated POLLIN events and EPIPE loop.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 22:37:10 +08:00
daichuan d19ee93c60 net: Support no-lto option for the network build.
Add CONFIG_NET_NO_LTO to allow compiling the network stack with -fno-lto.
This is useful for avoiding LTO-related issues in the network layer.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 10:12:45 +08:00
daichuan 32ffc69bdd net/icmp: Fix devif_loopback dead loop when unrecognized ICMP packet received
When an unrecognized ICMP (type=3, code=2) packet is received, the ICMP flow does not set dev->d_len to 0, causing a devif_loopback dead loop.

Therefore, in ICMP input processing, when an ICMP_DEST_UNREACHABLE message is received, if it is not ICMP_FRAG_NEEDED code, jump to typeerr for error handling.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 06:56:27 +08:00
zhangshuai39 49ffd94d84 net/pkt: Fix coverity issue
The value ret is overwritten after being assigned a value.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2026-01-19 15:33:03 -05:00
daichuan b01f8b04e9 netdev: delete macro CONFIG_NETDEV_CHECKSUM with nuttx
not need CONFIG_NETDEV_CHECKSUM with nuttx

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-19 23:22:46 +08:00
daichuan 99bf7c3c5f net: skip TCP/UDP pseudo-header checksum with hardware offload
When supporting hardware checksum offloading, the network protocol stack
does not perform TCP/UDP pseudo-header checksum calculation.

Skip TCP/UDP pseudo header checksum calculation in network protocol stack

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-19 23:22:46 +08:00
daichuan 42da4e322a net/netdev: fix compile error and add cmake/makefile
Fix compilation errors and add build files

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-19 23:22:46 +08:00
daichuan d2dde8a29a net/netdev: modify for hardware checksum offload
Implementation of main hardware verification and uninstallation functions

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-19 23:22:46 +08:00
wangjinjing1 18820ef07d net/can: allow errmask to be set to CAN_ERR_FLAG;
For the LIN protocol, the error frame ID can be 0. This change is to ensure that all LIN error frames can pass the filter.

Signed-off-by: wangjinjing1 <wangjinjing1@xiaomi.com>
2026-01-19 15:13:14 +08:00
guoshichao 3d45550da9 can_sendmsg_buffered: fix can_sendmsg param type mismatch error
Update the can_sendmsg() signature from "struct msghdr *msg" to
"const struct msghdr *msg" to match the updated sendmsg() prototype
and resolve compilation errors due to parameter type inconsistency.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 21:11:39 +08:00
guoshichao 57637e5927 net: make the sendmsg param type consistent with posix specification
To ensure consistency, in all places where the "sendmsg" function is used
either directly or indirectly, the type of the "struct msghdr *msg" parameter
needs to be modified to "const struct msghdr *msg".

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 21:11:39 +08:00
daichuan cf8dacde9c netinet/in.h: Rename imr_interface to imr_address in struct ip_mreqn.
Rename imr_interface to imr_address in struct ip_mreqn to match the Linux definition.
This ensures compatibility with standard socket APIs and existing Linux applications.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-16 09:42:12 +08:00
zhanghongyu 4ce3dac146 net: move the tool interface functions to the public directory
expose the query interface of the network card to the network card
driver so that the network card driver can support more features.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-16 09:42:01 +08:00
zhanghongyu da43a2e53b tcp_timer.c: send TCP_RST when keepalive timeout
The RFC requires sending an TCP_RST packet in this scenario, so to better
comply with the standard definition, the sending of TCP_RST is added.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-16 09:39:45 +08:00
daichuan df7a58dab8 net/neighbor: fix compilation with CONFIG_NET_ICMPv6_NO_STACK
When CONFIG_NET_ICMPv6_NO_STACK is enabled, icmpv6_solicit should not be called.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-16 09:38:27 +08:00
zhanghongyu da35465d43 tcp_input.c: standardize the processing of urgent data
urgent data needs to be treated as normal data when
CONFIG_NET_TCPURGDATA disable. some test sets will verify this
behavior, correct the processing logic.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-15 16:26:19 -03:00
zhanghongyu 0dc0b94380 net/ipv4: check whether the length of the ipv4 option is correct
This patch adds validation for IPv4 option lengths during packet processing
to prevent malformed packets from causing undefined behavior. The new
ipv4_check_opt() function verifies that option lengths are within valid
bounds before processing them.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-15 16:14:19 -03:00
zhanghongyu 6296aeecdb net/route/ramroute: replace prealloc with netpool
reuse the netpool module to optimize the code implementation.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-15 23:15:03 +08:00
zhanghongyu 5ce2955e62 net/netdev: correct the ioctl command validation logic
This patch fixes the validation order in netdev ioctl handlers for
Bluetooth, IEEE 802.15.4, and packet radio devices. The command type
should be validated before checking the argument pointer to return
the correct error code (-ENOTTY vs -EINVAL).

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-15 19:59:40 +08:00
zhanghongyu 0fdd6b5bf6 ipfrag: use netdev_iob_replace_l2 to replace d_iob
d_len needs to include NET_LL_HDRLEN(dev) to avoid errors in
the verification of message length in ipv4_in/ipv6_in.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-15 01:55:19 +08:00
zhanghongyu a7f084bfd4 icmpv6_autoconfig.c: fix crash when ipv6 address modified during autoconfig
During the autoconfig process, if the user modifies the link local
address while waiting for the Router Advertisement message, a crash will
occur when sending the ICMPv6 Neighbor Advertisement message because
netdev_ipv6_lladdr returns NULL.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-13 13:55:17 -08:00
shichunma 52e67d167a net/route: need clear old cached route info when do reset cache
When do net_flushcache_ip4/6, it may have old info at that time.

Signed-off-by: Jerry Ma <masc2008@gmail.com>
2026-01-11 23:23:34 +08:00
wangchen 96fcc8bb1d net:modify check condition from IFF_UP to IFF_RUNNING in the sending process
Modify check condition from IFF_UP  to IFF_RUNNING in the sending process

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2026-01-09 21:48:18 +08:00
Jiri Vlasak 7fa4a7f3b4 net/netdev: Fix best prefix in findby
When comparing with netmask, the best prefix len is netmask.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-01-08 22:45:16 +08:00
zhanghongyu 6a6bc58e07 net/udp_sendto_unbuffered.c: fix udp message cannot be sent to the network card
UDP message cannot be sent to the network card, and case a stuck issue.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-07 13:27:11 +01:00
OceanfromXiaomi f53b986fb2 can: propagate iob_tryadd_queue() failure in can_datahandler
The can_datahandler() function calls iob_tryadd_queue() to enqueue
received CAN data. Since iob_tryadd_queue() may return a negative
value on failure, the error was previously not properly handled.

Update can_datahandler() to propagate the return value so callers
can detect and handle queueing failures correctly.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2026-01-07 08:31:06 +01:00
zhanghongyu 5e1410ecab net/local: replace net_lock with local_lock
remove the use of net_lock in the local module and decouple it from
other network modules.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-06 16:08:30 +08:00
wangchen c2774ba1ec netdev:When running, proto stack can exchange packets with device
netdev:when network device is running status,the network protocol stack is allowed to send packet to the network device and to receive from the network device

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2026-01-06 16:04:03 +08:00
zhanghongyu 8f41613374 net: replace net_sem*wait with conn_dev_sem*wait to simplify code logic
optimize the current code format according to the previous net_xxx_wait
implementation to reduce multiple calls of similar code

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu aee7ea0d7d net/utils: conn_dev_sem_timedwait supports the input parameter sconn being NULL
thus supporting scenarios that only require break netdev_lock.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu efd8e1be2b net/ieee802154: replace net_lock with conn_lock and conn_lock_dev
decouple lock dependencies from other modules.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu 92b3357182 net/bluetooth: replace net_lock with conn_lock and conn_lock_dev
decouple lock dependencies from other modules.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu 11c4bb7f31 utils.h: add conn_dev_sem_timedwait interface to simplify code logic
the following code can be modified

  conn_dev_unlock(&conn->sconn, conn->dev);
  ret = net_sem_timedwait_uninterruptible(&conn->snd_sem,
    tcp_send_gettimeout(start, timeout));
  conn_dev_lock(&conn->sconn, conn->dev);
to

  ret = conn_dev_sem_timedwait(&conn->snd_sem, false,
    tcp_send_gettimeout(start, timeout), &conn->sconn, conn->dev);

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu b8850e4eb3 conn_lock: inline conn_lock/conn_dev_lock
modify functions that are simple but frequently called into inline
functions, thereby reducing CPU loading without significantly changing
the code size.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu 2f3b8255e0 devif_poll.c: inline the small or single caller function
reduce stack operations to lower CPU loading.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:04:16 +08:00
zhanghongyu c481374fb8 devif_poll: only call the corresponding xxx_poll when there is data to be sent
reduce the execution consumption of irrelevant code

testing the TX rates of TCP and UDP based on the Infineon board can
increase them by 13%.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:04:16 +08:00
zhanghongyu a0b847bf1b net/devif_callback: change flags type from uint16_t to uint32_t
increase the size of the flag to prepare for precise xxx_POLL.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:04:16 +08:00
zhanghongyu d377f6b788 net: use netdev_lock to protect netdev_txnotify_dev
since the type of sconn lock is rmutex, there is no need to release
sconn lock before TX

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:04:16 +08:00
zhanghongyu eb5c8f4e9c net/netlink: replace net_lock with netlink_lock
remove the use of net_lock in the netlink module and decouple it from
other network modules.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:00:55 +08:00