Commit Graph

363 Commits

Author SHA1 Message Date
hejianliang3 e9648d8a73 net:fix coverity warning
Signed-off-by: hejianliang3 <hejianliang3@xiaomi.com>
2022-04-03 14:37:53 +03:00
chao.an 660b80b329 net/sockopt: bypass the SO_RCVBUF/SO_SNDBUF to usrsock
SO_RCVBUF/SO_SNDBUF tightly coupled with stack

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-18 00:19:31 +08:00
Xiang Xiao b2c86f808d net: Remove psock_fcntl related code
since the nonblocking mode set through psock_ioctl now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-04 22:03:55 +02:00
chao.an c73df52c46 net/socket: fix shadow variable
socket/setsockopt.c: In function ‘psock_socketlevel_option’:
socket/setsockopt.c:168:38: warning: declaration of ‘conn’ shadows a previous local [-Wshadow]
  168 |               FAR struct tcp_conn_s *conn;
      |                                      ^~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 17:55:16 +01:00
chao.an e749f6ca7e net/tcp/monitor: do not migrate the state to close
1. remove the unnecessary interfaces tcp_close_monitor()

socket flags(s_flags) is a global state for net connection
remove the incorrect update for stop monitor

2. do not start the tcp monitor from duplicated psock

the tcp monitor has already registered in connect callback

------------------------------------------------------------
This patch also fix the telnet issue reported by:
https://github.com/apache/incubator-nuttx/pull/5434#issuecomment-1035600651

the orignal session fd is closed after dup, the connect state
has incorrectly migrated to close:

drivers/net/telnet.c:
 977 static int telnet_session(FAR struct telnet_session_s *session)
 ...
 1031   ret = psock_dup2(psock, &priv->td_psock);
 ...
 1082   nx_close(session->ts_sd);

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-11 18:56:40 +09:00
chao.an 0d19a3a248 net/inet: move socket timestamp into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an 9317626c32 net/inet: move socket linger into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an 3fce144aeb net/inet: move recv/send timeout into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an cc6add58dc net/inet: move socket options into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an 1659513edb net/inet: move socket error into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an 99cde13a11 net/inet: move socket flags into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an 39e142243d net/tcp/udp: move the send callback into tcp/udp structure
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
Petro Karashchenko 8d3bf05fd2 include: fix double include pre-processor guards
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-16 11:11:14 -03:00
chao.an b10dcf7c0d net/udp: fix the invaild udp destination address
If the udp socket not connected, it is possible to have
multi-different destination address in each iob entry,
update the remote address every time to avoid sent to the
incorrect destination.

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-17 11:25:06 -06:00
Jiuzhu Dong 887ec01f3e net: limit NET_NACTIVESOCKETS to 4 when enable DEFAULT_SMALL
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-10-10 19:59:28 -07:00
Jiuzhu Dong 93bdecf2c3 net: always compile listen.c and accept.c when enable CONFIG_NET
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-10-10 19:59:02 -07:00
chao.an 5a2510d48d net/dup: only start tcp monitor on INET domain
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-23 19:02:03 -07:00
Alin Jerpelea 91a5f90a7f author: UVC Ingenieure : update licenses to Apache
Gregory Nutt has submitted the SGA
UVC Ingenieure has submitted the SGA
Max Holtzberg has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-09-15 15:57:55 +08:00
SPRESENSE 9732334b5d net/socket: Fix bug that sendto did not return an error
When `tolen` is not 0 and `to` is NULL, it causes illegal buffer access.
Add a parameter check in this condition.
2021-08-19 01:31:05 -07:00
chao.an 7d4502aca6 net/socket: add SO_SNDBUF support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-20 20:24:58 -07:00
Xiang Xiao 663104a2e9 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 07:39:15 -03: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 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 b6bf9cf44b net/accept: alloc the accept fd after accept success
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-11 05:00:21 -05:00
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
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
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
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
Gustavo Henrique Nihei 330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
ligd 70442d1f9d net/socket_rpmsg: add net socket rpmsg support
Change-Id: Ie23ee4c0052cf2fc66972ea9bc5f11c070fbcf8a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-07 01:45:51 -08:00
Peter Bee e223f60c09 net/socket: move si_send/recv into sendmsg/recvmsg
Implement si_send/sendto/recvfrom with si_sendmsg/recvmsg, instead of
the other way round.

Change-Id: I7b858556996e0862df22807a6edf6d7cfe6518fc
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-03-05 04:46:13 -08:00
Jiuzhu Dong 4d5a964f29 net: unify socket into file descriptor
Change-Id: I9bcd21564e6c97d3edbb38aed1748c114160ea36
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-03 19:01:41 -08:00
Alin Jerpelea 37d5c1b0d9 net: Author Gregory Nutt: update 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-02-20 00:38:18 -08:00
Alin Jerpelea 7dc7ef45f1 net: nxstyle fixes
Nxstyle fixes to pass CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-20 00:38:18 -08:00
Juha Niskanen de1ad1fdb3 net: fix typos, incorrect comments, nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-13 09:06:28 -06:00
chao.an 316cdccf82 net/sockopt: Try usrsock further if the protocol not available
fallback to usrsock if the features are not implemented locally

Change-Id: I46e2d6452d7edd3fa5b3d508945511cd48f22ebb
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-03 12:22:48 +01:00
chao.an 51efe468b9 net/sockopt: fix invalid option set
fix invalid option set if enable UDP without TCP

Change-Id: I732893501a9b28749706d6f860c77ae9e14b358c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-03 12:22:48 +01:00
chao.an 049c991d28 style/Kconfig: remove unnecessary trailing whitespace
N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 12:20:30 +01:00
YAMAMOTO Takashi 3297c09d58 net/socket/send.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
Matias N 5386f972fa bluetooth: Add support for HCI RAW channel; make host layer optional 2020-10-25 17:04:25 -07:00
Brennan Ashton 1080d3f411 Bluetooth: Start implementing BTPROTO_HCI socket support
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-10-25 17:04:25 -07:00
Xiang Xiao b0797263ca libc/stdio: Allocate file_struct dynamically
1.Reduce the default size of task_group_s(~512B each task)
2.Scale better between simple and complex application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia872137504fddcf64d89c48d6f0593d76d582710
2020-09-11 17:58:17 +08:00
Xiang Xiao ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
chao.an e5f6dafe1f net/socket: add SOCK_CLOEXEC/SOCK_NONBLOCK support
Reference here:
https://github.com/torvalds/linux/blob/master/include/linux/net.h

Change-Id: I9fd0170bcd1ae7e778e951d454ada76f63854de5
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-17 23:38:18 -05:00
SPRESENSE 76c87d2f85 net/socket: Fix nxstyle issue 2020-07-22 11:41:53 +01:00
SPRESENSE 5ee0432d6f net/socket: Fix sanity checking of socket interface
No error occurs even if NULL is set in the input argument
of socket API. So added an argument check process.
2020-07-22 11:41:53 +01:00
chao.an e7f2dc8173 net/sockopt: change the socket option style from Linux to BSD
Linux Programmer's Manual
...
IP(7)
...
NOTES
...
    Using the SOL_IP socket options level isn't portable;
    BSD-based stacks use the IPPROTO_IP level.

Change-Id: I63ea5ec7714481b5201608ec4449e522e2be3da2
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-30 18:49:58 -03:00
chao.an d6a0da41d5 net/vfcntl: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-24 13:48:41 +01:00
chao.an f56e0e004b fs/setfd: correct the return value
Change-Id: I766f3760e7167a579b73673c44b70847ee06850b
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-24 13:48:41 +01:00