Commit graph

2307 commits

Author SHA1 Message Date
chao.an
358e387d8a net/local: split the waiter node from lc_node
Change-Id: I5b052aa34bf9c37dcfd948d24875454467ed8af5
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-16 17:42:05 +08:00
Jiuzhu Dong
e2c717d1fd net: limit NET_NACTIVESOCKETS to 4 when enable DEFAULT_SMALL
Change-Id: Iac28b59227f84c4df0d81d75f34aabad39191f5b
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-16 10:50:24 +08:00
chao.an
32ea5aa887 net/local: replace the listener list to global
Change-Id: Id4700fddeea27a2a86cca2e4aa6284424b53ec4d
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-15 23:20:57 +08:00
chao.an
2394394401 net/local: bypass the message field to support SCM further
Change-Id: I51028036db049788d7db4289e26821a3bf1e1dd0
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-15 23:08:30 +08:00
chao.an
09a752e602 net/local: add local_peerconn helper
Change-Id: I2cbceb68f709c581bc0b878844dd16efcd76d4a7
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-15 22:04:12 +08:00
chao.an
ad480a31bd net/local_recvmsg: remove unused return
Change-Id: I4c3b9a17a36fbb1aba84ebfb96bbe5920d03ddf5
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-13 18:04:47 +08:00
chao.an
f70bc7c5f1 net/local: add FIONSPACE support
Change-Id: Ib96079c6ef7fe3df60ee9f83330b6ed55718bc5f
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-09 20:02:04 +08:00
Jiuzhu Dong
04b3a17662 rpmsg_socket: add prefix "rpmsg-socket" for the name of rpmsg endpoint
Change-Id: If731fb8df651986d944ccbb4f0ba9862b7164676
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-09 16:56:49 +08:00
chao.an
3a0885bafc net/udp: fix buffer release handling on failed buffer alloc
Attempt to release write buffer on failed UDP write I/O buffer
alloc and tryalloc failed to wrb->wb_iob assertion.

Change-Id: Ic77c148c55ded7871d179e321c57bba5ca8e4112
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-30 21:50:57 +08:00
丁欣童
07283dffc3 net/local: Return the partial write size
N/A

Fix up that local socket will be endless loop when write data size more
than the fifo size.

Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
Change-Id: I69d63b7b156f0714333e7103bb266b7fcb1adf03
2021-08-26 10:20:13 +08:00
YAMAMOTO Takashi
95db8bb14f tcp_send_buffered.c: Fix snd_wnd
snd_wnd is an offset from the acked sequence number.
2021-08-25 21:15:14 +08:00
YAMAMOTO Takashi
3f15cd59e8 tcp_input: snd_wnd processing
* Do not accept the window in old segments.
  Implement SND.WL1/WL2 things in the RFC.

