Commit Graph

2960 Commits

Author SHA1 Message Date
yangjianqing 1e4e80a1ca Revert "net:debug patch"
Reason for revert: <no need debug info>

Signed-off-by: yangjianqing <yangjianqing@xiaomi.com>
2026-04-21 01:36:02 +08:00
wangjinjing1 e2ffbbf287 net/devif: fix devif_loopback check logic
add dlltype check to prevent loopback triggering from non-ipv4/ipv6 packet

Signed-off-by: wangjinjing1 <wangjinjing1@xiaomi.com>
2026-04-21 01:34:57 +08:00
dongjiuzhu1 72ac8c984f net: removing bmp marco and using global mempool
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:34:39 +08:00
zhanghongyu c91603d681 net: replace net_sem*wait with conn_dev_sem*wait to simplify code logic
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:34:34 +08:00
OceanfromXiaomi a0457e407c nuttx: add NETDEV_RX_STAMP flag in d_features.
Signed-off-by: OceanfromXiaomi <zhaohaiyang1@xiaomi.com>
2026-04-21 01:34:19 +08:00
OceanfromXiaomi 2ac370a202 nuttx: modify "d_rxtime" and use "iob->io_time" to instead in newer netdev driver .
Signed-off-by: OceanfromXiaomi <zhaohaiyang1@xiaomi.com>
2026-04-21 01:34:13 +08:00
daichuan 90070b0644 ipv4_input: Try to forward the packet if device has a configured IP
Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-04-21 01:34:12 +08:00
dongjiuzhu1 bdd4f35a68 net: add per cpu support under bmp mode
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:33:57 +08:00
zhanghongyu f3fe2867dd net: fix crash caused by uninitialized memory
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:51 +08:00
zhanghongyu c07debc7b7 devif_callback.c: mempool has double free detection, so remove duplicate logic
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:50 +08:00
zhanghongyu 551af5e55d net/ieee802154: replace net_lock with conn_lock and conn_lock_dev
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:49 +08:00
zhanghongyu 5ae4b6312a net/bluetooth: replace net_lock with conn_lock and conn_lock_dev
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:49 +08:00
zhanghongyu 7770a9c05d net: replace NET_BUFPOOL with MEMPOOL_DEFINE
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:49 +08:00
zhanghongyu 30b6576c44 devif_poll.c: inline the small or single caller function
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:48 +08:00
zhanghongyu 5ed35c57b0 devif_poll: only call the corresponding xxx_poll when there is data to be sent
reduce the execution consumption of irrelevant code

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:48 +08:00
zhanghongyu f10918c93f net/devif_callback: change flags type from uint16_t to uint32_t
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:28 +08:00
zhanghongyu be40cb001e netdev_lock: workaround for compilation error caused by the include of header files
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:28 +08:00
wangjinjing1 fd6467892e net/forward: change ipforward name to netforward for public use
Signed-off-by: wangjinjing1 <wangjinjing1@xiaomi.com>
2026-04-21 01:32:12 +08:00
wenquan1 4978610f4e net/ipv4: drop multicast or broadcast source packet
Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
2026-04-21 01:32:10 +08:00
zhanghongyu 77a8d37c48 ipv6_input.c: move ipv6_fragin before ipv6_nat_inbound
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:32:02 +08:00
wenquan1 c7239d3a15 net/tcp: drop multicast tcp packets
Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
2026-04-21 01:31:56 +08:00
wenquan1 5c4310f5a5 net/arp: support queue iob when arp_out failed
arp_out will replace the dev->d_iob to arp request if the iob destination address is not exist in arp table, this mechanism cause this iob lost result in first received ping no response or first synack retransmit. to fix this bug, we queue the iob if arp_out failed, allocate a new iob to send arp request, after the arp request completed, then we retry send the queue iob packet.

Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
2026-04-21 01:31:39 +08:00
yangjianqing 77bcef0121 net:debug patch
Signed-off-by: yangjianqing <yangjianqing@xiaomi.com>
2026-04-21 01:30:31 +08:00
gaohedong 69cf0a8f66 Revert "net/ipv4: check ipv4 total length"
This reverts commit ccddf569806bc0aaf05451186a099e3d554dd86d.

