Commit Graph

751 Commits

Author SHA1 Message Date
Jiuzhu Dong
00e7be92dc netutils: support rexec and rexecd
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-13 09:00:20 +08:00
Juha Niskanen
b283289986 apps: fix miscellaneous typos
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-08-26 11:39:28 -07:00
YAMAMOTO Takashi
23e0325698 webclient: check content-length
While it's better to use a reliable transport like
TLS with working close notify, it isn't always possible.
2021-08-16 09:47:44 -07:00
YAMAMOTO Takashi
bdae564c22 webclient: Add _s suffix to internal structures
To follow our coding standard.

I left the structures which is a part of the API for now.
(E.g. struct webclient_context)
2021-08-11 03:11:14 -07:00
YAMAMOTO Takashi
b8fd862965 webclient: Add some assertions on webclient_context state 2021-08-08 22:34:26 -07:00
YAMAMOTO Takashi
0bae950b63 webclient: Implement non-blocking I/O
* webclient_perform
    * Add a new flag to use non-blocking mode (WEBCLIENT_FLAG_NON_BLOCKING)
    * Implement restarting

* Add a few associated API functions
    * webclient_get_poll_info: get the descriptor info for poll/select
    * webclient_abort: abort the operation (instead of restarting)
2021-08-08 22:34:26 -07:00
Xiang Xiao
ad3f44bc77 Change match to fnmatch
follow the kernel side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 16:15:57 -03:00
Gustavo Henrique Nihei
a1026c9f23 netutils/webclient: Notify HTTP header data via dedicated callback
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-07-23 11:28:26 -07:00
chao.an
496aa3ef4f netutils/dhcpd: bind socket to the interface
Change-Id: Icf7cf8147ceca5e27b7b923d520e2189741d9882
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-23 08:25:36 -03:00
Atsunori Saito
7b074bcf66 netutils/ftpc: ftpc_connect: Fixed invalid socket close. 2021-07-03 03:07:45 -05:00
YAMAMOTO Takashi
55f921841d netutils/telnetd: use a larger buffer for a 64-bit pointer 2021-07-02 04:18:23 -05:00
Atsunori Saito
5b1a4a3832 netutils/ftpc: ftpc_getfile: Fixed permission check and resume offset. 2021-07-01 09:22:37 -05:00
Beat Küng
7fdd751b7a dhcpc: fix potential invalid memory reads
- check for minimum packet length (44 bytes, which includes the fields we
  read next)
- pass the correct remaining buffer length to dhcpc_parseoptions()
- dhcpc_parseoptions(): ensure we never read past the end of the buffer
2021-06-30 03:00:42 -05:00
chao.an
c7f28f5f9e usrsock/rpmsg/server: select eventfd by default
Change-Id: I8e3bb4f035781e045ccf85c515b6480c7f9317bc
Signed-off-by: chao.an <anchao@xiaomi.com>
(cherry picked from commit abbad446b77b5703e582f529271918fcee0e920e)
2021-06-22 10:31:35 -03:00
YAMAMOTO Takashi
920d925806 iperf: Fix an unused function warning seen with clang 2021-06-17 07:30:41 +02:00
Alin Jerpelea
e78ef68927 netutils: fix relative path CI error
error: Path relative to repository other than nuttx must begin with the root directory
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-16 09:03:06 -05:00
Alin Jerpelea
869535e470 examples: nxstyle fixes
fixes for nxstyle errors reported by CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-16 09:03:06 -05:00
Alin Jerpelea
1671147a87 author: Max Holtzberg : update licenses to Apache
Gregory Nutt has submitted the SGA

Max Holtzberg has submitted the SGA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-16 09:03:06 -05:00
YAMAMOTO Takashi
ce2b9519a7 webclient: Add a way to specify timeout 2021-06-15 05:18:14 -05:00
Alin Jerpelea
6bc7a448de examples: author: Gregory Nutt: update licenses to Apache
Gregory Nutt is has submitted the SGA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-15 05:16:58 -05:00
Alin Jerpelea
5572819bb1 netutils: nxstyle fixes
fixes for errors reported by nxstyle tool

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-11 08:53:57 -05:00
YAMAMOTO Takashi
cc37729e29 iperf: Make the use of CLOCK_MONOTONIC conditional for now 2021-06-11 07:52:03 -05:00
YAMAMOTO Takashi
37bc863eb7 iperf: Make -t0 the default for server mode
It matches the original iperf behavior.