* Do not accept the window in the segment w/o ACK bit set.
  The window is an offset from the ack seq.
  (maybe it's simpler to just drop segments w/o ACK though)

* Subtract snd_wnd by the amount of the ack advancement.
2021-08-25 21:15:14 +08:00
chao.an
7c9d73e862 net/local: correct the nonblock send return value
Change-Id: I77b561d748ebb603e275d2fb38c0638093bb1214
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-20 21:40:25 +08:00
chao.an
bd334d7c96 net/rpmsg: move connect state change to sync callback
Change-Id: I8ef6e4b4b4adc5727c072559239e87853abeab04
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-16 23:13:35 +08:00
chao.an
47f784a748 net/rpmsg: fix typo in comment
Change-Id: Icbf8122c5054e01516841b7f0d369992bc967931
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-16 21:46:35 +08:00
chao.an
886d567e7d net/rpmsg: add nonblock connect(2) support
Change-Id: I6fe12c7e40d6e4c4353034d4731c24bd6a28225c
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-16 21:46:27 +08:00
chao.an
b6dbf55271 net/rpmsg: move the sync handshark to ns_bind callback
Change-Id: Ic37671f59fbf08bcbd78cf0221759ee8fed1ed22
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-16 21:38:00 +08:00
chao.an
79dd7453ac net/rpmsg: simplify the socket timeout of connect
Change-Id: I9ff5b3e7dad0b73196cfa058f3a55f2ea3086815
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-16 21:38:00 +08:00
chao.an
2d597f55df net/local: add nonblock connect(2) support
Change-Id: Iee8250b5011f799c52d667b2593760673378443e
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-16 21:37:52 +08:00
chao.an
bfeefa09b1 net/tcp: add nonblock connect(2) support
Change-Id: I01b125996a85c9ea0220a24bb3d41d6e75e36554
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-16 21:27:08 +08:00
chao.an
3bd2a5b11a local/stream: remove preamble header in stream mode
Preable sync header is no necessary in stream mode

Signed-off-by: chao.an <anchao@xiaomi.com>
Change-Id: Id269fc09cf877ec6dc42706eb667adfc5362bf7a
2021-08-05 21:14:23 +08:00
chao.an
acad830329 net/local: remove unused client lc_remaining
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-05 21:14:14 +08:00
Xiang Xiao
400db72d79 libc: Rename match to fnmatch
specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/fnmatch.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 12:02:39 +08:00
chao.an
f246c7e6ad net/socket: add SO_SNDBUF support
Change-Id: Ie7f82afd3a4c053112d15424499797eb046ed413
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-21 11:43:00 +08:00
chao.an
d58c9f1f47 net/wrb: add tcp/udp_inqueue_wrb_size() interface
Change-Id: Iccf2829e445d4842181cd6b8c0422cdfb35c498a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-21 11:42:11 +08:00
ligd
af8530f3fa socket_rpmsg: fix typepo
Change-Id: I7d75efd4f4b3c3ff1b0ecc020e81ac5a972eadb5
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-19 23:17:05 +08:00
Xiang Xiao
e5c60da2f5 fs: Simplify sendfile implementation
and avoid call nx_ file API in the kernel space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id951ca161df2c2ee267dc4b5a0d7dfa67df4c1e6
2021-07-17 04:58:40 -07:00
ligd
37c86a6510 socket_rpmsg: fix recv block when remote close early
MIRTOS-849

Change-Id: Id9ff88099bdc0efb27d64ffa8e407f5a9dd40e33
Signed-off-by: ligd <liguiding1@xiaomi.com>
(cherry picked from commit 85b917e20869f415c847c37731c5745c7942a9fd)
2021-07-16 11:40:37 +08:00
ligd
ad829b749b socket_rpmsg: add lock to bind list, reject if list more than backlog
Change-Id: Ibdbe3d931d1b14601d9c5f3fb95cd87aacb4e5e1
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-15 23:54:14 +08:00
Xiang Xiao
fdf26974c2 Revert "print message with nwarn to avoid constantly printout."
This reverts commit 85d38b9348.

Change-Id: I49cb4b03d652430e3bc58cfa4ac6303701e417d1
2021-07-13 03:16:45 +08:00
Xiang Xiao
a977ca1ca3 net/tcp: tcp_sendfile need restore the file location at the end
quote from https://man7.org/linux/man-pages/man2/sendfile.2.html:
If offset is not NULL, then it points to a variable holding the
file offset from which sendfile() will start reading data from
in_fd.  When sendfile() returns, this variable will be set to the
offset of the byte following the last byte that was read.  If
offset is not NULL, then sendfile() does not modify the file
offset of in_fd; otherwise the file offset is adjusted to reflect
the number of bytes read from in_fd.
If offset is NULL, then data will be read from in_fd starting at
the file offset, and the file offset will be updated by the call.

The change also align with the implementation at:
libs/libc/misc/lib_sendfile.c

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I607944f40b04f76731af7b205dcd319b0637fa04
2021-07-13 03:16:26 +08:00
Xiang Xiao
c8f1eeed57 Merge commit '2e43815c92' into dev
Change-Id: Idcbac12fec435abff01cfb4efd5a26a02eb08f93
2021-07-13 03:14:34 +08:00
chao.an
1dbe8de750 net/local: add AF_[UNIX|LOCAL] socketpair support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-08 03:05:43 -05:00
chao.an
940a07e1e5 net/socketpair: move socketpair implement into socket internal
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-08 03:05:43 -05:00
chao.an
9f3f4fb558 net/local: extern local_generate_instance_id() interface
Change-Id: I14273d11b1fe4d6bdc15b14e32da609cc7883713
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-08 03:05:43 -05:00
chao.an
d4ce70979e net/tcp: change all window relative value type to uint32_t
1. change all window relative value type to uint32_t
2. move window range validity check(UINT16_MAX) before assembling TCP header

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-07 03:55:41 -05:00
chao.an
aab03ef86d net/tcp: add window scale support
Reference here:
https://tools.ietf.org/html/rfc1323

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-07 03:55:41 -05:00
chao.an
a5cdc4e69b net/tcp: change the tcp optdata to dynamic arrays
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-07 03:55:41 -05:00
chao.an
87bffc190c net/tcp: remove the invalid break during tcp option loop
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-07 03:55:41 -05:00
chao.an
e506b2a52c usrsock/recv: guarantee all data is received before close
adjust the close sequence to avoid data discard

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-07 08:40:55 +09:00
chao.an
b901f22c27 net/socket: add SO_RCVBUF support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-06 01:44:55 -05:00
chao.an
eabe535de7 net/inet: add support of FIONREAD
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-05 06:20:52 -05:00
chao.an
55c032d061 net/socketpair: move socketpair implement into socket internal
Change-Id: Ibf84671a1d59122ee5a3c5161048ea4f00356b1c
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-05 12:13:40 +08:00
Anthony Merlino
a885b24cc1 Attempt to fix race condition reported in issue #3647 2021-07-04 08:54:15 -05:00
ligd
b83b974e92 rpmsg_socket: fix rpmsg_socket_device_destroy() multi-access
Reason:
When user call rpmsg_socket_close() at the same time
rpmsg_socket_ns_unbind() is called by remote CPU,
then will meet multi-access to rpmsg_socket_device_destroy()

Fix:
reuse recvlock to handle this

Change-Id: I8f33658f19c56a4000382ff9355ff052c45afea0
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-04 06:23:07 -05:00
Virus.V
bb6273d4d1 netlink: fix compile error when enable netlink
Signed-off-by: Virus.V <virusv@live.com>
2021-07-02 14:57:22 +08:00
YAMAMOTO Takashi
669619a06a tcp_close: Fix a race with passive close
tcp_close disposes the connection immediately if it's called in
TCP_LAST_ACK. If it happens, we will end up with responding the
last ACK with a RST.

This commit fixes it by making tcp_close wait for the completion
of the passive close.
2021-07-02 13:54:15 +09:00
Virus.V
94f45d5c06 netlink: fix compile error when enable netlink
Signed-off-by: Virus.V <virusv@live.com>
2021-07-01 06:55:57 -05:00
YAMAMOTO Takashi
c7ba75697c tcp_recvwindow.c: Use iob_tailroom to replace the home grown one 2021-06-30 06:40:13 -05:00
YAMAMOTO Takashi
52c237cb5f net/tcp/tcp.h: Update a comment about readahead 2021-06-30 06:40:13 -05:00