Reason for revert: <According to Linux code implementation, only perform exception handling for situations where the actual message is short>

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2026-04-21 01:30:26 +08:00
wenquan1 64d6875930 net/tcp: fix conn->work use after free in worker queue list
in multi-core cpu, tcp_free and tcp_timer_expiry->tcp_timer will work in parallel, after tcp_free call work_cancle, tcp->timer will call tcp_update_timer to re-add work to worker queue, then tcp_free free conn, in this condition, it will result use after free.

Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
2026-04-21 01:30:21 +08:00
zhanghongyu 12f3d0bc30 ipv4_input.c: check whether the length of the ipv4 option is correct
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:29:35 +08:00
zhanghongyu 00a967d040 net/tcp: replace TCP_CLOSE with TCP_ABORT
since we added TCP_TXCLOSE and TCP_RXCLOSE, only RST-like exception
flows now trigger TCP_CLOSE events, so replace the remaining
TCP_CLOSE with TCP_ABORT.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:29:20 +08:00
zhanghongyu 9eed5c268d net/tcp: add TCP_RXCLOSE to handle rx is shutdown
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:29:20 +08:00
zhanghongyu 001cc87e41 net/tcp: support recv packet in the TCP_FIN_WAIT_1/2 state
shutdown should send TCP_FIN packet.

close should send TCP_RST packet when the data in readahead has not been
                                 read and NEW_DATA has arrived.
             send TCP_FIN packet when in other cases.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:29:20 +08:00
gaohedong 33bc32a7ca net/ipv4: check ipv4 total length
According to RFC 791 section 3.1, check ipv4 total length.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2026-04-21 01:28:55 +08:00
zhanghongyu caac955745 netdev: move netdev_lock to a more suitable location
the previous logic could not protect the access to conn in txdone

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:28:47 +08:00
zhanghongyu b6137af535 net: Add netdev_lock in xxx_input and txavail to adapt to drivers that do not use upperhalf
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:28:25 +08:00
zhanghongyu ca16651ee4 net/can: replace net_lock with conn_lock and conn_lock_dev
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:28:24 +08:00
zhanghongyu 00750f21c6 net/icmp: replace net_lock with conn_lock and conn_lock_dev
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:28:24 +08:00
zhanghongyu 297655863e net/pkt: replace net_lock with netdev_lock
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:28:24 +08:00
zhanghongyu 90b5a28ec3 net/udp: remove net_lock
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:28:24 +08:00
wenquan1 bb3942c8f1 net/ipv4: Drop a ipv4 packet with total length bigger than the actual transmitted data
Derived from RFC 791 s3.1 p13 Internet Header Format.

Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
2026-04-21 01:27:52 +08:00
wenquan1 0771ed6fcc net/ipv6: Drop IP packet shorter than length in IP header
Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
2026-04-21 01:27:52 +08:00
wenquan1 b8c8e6acda net/ipv4: Send ICMP Destination Unreachable for unknown protocol
According RFC1122 3.2.2.1, A host SHOULD generate Destination Unreachable messages with code: 2(Protocol Unreachable), when the designated transport protocol is not supported.

Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
2026-04-21 01:27:52 +08:00
daichuan 2dbcc03b09 modify for hardware checksum offload
Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-04-21 01:27:22 +08:00
gaohedong d11128fbef net/devif: fix poll issue when ifdown
When the interface is in a down state, it triggers a poll busy loop issue.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2026-04-21 01:24:32 +08:00
gaohedong bdc2e2dd74 net/devif_poll: abandon the transmit if it failed to build L2 header for the packet
abandon the transmit if it failed to build L2 header for the packet

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2026-04-21 01:24:32 +08:00
zhanghongyu 0f33afaed4 net/net_initialize: remove the empty functions that are not needed
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:23:28 +08:00
Zhe Weng 2a3411dd1f net/bufpool: Call init automatically on alloc
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2026-04-21 01:16:56 +08:00
Zhe Weng e57abd9e3a net: Add buffer pool to replace connection allocation
Our net socket connection allocations are powerful but redundant
because they're implemented once in each protocol.  This is not good for
further optimizing and extending to other allocations, so maybe we can
add a common implementation for the usage.

Impact:
1. We add a `struct net_bufpool_s` as pool descriptor, which may use a
   little bit more memory than previous implementation (~28Bytes).
2. We share same functions between pools, so code size may shrink under
   some scenarios.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2026-04-21 01:16:55 +08:00
openvela-robot 77f0bea7f5 Merge branch 'master' into vela
apache/nuttx commit id: eb27ebba8adfe29644a7b890f86e6f16941921dc

Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:12:27 +08:00
openvela-robot 87c6ff19cf mm: Fix some typos
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:12:20 +08:00
openvela-robot b2f5ba0753 syslog: convert \n to \r\n in syslog framework layer
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:12:15 +08:00
openvela-robot 24c239f8f5 arm/cmake: fix cmake compile error
1. The -c parameter should not be added during the link phase, otherwise the link will fail.
2. If it is the clang compiler, its toolchain library should use --print-file-name to find it, otherwise an error will occur

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:12:09 +08:00
openvela-robot 44ed68d400 fs/rpmsgfs: return real err value when open failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:12:00 +08:00