chao.an
0d8e5b66fd
net/sock: move the psock calloc out of sockfd_allocate
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-11 05:00:21 -05:00
YAMAMOTO Takashi
7d82e7a7c4
tcp_input: fix a confusing variable name and a comment
...
It looks like a copy-and-paste mistake.
2021-06-10 22:47:04 -05:00
YAMAMOTO Takashi
eb00e00e48
tcp: Use the tcp seq macros in some obvious places
2021-06-10 22:47:04 -05:00
YAMAMOTO Takashi
433a2b27d9
tcp: add macros to deal with sequence number wraparound
2021-06-10 22:47:04 -05:00
chao.an
805d3a2061
net/local: add local_nextconn() helper
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-10 13:57:32 -03:00
Xiang Xiao
5b2a17b892
Include assert.h in necessary place
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-08 13:06:08 -07:00
chao.an
39245f63fe
net/icmp: fix race condition in icmp recvmsg
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-07 22:17:50 -05:00
chao.an
ae613446c8
net/icmp: add nonblocking support
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-07 22:17:50 -05:00
chao.an
9c1fb4c04b
net/icmp: consume the data length to avoid duplicate packet
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-07 22:17:50 -05:00
chao.an
b0ac97adab
net/icmp: fix invalid condition comparison
...
up_assert: Assertion failed at file:
icmp/icmp_recvmsg.c line: 175 task: net_tasklet
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-07 22:17:50 -05:00
YAMAMOTO Takashi
69b3f034a4
tcp: Move buffered/unbuffered common code to tcp_send.c
2021-06-03 21:33:10 -05:00
YAMAMOTO Takashi
7d33c01a0a
tcp_get_recvwindow: Add a revisit comment
2021-06-03 21:32:34 -05:00
Xiang Xiao
2e54df0f35
Don't include assert.h from public header file
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
Xiang Xiao
d7f96003cf
Don't include debug.h from public header file
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 06:42:02 +09:00
chao.an
70f6eb232a
net/dev: link the net device as order of registration
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-31 01:38:38 -05:00
YAMAMOTO Takashi
7ac6c0a8de
tcp_data_event: Add a comment
2021-05-31 01:37:51 -05:00
YAMAMOTO Takashi
70d215b11f
devif_poll_tcp_connections: Fix a comment typo
2021-05-31 01:37:51 -05:00
YAMAMOTO Takashi
92328792fd
tcp_data_event: Fix an indent
2021-05-31 01:37:51 -05:00
YAMAMOTO Takashi
2ce0457edb
tcp_get_recvwindow: Add a comment
2021-05-31 01:37:51 -05:00
YAMAMOTO Takashi
0c606ecb8e
psock_tcp_recvfrom: Add a comment about window updates
2021-05-31 01:37:51 -05:00
Alin Jerpelea
b3ad98c89a
net: update licenses to Apache
...
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-05-27 08:07:25 +09:00
Xiang Xiao
001e7c3e76
sched: Don't include nuttx/sched.h inside sched.h
...
But let nuttx/sched.h include sched.h instead to
avoid expose nuttx kernel API to userspace.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:11:53 +09:00
chao.an
48b0e48cd4
net/tcp: set/get TCP_KEEPINTVL/IDLE value as BSD style
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-22 09:01:18 -05:00
chao.an
a876f0253a
net/tcp: recounter the ack counter during obtain newdata
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-21 18:02:53 -03:00
Xu Xingliang
f07df9dfc8
net: Forward socket option only when the socket type is usrsock
...
Change-Id: I5e102c4c648936f96834120e2c508f7072436246
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-19 03:07:04 -05:00
David Sidrane
a61f70d571
inet:sockif Fix warning
2021-05-03 16:55:48 -04:00
Gregory Nutt
7332d2decf
net/: Add missing packet filtering checks
...
NuttX provides the UDP_BINDTODEVICE socket option. This is a UDP protocol-specific implementation of the semi-standard Linux SO_BINDTODEVICE socket option: "SO_BINDTODEVICE forces packets on the socket to only egress the bound interface, regardless of what the IP routing table would normally choose. Similarly only packets which ingress the bound interface will be received on the socket, packets from other interfaces will not be delivered to the socket." https://codingrelic.geekhold.com/2009/10/code-snippet-sobindtodevice.html
If CONFIG_NET_UDP_BINDTODEVICE is selected and a UDP socket is bound to the device, then unrecognized packets UDP packets must not be dropped, but must be forwarded along to the bound socket unconditionally.
It the typical case, this should have no impact. It does effect the applications that use DHCP and do select the UDP_BINDTODEVICE socket option.
This PR replace existing improper logic in the code and also the improper attempts to fix problems from PR #3601 and PR #3598 . Those changes are improper because they expose DHCP appliction dependencies in the OS, breaking modularity and independence of the OS and application.
Tested with stm32f4discovery:netnsh with CONFIG_NET_UDP_BINDTODEVICE. A proper DHCP test setup is needed, however.
2021-04-29 12:47:02 +08:00
chao.an
f8e800765c
net/local: correct the sendto() return length
...
return length should be data length
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-19 11:52:17 -05:00
chao.an
b96fc3fe84
net/igmp: drop the invalid packet
...
igmp message storm occurs if multiple nuttx devices works on same network.
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-19 07:46:47 -05:00
YAMAMOTO Takashi
acc3596adc
tcp_netpoll.c: Fix a performance issue with CONFIG_NET_TCP_WRITE_BUFFERS
...
Tested with a modified version of webclient, which uses non-blocking i/o.
The packet dumps look more reasonable with this change.
2021-04-05 06:16:46 -05:00
Xiang Xiao
5f3a98b5a8
libc/assert: Reference the expression in all case
...
to avoid the warning "defined but not used"
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55b7c092d0f2e5882fc1784987657c10cdf2d90b
2021-04-03 21:00:41 +01:00
Alin Jerpelea
08e5378b11
NuttX: Gregory Nutt: update licenses to Apache
...
Several licenses were missed in the initial work
David Sidrane has submitted the ICLA and we can migrate the licenses
to Apache.
Gregory Nutt has submitted the SGA and we can migrate the licenses
to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-03 04:20:31 -07:00
Alin Jerpelea
8975a65197
net: fix nxstyle errors
...
fix errors reported by nxstyle
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-02 11:12:25 -05:00
chao.an
621242e890
net/tcp: support bind the same port with different domain
...
Reference here:
https://man7.org/linux/man-pages/man7/ipv6.7.html
IPV6_V6ONLY slice
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-01 20:05:14 -04:00
Masayuki Ishikawa
59ed02c604
net: arp: Fix a potential bug in arp_notify()
...
Summary:
- In arp_wait_setup() and arp_wait_cancel(), g_arp_waiters
is protected by a critical section.
- However, I noticed that arp_notify() does not protect the
g_arp_waiters that would cause memory corruption
- This commit fixes the issue.
Impact:
- None
Testing:
- Tested with spresense:rndis_smp, spresense:rndis
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-03-31 12:23:35 -05:00
Masayuki Ishikawa
b3f7cf9ad9
net: arp: Fix memory corruption in arp_send()
...
Summary:
- In arp_send(), arp_wait_setup() adds a notify object to g_arp_waiters
which is removed in arp_wait() in normal case.
- However, in timeout and error cases, the object was not removed and
caused memory corruption.
- This commit fixes this issue.
Impact:
- None
Testing:
- Tested with spresense:rndis_smp
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-03-31 12:23:35 -05:00
YAMAMOTO Takashi
09869e5d41
net/tcp/tcp.h: Remove unused extern g_netdevices
2021-03-30 12:27:50 -05:00
YAMAMOTO Takashi
1c29a2e8e8
net/tcp/tcp_send_buffered.c: Fix non-blocking I/O
...
My recent changes to buffered tcp send broke this. [1]
One of my local apps using non-blocking tcp is working
again with this fix.
[1]
```
commit 837e1a72a47b4e5a874124e316192b2172301d30
Author: YAMAMOTO Takashi <yamamoto@midokura.com>
Date: Mon Mar 15 16:19:42 2021 +0900
tcp_send_buffered.c: improve tcp write buffering
```
2021-03-30 01:12:55 -05:00
YAMAMOTO Takashi
271e748ba5
tcp_send_buffered.c: Add a bit more info to an ninfo()
2021-03-30 01:12:55 -05:00
YAMAMOTO Takashi
a2840b6354
tcp_send_buffered.c: Add an assertion
2021-03-30 01:12:55 -05:00
YAMAMOTO Takashi
ef9adcf399
tcp_send_buffered.c: Remove dead code
2021-03-30 01:12:55 -05:00
chao.an
a988437e90
net/dev: check the available address further
...
check the available address further to avoid obtain unusable device
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-23 06:52:32 -07:00
chao.an
03f899f302
net/usrsock: add send multi-elements support
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-23 00:44:37 -07:00
chao.an
9bdf4ccd68
net/arp: add timeout to avoid infinite send wait
...
add timeout to avoid infinite send wait if the network device is unreachable
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-23 00:28:43 -07:00
YAMAMOTO Takashi
837e1a72a4
tcp_send_buffered.c: improve tcp write buffering
...
* Send data chunk-by-chunk
Note: A stream socket doesn't have atomicity requirement.
* Increase the chance to use full-sized segments
Benchmark numbers in my environment:
* Over ESP32 wifi
* The peer is NetBSD, which has traditional delayed ack TCP
* iperf uses 16384 bytes buffer
---
without this patch,
CONFIG_IOB_NBUFFERS=36
CONFIG_IOB_BUFSIZE=196
does not work.
see https://github.com/apache/incubator-nuttx/pull/2772#discussion_r592820639
---
without this patch,
CONFIG_IOB_NBUFFERS=128
CONFIG_IOB_BUFSIZE=196
```
nsh> iperf -c 192.168.8.1
IP: 192.168.8.103
mode=tcp-client sip=192.168.8.103:5001,dip=192.168.8.1:5001, interval=3, time=30
Interval Bandwidth
0- 3 sec, 4.11 Mbits/sec
3- 6 sec, 4.63 Mbits/sec
6- 9 sec, 4.89 Mbits/sec
9- 12 sec, 4.63 Mbits/sec
12- 15 sec, 4.85 Mbits/sec
15- 18 sec, 4.85 Mbits/sec
18- 21 sec, 5.02 Mbits/sec
21- 24 sec, 3.67 Mbits/sec
24- 27 sec, 4.94 Mbits/sec
27- 30 sec, 4.81 Mbits/sec
0- 30 sec, 4.64 Mbits/sec
nsh>
```
---
with this patch,
CONFIG_IOB_NBUFFERS=36
CONFIG_IOB_BUFSIZE=196
```
nsh> iperf -c 192.168.8.1
IP: 192.168.8.103
mode=tcp-client sip=192.168.8.103:5001,dip=192.168.8.1:5001, interval=3, time=30
Interval Bandwidth
0- 3 sec, 5.33 Mbits/sec
3- 6 sec, 5.59 Mbits/sec
6- 9 sec, 5.55 Mbits/sec
9- 12 sec, 5.59 Mbits/sec
12- 15 sec, 5.59 Mbits/sec
15- 18 sec, 5.72 Mbits/sec
18- 21 sec, 5.68 Mbits/sec
21- 24 sec, 5.29 Mbits/sec
24- 27 sec, 4.67 Mbits/sec
27- 30 sec, 4.50 Mbits/sec
0- 30 sec, 5.35 Mbits/sec
nsh>
```
---
with this patch,
CONFIG_IOB_NBUFFERS=128
CONFIG_IOB_BUFSIZE=196
```
nsh> iperf -c 192.168.8.1
IP: 192.168.8.103
mode=tcp-client sip=192.168.8.103:5001,dip=192.168.8.1:5001, interval=3, time=30
Interval Bandwidth
0- 3 sec, 5.51 Mbits/sec
3- 6 sec, 4.67 Mbits/sec
6- 9 sec, 4.54 Mbits/sec
9- 12 sec, 5.42 Mbits/sec
12- 15 sec, 5.37 Mbits/sec
15- 18 sec, 5.11 Mbits/sec
18- 21 sec, 5.07 Mbits/sec
21- 24 sec, 5.29 Mbits/sec
24- 27 sec, 5.77 Mbits/sec
27- 30 sec, 4.63 Mbits/sec
0- 30 sec, 5.14 Mbits/sec
nsh>
```
2021-03-22 01:12:59 -07:00
chao.an
e03218ab71
net/tcp: reset the connection ref count before tcp_free()
...
reset the connection refcount if SYN retry count has elapsed
Assertion:
up_assert: Assertion failed at file:tcp/tcp_conn.c line: 764 task: netdev_wq
N/A
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-22 10:55:30 +09:00
Nathan Hartman
4653dc14d3
Fix typos (and nxstyle errors)
...
ReleaseNotes,
arch/arm/src/cxd56xx/cxd56_dmac_common.h,
arch/arm/src/efm32/efm32_dma.h,
arch/arm/src/lpc54xx/lpc54_lcd.c,
arch/arm/src/rp2040/rp2040_dmac.h,
arch/arm/src/stm32/stm32_dma.h,
arch/arm/src/stm32f0l0g0/stm32_dma.h,
arch/arm/src/stm32f7/stm32_dma.h,
arch/arm/src/stm32h7/stm32_dma.h,
arch/arm/src/stm32l4/stm32l4_dma.h,
arch/renesas/src/rx65n/rx65n_dtc.h,
fs/spiffs/src/spiffs_vfs.c,
net/route/cacheroute.h,
net/route/net_cacheroute.c,
net/route/net_foreach_fileroute.c,
net/route/net_foreach_ramroute.c,
net/route/net_foreach_romroute.c, and
net/route/route.h:
* Fix the following typos:
- remove spurious "are"
- "tot he" -> "to the"
arch/arm/src/stm32f0l0g0/stm32_dma.h and
arch/arm/src/stm32l4/stm32l4_dma.h:
* Fix nxstyle errors.
2021-03-21 21:51:14 +01:00
chao.an
a5613e6008
net/tcp: correct the port byte order
...
1. unify the byte order to network
2. Do not re-select the port if the local port has been bind()
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-20 09:13:18 -07:00
chao.an
60407c8c8a
net/tcp: do not start the tcp monitor if unestablished
...
Add more sanity checks to avoid TCP moniter start fail if the
TCP handle unestablished, the dup(2) operation should work at any time
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-19 17:23:18 +09:00
Jiuzhu Dong
e96c8b9283
fs: allocate file/socket dynamically
...
Change-Id: I8aea63eaf0275f47f21fc8d5482b51ffecd5c906
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-17 06:46:42 -07:00