liqinhui
05b101134a
net:Support jumbo frame prealloc the iob for the ICMP/UDP/TCP.
...
For the ICMP, UDP and TCP, pre-alloc an iob for a jumbo frame.
Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2024-06-02 09:31:37 -03:00
raiden00pl
c09f7f7864
cmake: add missing arp_acd.c file
2024-06-02 09:27:36 -03:00
raiden00pl
b01e8b1b6e
net/ipfrag/Kconfig: NET_IPFRAG depends on IOB_NCHAINS > 0
2024-06-02 09:27:36 -03:00
meijian
0bad215cf8
net/tcp: fix tcp will not close when tcp retransmission reaches TCP_MAXRTX
...
In "psock_send_eventhandler",when retransmit count bigger TCP_MAXRTX nuttx will set release wrb. But before this it will also set "conn->tx_unacked = 0" if we only retransmit one packet(conn->tx_unacked == sent),and In func "tcp_timer" only "conn->tx_unacked > 0" will close the tcp conn. So app will never close if nuttx retransmit over max timers.
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-22 17:46:04 -03:00
yinshengkai
20ebe0e64c
Replace all asserts in kernel code with ASSERT
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-05-17 10:18:16 -03:00
meijian
d199249769
[net][udp] fix udp wrb-iob leak when NIC was down
...
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-15 11:12:36 +08:00
meijian
11dfc5809a
[ipv6][netlink] add netlink report when get ipv6 address by icmpv6
...
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-14 16:00:45 -03:00
meijian
35f8c19112
[net][route] fix Mico definition bug
...
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-14 22:05:35 +08:00
meijian
4702a09538
net/netlink: Add RTM preifx notify support
...
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-14 10:05:37 -03:00
meijian
8eaefd2424
net/netlink: Add RTM neigh notify support
...
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-14 10:05:37 -03:00
meijian
34aeeb024c
net/netlink: Add RTM route support
...
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-14 10:05:37 -03:00
meijian
98d5e118c0
[icmpv6] fix resource leak of icmpv6
...
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-14 16:25:56 +08:00
simbit18
09bfaa7292
fix nxstyle
...
fix Relative file path does not match actual file.
2024-05-11 01:19:06 +08:00
zhanghongyu
45568229ef
tcp: decouple TCP_NODELAY and NET_TCP_KEEPALIVE
...
TCP_NODELAY is an independent configuration and does not depend on TCP_KEEPALIVE
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-04-29 17:45:14 +08:00
zhanghongyu
0cd893fb5a
icmpv6_neighbor: Simply skip IPv6 conflict detection on L3 Nic
...
Otherwise, the IP address is always considered to conflict, and the ipv6
address cannot be effectively obtained.
Later we will look at how to perform conflict detection on L3 network cards
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-04-29 17:44:40 +08:00
zhanghongyu
f739fd010d
icmpv6_neighbor: skip neighbor solicitation on L3 Nic
...
Otherwise, sending will fail because the neighbor table cannot be found
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-04-29 17:44:40 +08:00
Zhe Weng
41ab3a9cfe
net/udp_input: Only dup packets for broadcast / multicast.
...
We found previous multicast support (https://github.com/apache/nuttx/pull/12015 ) harms some unicast situation, and the `udp_input` should not dup packets for unicast.
Now, we only pass broadcast / multicast packets into each listener and let the code under control of `CONFIG_NET_BROADCAST`.
Ref: https://github.com/torvalds/linux/blob/v6.8/net/ipv4/udp.c#L2219
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-24 08:24:47 +02:00
Zhe Weng
3a844d8dd7
net/netlink: Add NETLINK_NETFILTER's CONNTRACK support
...
Now we only supports conntrack info from NAT entries, to let our apps in user space know the mapping status in NAT.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-18 13:03:59 +08:00
Zhe Weng
9b77bb16c9
net/netlink: Move netlink_add_terminator as public
...
Prepare for other netlink dumps.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-18 13:03:59 +08:00
Zhe Weng
b0cf0acc66
net/nat: Add foreach interface for entries
...
Prepare for netlink conntrack dump of entries.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-18 13:03:59 +08:00
Zhe Weng
932c41debb
net/nat: Remove unnecessary logic in inbound logic
...
Finish https://github.com/apache/nuttx/pull/12116#discussion_r1560880897
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-12 14:39:01 +02:00
Zhe Weng
17584eaa4f
net/nat: Rename struct ipv*_nat_entry
to ipv*_nat_entry_t
...
I found `struct ipv*_nat_entry` is missing `_s` suffix, but the name is too long in some cases, so maybe `ipv*_nat_entry_t` could be better.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-12 14:39:01 +02:00
Zhe Weng
e543a8086e
net: Optimize TCP/UDP port selection
...
Optimize TCP/UDP port selection, and fix possibly dead loop.
Finish discussion in https://github.com/apache/nuttx/pull/12116#discussion_r1560851977
Note:
Linux also uses EADDRINUSE for failing in finding a portno, according to https://man7.org/linux/man-pages/man2/bind.2.html
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-12 15:46:29 +08:00
Zhe Weng
4eddf84a76
net/nat: Optimize port selection
...
And fix possibly dead loop.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-11 22:23:29 +08:00
Zhe Weng
f3b34c84c2
net/nat: Support IPv6 Masquerading (NAT66)
...
Notes:
1. This version of NAT66 is a stateful one like NAT44, corresponding to Linux's MASQUERADE target of ip6tables. We can support stateless NAT66 & NPTv6 later by slightly modify the address & port selection logic (maybe just match the rules and skip the entry find).
2. We're using same flag `IFF_NAT` for both NAT44 & NAT66 to make control easier. Which means, if we enable NAT, both NAT44 & NAT66 will be enabled. If we don't want one of them, we can just disable that one in Kconfig.
3. Maybe we can accelerate the checksum adjustment by pre-calculate a difference of checksum, and apply it to each packet, instead of calling `net_chksum_adjust` each time. Just a thought, maybe do it later.
4. IP fragment segments on NAT66 connections are not supported yet.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-11 22:23:29 +08:00
Zhe Weng
676826cb7c
net/utils: Add net_ipv6_payload to get IPv6 L4 payload
...
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-11 22:23:29 +08:00
Zhe Weng
f2ff5cee03
net/nat: Make some IPv4 NAT functions as common
...
To prepare for future IPv6 NAT functions.
- Rename common ipv4_nat_xxx to nat_xxx
- Move some common definitions into header
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-11 22:23:29 +08:00
meijian
93beeeeab0
[tcp/udp] fix port generation not in range
...
(port % max + min)may overflow uint16
Signed-off-by: meijian <meijian@xiaomi.com>
2024-04-09 23:35:55 +08:00
wangchen
b446a002db
net:add customizable default max & min port
...
add customizable default max & min port
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-04-09 23:35:55 +08:00
Zhe Weng
7f1e80f0de
net/nat: Slightly optimize the IPv4 NAT
...
1. Reduce getting `old_ip` in `ipv4_nat_ip_adjust`.
2. Some format change.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-09 14:44:26 +08:00
zhanghongyu
a9bff735e7
net/can: deliver data into multiple CAN conn bound to same dev
...
Because CAN is a broadcast protocol, each conn needs to be given independent data to avoid mutual interference.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-04-09 00:25:44 +08:00
Zhe Weng
a1a09f271f
net/nat: Support Symmetric NAT
...
The symmetric NAT limits one external port to be used with only one peer ip:port.
Note:
1. To avoid using too much #ifdef, we're always passing peer_ip and peer_port as arguments, but won't use them under full cone NAT, let the compiler optimize them.
2. We need to find port binding without peer ip:port, so don't add peer ip:port into hash key.
3. Symmetric NAT needs to *select another external port if a port is used by any other NAT entry*, this behavior is exactly same as Full Cone NAT, so we don't need to change anything related to `ipv4_nat_port_inuse`.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-07 23:57:55 +08:00
Xiang Xiao
2fd73bd82f
net: Fix max conn always one less than configured value
...
return NULL only when the total number is larger than configured value
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-04-07 10:42:56 -03:00
Zhe Weng
806d783fd6
net/udp: Deliver data into multiple UDP conn bound to same port
...
Note: We'll only get multiple conn bound to same port when we support SO_REUSEADDR
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-03-29 11:52:24 +08:00
Zhe Weng
408320f2ba
net/udp: Support deliver multicast packets back to local apps
...
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-03-29 11:52:24 +08:00
Zhe Weng
2a342d2424
net/netdev: Add netdev_iob_clone helper
...
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-03-29 11:52:24 +08:00
zhanghongyu
3956a52c58
net/tcp: return true only when send window updates
...
return true even when window has not changed will cause delayed ack cannot take effect.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-03-13 22:24:04 +08:00
Xiang Xiao
615c4bc6e9
net/local: Fix the wrong direction of threshold setting
...
reader should set POLLIN threshold, writer should set POLLOUT threshold.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-10 11:44:33 -03:00
Xiang Xiao
b0e3a35c39
net/local: Skip poll_notify in local_event_pollsetup if no event happen
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-10 11:44:33 -03:00
Xiang Xiao
155768bae3
net/local: Fix minor issues found in code reading
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-10 11:44:33 -03:00
Xiang Xiao
1ba065db87
drivers/pipe: Change to the block mode by file_ioctl(FIONBIO)
...
it's simpler and safer than file_fcntl(F_SETFL)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-07 10:09:35 -03:00
Yanfeng Liu
3bd35487f0
docs/comments: add simple document and fix typo
...
This patch adds simple document for the shared memory file system.
with typos fix in a other places.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-03 01:55:07 +08:00
Xiang Xiao
61d9394366
net/local: Add local_freectl to avoid the code duplicaton
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-29 16:28:01 -03:00
Xiang Xiao
c7a513b182
net/local: Remove the check of SOCK_STREAM before local_stream_connect
...
since psock_local_connect is called only when the socket is SOCK_STREAM
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-29 16:28:01 -03:00
Xiang Xiao
039a3eccf4
net/local: Initialize lc_crefs to 1
...
and remove local_addref call after local_alloc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-29 16:28:01 -03:00
Xiang Xiao
86039057f8
net/local: Remove the unused lc_psock from local_conn_s
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-29 16:28:01 -03:00
ligd
7ccdd29f3e
local: correct shutdown state when use UDP mode
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2024-02-29 16:28:01 -03:00
Zhe Weng
5eb08a4b33
net: Fix minor coding problems
...
Fix minor problems when reading codes:
- icmpv6_autoconfig: Call net_unlock before return
- pkt_sendmsg: Return error for types other than SOCK_RAW
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-02-23 10:34:23 -03:00
Zhe Weng
9a23ebdbc0
net/pkt: Support binding to devices other than ETH
...
We're using the `sll_ifindex` inside `struct sockaddr_ll` to bind
device, so we don't need to translate it into mac address, we can just
match the index, which also let us bind to different type of devices
other than Ethernet.
Ref: Linux also uses `ifindex` to find related device and note it down without mac addresses.
https://man7.org/linux/man-pages/man7/packet.7.html
https://github.com/torvalds/linux/blob/v6.7/net/packet/af_packet.c#L3328
https://github.com/torvalds/linux/blob/v6.7/net/packet/af_packet.c#L3264-L3265
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-02-22 21:21:48 -08:00
Bowen Wang
fcfd5e8ebf
rpmsg/Kconfig: add rpmsg_local_name to replace rptun_local_name
...
Because rpmsg service depends on RPMSG, make rpmsg socket use the
RPMSG_LOCAL_NAME
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-18 04:09:34 -08:00