Note: -t is a client-only option for the original iperf 2.xx.

Note: You can still choose the previous behavior by
explictly specifying -t.
2021-06-11 07:52:03 -05:00
YAMAMOTO Takashi
b9ad64627d iperf: accept -t 0, meaning forever 2021-06-11 07:52:03 -05:00
YAMAMOTO Takashi
d2b7d79f1d iperf_report_task: print the number of bytes transferred 2021-06-11 07:52:03 -05:00
YAMAMOTO Takashi
e8ed125fea iperf: improve report precision 2021-06-11 07:52:03 -05:00
Alin Jerpelea
0a6b1f55ab netutils: update licenses to Apache
Gregory Nutt is has submitted the SGA

Sebastien Lorquet has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-11 05:05:27 -05:00
Xiang Xiao
d9c1c5bbc8 Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-08 13:04:34 -07:00
Alin Jerpelea
bde535b436 Makefile: Max Holtzberg: update licenses to Apache
Gregory Nutt is has submitted the SGA

Max Holtzberg has submitted the SGA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-07 21:35:33 -05:00
Alin Jerpelea
ea1ced8ba3 Makefiles: Mateusz Szafoni: update licenses to Apache
Gregory Nutt is has submitted the SGA

Mateusz Szafoni has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-07 21:35:33 -05:00
Alin Jerpelea
59c607c8dc Makefile: Sebastien Lorquet: update licenses to Apache
Gregory Nutt is has submitted the SGA

Sebastien Lorquet has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-07 21:35:33 -05:00
Alin Jerpelea
ec339bc49a Makefiles: Gregory Nutt: 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-06-07 21:35:33 -05:00
YAMAMOTO Takashi
f961a6cb0f iperf: Do not busy loop on a connection closed by the peer
Tested on esp32-devkitc.

The peer was iperf on NetBSD.
> iperf version 2.0.5 (08 Jul 2010) pthreads
2021-06-07 10:20:23 -05:00
Xiang Xiao
d6d458c60b Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 14:11:16 +09:00
Xiang Xiao
e9104dbbef Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 06:36:44 +09:00
Xiang Xiao
1ee948e0c8 Include assert.h for DEBUGASSERT caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:34:37 +09:00
Xiang Xiao
d3f8f423d5 Include debug.h for xerr/xinfo/xwarn caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:33:17 +09:00
YAMAMOTO Takashi
95c9007668 webclient: Fix buffer overrun in wget_parsestatus
Similarly to the fix in wget_parseheaders.
But simply always bail out as i guess it's very rare to see
that long status line.

Tested with an aritifically small CONFIG_WEBCLIENT_MAXHTTPLINE=20,
which is smaller than "HTTP/1.1 301 Moved Permanently".
2021-05-16 11:32:47 -03:00
YAMAMOTO Takashi
b53375074b webclient.c: Fix buffer overrun in HTTP header parsing
* Detect a long header line which doesn't fit the buffer.

* If the header line in question doesn't seem important for us,
  just ignore it.

* Otherwise, bail out with -E2BIG.

The overrun was found by LLVM UBSan on macOS.

The following is an example of a long header line,
which doesn't fit the default CONFIG_WEBCLIENT_MAXHTTPLINE=200.
```
pacetanuki% curl -v https://www.midokura.com
:
:
< HTTP/2 200
< server: nginx
< date: Fri, 14 May 2021 02:16:24 GMT
< content-type: text/html; charset=UTF-8
< content-length: 131313
< x-powered-by: PHP/7.4.18
< link: <https://www.midokura.com/wp-json/>; rel="https://api.w.org/", <https://www.midokura.com/wp-json/wp/v2/pages/7>; rel="alternate"; type="application/json", <https://www.midokura.com/>; rel=shortlink
< x-powered-by: PleskLin
<
```
2021-05-16 11:32:47 -03:00
YAMAMOTO Takashi
eb1a99fdd6 webclient.c: Don't parse the status line as the first header line 2021-05-16 11:32:47 -03:00
YAMAMOTO Takashi
f17af21f9c webclient: Add a few ninfo in header parsing 2021-05-16 11:32:47 -03:00
Xiang Xiao
bb1e93cb67 netutils/wakeonlan: Remove the tab from the blank line in Kconfig
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-12 10:48:44 +01:00
Simon Piriou
842f149c78 netutils: add Wake-on-LAN util 2021-05-09 10:25:20 -03:00
YAMAMOTO Takashi
998abe1deb netlib_parseurl.c: Fix string overruns
For EINVAL, it doesn't make sense to keep parsing.
(For E2BIG, it might make some sense.)

Found by LLVM ASan.

```
=================================================================
==81622==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000000f2 at pc 0x00010d2746ca bp 0x7ffee29a9980 sp 0x7ffee29a9978
READ of size 1 at 0x6020000000f2 thread T0
    #0 0x10d2746c9 in netlib_parseurl netlib_parseurl.c:121
    #1 0x10d26b293 in parseurl webclient.c:479
    #2 0x10d265e48 in webclient_perform webclient.c:690
    #3 0x10d277c5b in main main.c:210
    #4 0x7fff7a06f3d4 in start+0x0 (libdyld.dylib:x86_64+0x163d4)

0x6020000000f2 is located 0 bytes to the right of 2-byte region [0x6020000000f0,0x6020000000f2)
allocated by thread T0 here:
    #0 0x10d3996d3 in wrap_strdup+0x203 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x3e6d3)
    #1 0x10d276abe in main main.c:147
    #2 0x7fff7a06f3d4 in start+0x0 (libdyld.dylib:x86_64+0x163d4)

SUMMARY: AddressSanitizer: heap-buffer-overflow netlib_parseurl.c:121 in netlib_parseurl
Shadow bytes around the buggy address:
  0x1c03ffffffc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03fffffff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c0400000000: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 00
=>0x1c0400000010: fa fa 00 fa fa fa 00 00 fa fa 00 06 fa fa[02]fa
  0x1c0400000020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==81622==ABORTING
```
2021-05-07 20:23:01 -07:00
YAMAMOTO Takashi
73a93e2370 netlib_parseurl.c: Appease nxstyle
The following errors are false positives.
https://github.com/apache/incubator-nuttx/issues/387

```
/Users/yamamoto/git/nuttx/apps/netutils/netlib/netlib_parseurl.c:57:13: error: C++ style comment
/Users/yamamoto/git/nuttx/apps/netutils/netlib/netlib_parseurl.c:59:35: error: C++ style comment
```
2021-05-07 20:23:01 -07:00
Atsunori Saito
a12f9d967c netutils/webclient: Fixed socket descriptor leak. 2021-05-03 16:44:28 +09:00
Masayuki Ishikawa
f902d900e1 netutils: dhcpc: Fix Kconfig for the usrsock
Summary:
- This commit fixes the renew command with the usrsock

Impact:
- None

Testing:
- Tested with spresense:wifi and esp32-devkitc:wapi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-04-29 01:27:47 -05:00
Gregory Nutt
844b193713 apps/netutils/dhcpc/Kconfig: Auto-select CONFIG_NET_UDP_BINDTODEVICE
DHCPC depends on CONFIG_NET_UDP_BINDTODEVICE in many cases.  Safest thing is to just auto-select it whenever DHCPC is selected.
2021-04-28 21:23:05 -05:00
Abdelatif Guettouche
80eba3aad1 netutils/iperf: Configs were using EXAMPLES_ instead of NETUTILS_. 2021-04-21 13:43:05 -05:00
chao.an
084cc55064 usrsock/server: replace the wakeup source to eventfd
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-21 09:53:40 -05:00