Commit Graph

999 Commits

Author SHA1 Message Date
Fotis Panagiotopoulos
0cdb2cfa48 Fixed compiler warnings. 2022-08-23 01:39:59 +08:00
weizihan
9dd3055014 apps: Fix the bug that setsockopt didn't check return value
Signed-off-by: weizihan <weizihan@xiaomi.com>
2022-08-17 22:50:56 +08:00
weizihan
e1ed558543 apps: Fix the bug that didn't initialize structure
Signed-off-by: weizihan <weizihan@xiaomi.com>
2022-08-16 23:18:18 +08:00
zhanghongyu
26892be894 usrsock: fix usrsock close hang when net not ready
reason: ept NULL when close request and poll event occur simultaneously

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-08-15 16:41:17 +03:00
zhanghongyu
451243accb usrsock_server: Reduce unnecessary poll prepare
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-08-15 16:41:17 +03:00
zhanghongyu
707b7be4da usrsock: ioctl Remove bad copy operations
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-08-15 16:41:17 +03:00
liuhaitao
06754940c5 dhcpd: fix build warning
CC:  dhcpd.c
In function 'dhcpd_openlistener',
    inlined from 'dhcpd_run.part.0' at dhcpd.c:1513:20:
dhcpd.c:1425:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
 1425 |   strncpy(req.ifr_name, interface, IFNAMSIZ);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2022-08-14 14:08:52 +03:00
Masayuki Ishikawa
000d1455b4 netutils: Make telnetd_daemon() in public
Summary:
- This commit makes telnetd_daemon() in public so that we
  can call it from applications.
- Also, adds new configs to support posix_spawnp()

Impact:
- telnetd only

Testing:
- Tested with sabre-6quad:netknsh (will be updated later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-08-09 23:17:25 +08:00
Petro Karashchenko
672b5ffbc1 netutils/iperf: fix string for iperf test interface option
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-08-05 13:57:28 +08:00
Peter van der Perk
dcd60a2abe Use thread-safe ntoa functions
NXStyle fixes

Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

API fixes and NXStyle fixes

Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Use thread-safe ntoa functions

NXStyle fixes

Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

API fixes and NXStyle fixes

Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-08-04 23:18:06 +08:00
liyi
c5102fe504 ifconfig support set IPv6 DNS server
Signed-off-by: liyi <liyi25@xiaomi.com>
2022-08-04 19:47:15 +08:00
ligd
1345fa13b1 usrsock: adjust rptun API
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:59 +08:00
Xiang Xiao
c252ec1481 Add printflike to all printf like functions
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-18 14:09:10 +03:00
YAMAMOTO Takashi
83505e217b dhcpc: Rename timeout Kconfig
NETUTILS_DHCPC_RECV_TIMEOUT -> NETUTILS_DHCPC_RECV_TIMEOUT_MS

Recently its unit has been changed from second to millisecond. [1]
Using the same Kconfig name for a different meaning is a pitfall
for an upgrade. I was using 3ms timeout because of this.

This commit renames it so that at least the default value
is used for a careless user like me.

[1]
```
commit 8fd4b6105b
Author: zrrong <zrrong@bouffalolab.com>
Date:   Fri May 27 11:35:23 2022 +0800

    netutils/dhcpc: Change the timeout unit to milliseconds
```
2022-07-07 21:42:58 +08:00
Satoshi Togawa
943df4cb60 pppd: Fix PAP Request packet. 2022-06-30 22:27:07 +08:00
YAMAMOTO Takashi
fe109998c9 webclient_get_tunnel: A comment about how to dispose the returned "conn" 2022-06-20 13:56:53 +08:00
YAMAMOTO Takashi
d435858c53 webclient: Export a few ops on webclient_conn_s
* Make webclient_conn_s self-contained so that it can be
  used without webclient_context.

* Add missing FAR.
2022-06-20 13:56:53 +08:00
YAMAMOTO Takashi
fca5b186b1 webclient: Make webclient_get_tunnel returns void
As it does never fail.
2022-06-20 13:56:53 +08:00
YAMAMOTO Takashi
eece4a5ca0 webclient_abort: Fix a resource leak for the tunneling case 2022-06-17 08:35:59 +03:00
YAMAMOTO Takashi
159ca00752 webclient: Allow users to specify extra headers for proxy
My primary motivation at this point is to use it for basic proxy auth.
(specify "Proxy-Authorization" header)
But there can be other use cases for proxy-specific extra headers.

If/when we want to support other non-trivial auth methods, probably
a callback-based mechanism will be necessary. But at this point,
this serves my purpose well.
2022-06-15 20:40:53 +08:00
Xiang Xiao
a12707177b Remove "| O_BINARY" or " |= O_BINARY" since O_BINARY is 0 now
follow nuttx kernel side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-07 20:22:38 +03:00
YAMAMOTO Takashi
610b04fa97 webclient: Clear WGET_FLAG_GOT_CONTENT_LENGTH for each request
Otherwise, a stale value might be used after a redirection.
2022-06-07 15:09:11 +03:00
YAMAMOTO Takashi
065a130bc8 webclient: Be a bit strict on Location header
* Record Location header explicitly

* Bail out / warn on unexpected cases
2022-06-07 15:09:11 +03:00
YAMAMOTO Takashi
0c4c811434 webcilent: Fix a buffer overrun on a malformed status line 2022-06-07 15:09:11 +03:00
YAMAMOTO Takashi
f7b3eb5b44 netlib_parseurl: Make the buffer size assumption explicit 2022-06-07 15:09:11 +03:00
YAMAMOTO Takashi
a7de8dffe7 netlib_parseurl.c: Add a comment 2022-06-07 15:09:11 +03:00
YAMAMOTO Takashi
a563014646 webclient: make webclient_get_tunnel assert http_status 2022-06-03 16:33:09 +08:00
YAMAMOTO Takashi
a696c8945e webclient: Don't forget to check http status before webclient_get_tunnel 2022-06-03 16:33:09 +08:00
YAMAMOTO Takashi
3f4e723ff7 webclient: dispose the response body by default
Instead of a NULL dereference.

This fixes a crash on CONNECT failure when trying to proxy https.
2022-06-03 16:33:09 +08:00
YAMAMOTO Takashi
dbee240869 webclient.c: Fix the placement of "Public Function" banner 2022-06-03 16:33:09 +08:00
YAMAMOTO Takashi
c116f8b673 webclient: Add https proxy (https over http) support
Use a separate webclient_context for tunnel establishment.

I chose this way (instead of having tunnelling steps in
the state machine of a single webclient_context) because
I want to allow tunnelling of non-HTTP protocols sooner or later.
2022-06-02 12:45:41 +08:00
YAMAMOTO Takashi
a95dd30f0e webclient: Add tunneling support
Add a primitive API for tunnel establishment.
(WEBCLIENT_FLAG_TUNNEL and webclient_get_tunnel)

I plan to use this to implement https proxy support.
That is, the primary user will be webclient itself.
2022-06-02 12:45:41 +08:00
YAMAMOTO Takashi
a46b144ab1 webclient: Remove an extra slash for proxy 2022-06-01 22:42:12 +08:00
zrrong
8fd4b6105b netutils/dhcpc: Change the timeout unit to milliseconds 2022-05-31 11:01:19 +03:00
YAMAMOTO Takashi
f7b0ad4b74 webclient: Require a port in proxy string 2022-05-24 22:42:54 +08:00
YAMAMOTO Takashi
4798f01449 webclient: Implement proxy
Only the very basic case (http over http) for now.
2022-05-24 22:42:54 +08:00
YAMAMOTO Takashi
4f4f4da526 webclient: Separate wget_target_s from wget_s
I plan to use the former for proxy settings.
2022-05-24 22:42:54 +08:00
zhouliang3
426cc840d8 apps/ping: fix ping statistics error problem
nsh> ping 192.168.31.162
PING 192.168.31.162 56 bytes of data
56 bytes from 192.168.31.162: icmp_seq=0 time=8 ms
56 bytes from 192.168.31.162: icmp_seq=1 time=27 ms
56 bytes from 192.168.31.162: icmp_seq=2 time=17 ms
56 bytes from 192.168.31.162: icmp_seq=3 time=14 ms
56 bytes from 192.168.31.162: icmp_seq=4 time=16 ms
56 bytes from 192.168.31.162: icmp_seq=5 time=14 ms
56 bytes from 192.168.31.162: icmp_seq=6 time=8 ms
56 bytes from 192.168.31.162: icmp_seq=7 time=87 ms
WARNING: Received after timeout
56 bytes from 192.168.31.162: icmp_seq=8 time=1003 ms
56 bytes from 192.168.31.162: icmp_seq=8 time=6 ms
56 bytes from 192.168.31.162: icmp_seq=9 time=5 ms
10 packets transmitted, 11 received, 4294967287% packet loss, time 10011 ms

Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
2022-04-25 22:12:42 +08:00
Xiang Xiao
1acca2946e Update the call site of exec to accommodate the environment variables
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-22 10:40:38 +03:00
zhanghongyu
b80ef1df87 usrsock: Don't clear recv and send available flag
Don't clear available flag if the response indicate there is more data

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-16 14:07:48 +08:00
songlinzhang
460f631fa3 netutils/usrsock_rpmsg: broadcast the client DNS server to server
Signed-off-by: songlinzhang <songlinzhang@xiaomi.com>
2022-04-15 16:05:38 +08:00
chao.an
b8b9d45706 netutils/ping: skip the id check
https://joekuan.wordpress.com/2017/05/30/behaviour-of-identifier-field-in-icmp-ping-as-udp-between-linux-and-osx/
https://lwn.net/Articles/443051/

https: //github.com/apache/incubator-nuttx-apps/blob/master/netutils/ping/icmp_ping.c#L298

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-14 23:23:07 +03:00
zhanghongyu
a6c986d516 rpmsg_usrsock: Support the wireless ioctl which contain pointer 2/2
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-14 02:47:53 +08:00
zhanghongyu
3a42d849f5 Revert "rpmsg: pointer of netdev ioctl support cross-core memory access"
This reverts commit bd539651cdf1e5067dc5d21349ef835e98e262eb.

Reason for revert: Change the implementation method

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-14 02:47:53 +08:00
chao.an
25d7dfe990 fs/epoll: fix compile break about change type of pollevent_t
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-07 16:23:47 +08:00
Xiang Xiao
0c7adf4567 usrsock/rpmsg: Change the dependence from OPENAMP to RPTUN
since all rpmsg driver need the extension api exposed by rptun driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-05 10:05:47 +03:00
Petro Karashchenko
319203d5d8 apps: unify FAR attribute usage across apps
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-05 00:55:22 +08:00
Petro Karashchenko
aaa950faee netutils/ftpd: Do not terminate connection if CWD fails
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-04 17:32:51 +08:00
zhanghongyu
16c1fec99d usrsock: Move event field to usrsock_message_common_s
Zero the events field for all response message

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-03 11:39:19 +09:00
ligd
e0da9d1409 rexec: correct af type from int to sa_family_t
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-29 17:10:32 +08:00
Petro Karashchenko
c1dfaf42ff netutils/ftpd: add option to login to FTPD using FSUTILS_PASSWD
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-28 23:30:45 +08:00
Jiuzhu Dong
dede3698ae rexecd: fix compile warning
rexecd.c:196:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-28 00:25:56 +08:00
songlinzhang
f85388578c Add dhcp6c module
Signed-off-by: songlinzhang <songlinzhang@xiaomi.com>
2022-03-19 23:25:50 +08:00
xuewenliang
c69ec94d13 Modifying the ping command
1、Round trip times in the ping command range from millisecond to subtle
2、Add statistics on RTT related min/avg/Max/mdev in ping program
3、The ping command supports ctrl+c interruption operations

Signed-off-by: xuewenliang <xuewenliang@xiaomi.com>
2022-03-18 09:54:01 +08:00
zhanghongyu
5e22b6f564 fix: iperf can not exit when stop
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-03-15 18:01:04 +08:00
zhanghongyu
f1d5d6e671 fix: ap socket can not accept twice
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-03-15 18:01:04 +08:00
zhanghongyu
6c2a487f85 feature: pointer of netdev ioctl support cross-core access via clean dcache
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-03-15 18:01:04 +08:00
Alin Jerpelea
448a7d2ec9 netutils: telnetc: convert 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>
2022-03-11 00:14:32 +02:00
Petro Karashchenko
f9baa422c1 style: unify path to files in comment section
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-09 10:37:33 +08:00
Alin Jerpelea
3984796156 apps: examples: nxstyle fixes
Fix for errors reported by the nxstyle tool.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-03-08 17:04:01 +02:00
Alin Jerpelea
e156e192bf apps: netutils: esp8266: nxstyle fixes
Fix for errors reported by the nxstyle tool.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-03-08 17:04:01 +02:00
Alin Jerpelea
4535245e08 apps: netutils: esp8266: update licenses to Apache
Gregory Nutt has submitted the SGA
Pierre-Noel Bouteville has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-03-08 17:04:01 +02:00
YAMAMOTO Takashi
f2737a208c webclient: Remove a duplicated "Connection:" header
When making the following change, I haven't noticed that
g_httpuseragentfields contains a "Connection" header.

```
commit 092ce81444
Author: YAMAMOTO Takashi <yamamoto@midokura.com>
Date:   Mon Mar 7 09:30:23 2022 +0900

    webclient: Always use "connection: close" for HTTP 1.1 for now

    * This matches the HTTP 1.0 behavior.

    * Persistent connection doesn't make much sense with the current API.
```

It seems that some servers are not happy with the duplicated header
and ignore them. (and do the default keep-alive for HTTP 1.1)
eg. Azure Blob (global)
2022-03-08 11:52:35 +08:00
YAMAMOTO Takashi
8a5dc04be2 webclient: Remove an inappropriate comment (a copy-and-paste botch) 2022-03-08 11:52:28 +08:00
YAMAMOTO Takashi
44e80ac972 webclient: Implement chunked transfer (receiving side)
This is a requirement for HTTP 1.1.

Tested against:

* http://httpbin.org/stream/10

* Docker API
2022-03-08 09:39:55 +08:00
YAMAMOTO Takashi
092ce81444 webclient: Always use "connection: close" for HTTP 1.1 for now
* This matches the HTTP 1.0 behavior.

* Persistent connection doesn't make much sense with the current API.
2022-03-08 09:39:55 +08:00
YAMAMOTO Takashi
7949059ec2 webclient: Send HTTP 1.1 request if enabled 2022-03-08 09:39:55 +08:00
YAMAMOTO Takashi
3759da3d00 webclient: Add a parameter to specifiy protocol version 2022-03-08 09:39:55 +08:00
Alin Jerpelea
cd79a79d00 Makefile: 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>
2022-03-08 01:44:49 +08:00
Xiang Xiao
18bb3331f3 netutils/webserver: Fix the compiler warning
httpd_dirlist.c: In function 'httpd_dirlist':
Error: httpd_dirlist.c:199:40: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 128 [-Werror=format-truncation=]
  199 |       snprintf(path, CONFIG_NAME_MAX, "%s/%s",
      |                                        ^~
httpd_dirlist.c:199:7: note: 'snprintf' output between 2 and 385 bytes into a destination of size 128
  199 |       snprintf(path, CONFIG_NAME_MAX, "%s/%s",
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  200 |                file->path, dent->d_name);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-07 00:58:19 +08:00
Xiang Xiao
3afd1234e0 netutils/netlib: Fix error: 'strncpy' specified bound 16 equals destination size
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-04 22:05:14 +02:00
Xiang Xiao
f31cc67da8 netutils/usrsock_rpmsg: Switch the nonblocking mode by psock_ioctl instead
since it's more simpler than psock_ioctl

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-04 14:00:29 +02:00
Xiang Xiao
997379d14e netutils/webserver: Fix the compiler error when -no-builtin is removed
Error: httpd.c:671:7: error: 'strncpy' output truncated before terminating nul copying 12 bytes from a string of the same length [-Werror=stringop-truncation]
  671 |       strncpy(pstate->ht_filename, "/" CONFIG_NETUTILS_HTTPD_INDEX,
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  672 |               strlen("/" CONFIG_NETUTILS_HTTPD_INDEX));
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-03 12:49:35 +02:00
Xiang Xiao
4cc0c755bf Remove CONFIG_CLOCK_MONOTONIC special code
since this opion doesn't exist anymore

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-23 01:21:44 +08:00
Xiang Xiao
0426c8c09f Fix error: 'strncpy' specified bound 16 equals destination size
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-15 12:38:03 +01:00
Huang Qi
5451214d0b ftpd: Remove usage of deprecated macro __NUTTX__
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-14 13:57:10 +08:00
Alexander Lunev
e317d32fe1 netutils/netcat: fixed crash on accept() invocation.
Sometimes netcat in server mode crashed with "psock_accept: ERROR: si_accept failed: -9".
And sometimes it crashed with "up_assert: Assertion failed at file:inet/inet_sockif.c line: 841 task: netcat".
2022-02-10 12:20:27 +08:00
Xiang Xiao
8361990261 netutils: Check lo by CONFIG_NET_LOOPBACK not CONFIG_NET_LOCAL
CONFIG_NET_LOCAL is used to enable Unix Domain Socket

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-09 12:13:31 +08:00
Xiang Xiao
60989b196c neutils/thttpd: Remove CONFIG_SDCLONE_DISABLE
since this option doesn't exist anymore

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-31 19:03:55 +01:00
Alexander Lunev
d595ba2b25 netutils/netcat: implemented NETUTILS_NETCAT_BUFSIZE option.
This option can be used for the performance optimization if sendfile() is not applicable.
2022-01-25 00:47:34 +08:00
Alexander Lunev
5a697c18ba netutils/netcat: fixed ISO C89/C90 related warnings:
warning: ISO C90 forbids variable length array ‘buf’ [-Wvla]
warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
2022-01-21 12:30:40 +08:00
Alexander Lunev
b8c060260c netutils/ftpc: implemented FTPC_OVER_SENDFILE option.
This option enables using sendfile() in ftpc binary transfer mode of PUT operation.
If the option is enabled but ASCII transfer mode is activated,
ftpc falls back to the combination of read() and write().
Using sendfile() provides a higher performance compared to
the combination of read() and write().

Also this option is useful for testing / debugging tcp_sendfile()
functionality of NuttX TCP/IP stack.
2022-01-20 14:16:01 +08:00
Alexander Lunev
371beb2a0f netutils/netcat: sendfile related code refactoring + small fixes 2022-01-18 10:38:55 +08:00
Xiang Xiao
c7e96dbe32 Fix the nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-17 07:57:22 +01:00
Petro Karashchenko
9480c0ec12 include: fix double include pre-processor guards
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-16 17:36:21 +08:00
Fotis Panagiotopoulos
bc5d8034f1 Typo fixes. 2022-01-06 10:30:41 +08:00
songlinzhang
04dd2d70fd netutils/dhcpc: Fix dhcpc lease bug
Signed-off-by: songlinzhang <songlinzhang@xiaomi.com>
2022-01-05 18:27:59 +08:00
Jiuzhu Dong
64ffdb46bb ntpc: optimize stack used
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-01-05 18:36:12 +09:00
Alexander Lunev
b9a6dc2a85 netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option.
This option enables using sendfile() in netcat client mode
if a normal file (not stdin) is sent. If the option is enabled
but stdin is sent rather than a normal file, netcat falls back
to the combination of read() and write().
Using sendfile() provides a higher performance compared to
the combination of read() and write().

Also this option is useful for testing / debugging tcp_sendfile()
functionality of NuttX TCP/IP stack.
2022-01-05 13:29:04 +08:00
chao.an
df53de1d68 net/usrsock: replace usrsock xid type to uint64_t
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-05 13:25:21 +08:00
Petro Karashchenko
5ac15130db apps: remove space befone newline in logs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-27 20:52:08 -06:00
Xiang Xiao
66dbaa4539 Replace self defined macros with NET_SOCK_[FAMILY|TYPE|PROTOCOL]
NET_SOCK_* is defined by nuttx/net/netconfig.h and then can be shared

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-20 16:04:29 -03:00
songlinzhang
e0fc53b23c netutils/dhcpc: add non-blocking interface
Signed-off-by: songlinzhang <songlinzhang@xiaomi.com>
2021-11-29 02:04:49 -06:00
Jiuzhu Dong
b480d00323 rexec: support send command with arguments
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-10-23 03:58:49 -05:00
songlinzhang
98dfaa3eff dhcpc abnormal block
The logic changes are as follows:
1、Loop sending the DISCOVER up to CONFIG_NETUTILS_DHCPC_RETRIES times
   and exit if failure
2、Loop sending the REQUEST up to CONFIG_NETUTILS_DHCPC_RETRIES times
   and exit if failure

Signed-off-by: songlinzhang <songlinzhang@xiaomi.com>
2021-10-22 09:20:25 -03:00
Alan C. Assis
cb1b8e10db chat: Replace _info with ninfo to avoid polluting the nsh 2021-09-27 10:31:43 +02:00
YAMAMOTO Takashi
78fb3bc240 webclient: handle EINTR in a few places 2021-09-14 14:39:29 +08:00
Jiuzhu Dong
2add33e6a3 rexecd/rexec: support AF_RPMSG to communicate
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-13 09:00:20 +08:00
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
chao.an
2214e51457 netutls/usrsock_rpmsg_server: add support for send reassemble
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-21 09:53:40 -05:00
Xiang Xiao
0ee6f0e5e0 netutils/rpmsg: Prepare poll fds only when error with EINTR
to improve the performance

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id88df8618473b56236821b9e0f6399dfef2c958d
2021-04-13 08:32:12 +01:00
YAMAMOTO Takashi
2d0a174cec webclient: 304 and 305 are not really redirects
Eg. The docker API sometimes returns 304 even for requests without etags.
https://docs.docker.com/engine/api/v1.40/#operation/ContainerStop
2021-04-07 06:44:16 -05:00
YAMAMOTO Takashi
15c65b23c7 netutils/webclient/webclient.c: Appease the latest nxstyle 2021-04-07 06:44:16 -05:00
Xiang Xiao
0f7ee888d4 neutils/mqttc: Update to version 1.1.5
and remove the temp change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-31 17:49:46 +01:00
Matias N
d548803d38 httpd: expose http_send_headers to be used in CGI handlers 2021-03-30 22:27:49 -05:00
Abdelatif Guettouche
e35ea9486e mqtt: Add glue code to download MQTT-C.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-03-29 08:52:14 -05:00
chao.an
4c256e7db3 netutils/dhcpd: handshake the dhcpd message with server port.
resolve the dhcpd compatibility issues on some strict system, such as Windows XP,7,10

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-21 20:55:32 -07:00
Jiuzhu Dong
801acce04e dhcpd/telnet: don't need to dupcalite listen socket when task_create
N/A

Change-Id: Id0d613809c4caf902332b16daedebbe45acee7f2
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-19 08:21:27 +09:00
Jiuzhu Dong
ff4c3c3fb8 thttpd: add THTTPD_NFILE_DESCRIPTORS limits instead of NFILE_DESCRIPTORS
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-16 07:56:45 -07:00
YAMAMOTO Takashi
f8cb9db729 iperf: Plug a memory leak 2021-03-16 02:13:25 -07:00
YAMAMOTO Takashi
25d29482ea iperf: plug a thread leak 2021-03-16 02:13:25 -07:00
YAMAMOTO Takashi
5140962436 netutils/iperf/README.md: document what this is 2021-03-15 07:14:16 +01:00
Jiuzhu Dong
4c6ded2661 app: delete NFILE_DESCRIPTORS limits
Change-Id: I3ced2b2b7440a2c79a712cfc97b4cd15d2bddd4c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-12 21:12:07 -08:00
Dong Heng
208df89ab0 netutils/dhcpd: Fix printf format error based on different chip arches 2021-03-05 07:45:07 -08:00
Jiuzhu Dong
681da55d4a netutils/thttpd: fix compile break
change NSOCKET_DESCRIPTORS to NFILE_DESCRIPTORS

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-03 02:02:22 -08:00
Jiuzhu Dong
3708b6e478 net/socket: recover POLLSOCK and keep polling directly by socket
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-01 09:20:04 -08:00
Jiuzhu Dong
0e1148cf1d usrsock: delete sock->s_crefs to fix compile break
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-25 01:44:45 -08:00
Jiuzhu Dong
459916f81c net/socket: delete config CONFIG_NSOCKET_DESCRIPTORS
N/A

Change-Id: I50376600292a853652af76e2236bb428d1037313
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-24 05:53:14 -08:00
YAMAMOTO Takashi
8ae1267054 ntpclient: Add ntpcstatus() api to query ntpc status programatically
For now, just provide the latest samples.
2021-02-20 01:30:55 -08:00
YAMAMOTO Takashi
ab86da4639 netutils/ntpclient/Kconfig: Add NETUTILS_NTPCLIENT_STAY_ON
It's used in the code but missing in Kconfig.
I guess the PR [1] forgot to add this.

Make it "y" by default because it seems like the original behavior
before the PR [1].  I have no strong opinions on the default
either ways.

[1] https://github.com/apache/incubator-nuttx-apps/pull/570
2021-02-15 01:53:37 -08:00
YAMAMOTO Takashi
f613da4f92 webclient.c: Remove a space after a negative sign
from:

    return - ECONNABORTED;

to:

    return -ECONNABORTED;

The latter style is more commonly used within NuttX code base.

Note: nxstyle doesn't complain on either of them.
2021-02-12 08:51:23 +00:00
chao.an
ebbf2fc072 netutils/dhcpc: configurable Bootstrap flags
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-02-11 21:38:43 -08:00
YAMAMOTO Takashi
ca6907ccbe ntpclient.c: Avoid integer overflows in offset calculation
The current calculation easily overflows if the local time is
around the unix epoch.  I guess it isn't too unusual for
devices without RTC.  Or, the battery is dead.  Or, whatever.

This commit avoids the overflow by simply dividing everything by 2.
While more sophisticated and precise solutions are possible,
I feel that they are overkill for this simple implementation.

For example,

The unix epoch (1970) is 0x83aa7e8000000000 in
64-bit NTP timestamp. (1900-origin)
The timestamp now, as of writing this, is 0xe3cda16b00000000.

With the code before this commit, the offset will be:

(lldb) p (long long)((0xe3cda16b00000000 - 0x83aa7e8000000000) + (0xe3cda16b00000000 - 0x83aa7e8000000000)) / 2
(long long) $16 = -2295952992316162048
(lldb)

with the new code, it would be:

(lldb) p (long long)((0xe3cda16b00000000 / 2 - 0x83aa7e8000000000 / 2) + (0xe3cda16b00000    / 2 - 0x83aa7e8000000000 / 2))
(long long) $17 = 6927419044538613760
(lldb)

It's the correct offset from the unix epoch:

(lldb) p 6927419044538613760 >> 32
(long) $0 = 1612915435
(lldb)

spacetanuki% date -r 1612915435
Wed Feb 10 09:03:55 JST 2021
spacetanuki%
2021-02-09 22:47:20 -08:00
Masayuki Ishikawa
f14e98c942 netutils: iperf: Add pthread_join() to wait for completion
Summary:
- I noticed that lc823450-xgevk:rndis does not work with iperf
- Finally, I found that it does not call pthread_join()
- This commit fixes this issue

Impact:
- No impact

Testing:
- Tested with lc823450-xgevk:rndis
- NOTE: need to add iperf in the defconfig

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-02-01 18:21:36 -08:00
YAMAMOTO Takashi
8a19fe36e1 netcat_server: do not loop forever
To make it similar to other implementations.
(I followed the behavior of NetBSD's nc, which came from OpenBSD.)
2021-01-28 01:18:45 -08:00
YAMAMOTO Takashi
eb996e5650 netcat: Rewrite the i/o loop
* Stop echoing back the input.
  It isn't the responsibility of this app, IMO.

* Allow non-text data

* Error checks and cleanups
2021-01-28 01:18:45 -08:00
YAMAMOTO Takashi
8093aa7487 netcat: Fix the usage output 2021-01-28 01:18:45 -08:00
YAMAMOTO Takashi
87c876c1cc netcat: Fix a buffer overflow
The buffer doesn't have the space for the terminating NUL.
Fix it by replacing it with fwrite, as there seems to be little reason
to use fprintf and NUL-terminated string in the first place.
2021-01-27 11:28:10 +01:00
Juha Niskanen
3b21cd9ceb netutils/ntpclient: add more features
Allow multiple NTP servers, also with runtime configurable list
Add validation of received NTP packets
NTPv4 support with 'Kiss o' Death' message handling
IPv6 support
Collect multiple NTP samples and filter outsiders
Check if system clock has been altered during NTP (if CONFIG_CLOCK_MONOTONIC)

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-26 03:23:27 -08:00
YAMAMOTO Takashi
412cf2b955 webclient: Fix a use of uninitialized variable
Detected by clang static analyzer.
2021-01-19 19:06:24 -08:00
Juha Niskanen
e800609e7b netutils/tftpc: typos, nxstyle 2021-01-19 19:51:33 +01:00
YAMAMOTO Takashi
ee1f4fdcdb webclient: Don't call the sink callback if no data is available
This happened frequently for me with Docker Desktop's
/var/run/docker.sock on macOS.
But I believe it can happen on other environments, even with TCP.

Alternatively, this case can be handled by the callback
implementations.  But it's simpler to handle the corner case here.
2021-01-17 18:44:17 -08:00
YAMAMOTO Takashi
1131cbe14d webclient: Implement AF_LOCAL 2021-01-17 18:44:17 -08:00
Masayuki Ishikawa
7f079d1c3c netutils : iperf: Fix compile warnings with Arm GCC 9.3.1
Summary:
- This commit fixes compile warnings with Arm GCC 9.3.1

Impact:
- None

Testing:
- Tested with lm3s6965-ek:discover
- NOTE: need to add the following configs
  +CONFIG_EXAMPLES_IPERF=y
  +CONFIG_EXAMPLES_IPERFTEST_DEVNAME="eth0"

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-15 02:22:40 -06:00
Juha Niskanen
35535655c5 ntpclient: change sinfo to ninfo
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-14 11:07:58 -06:00
YAMAMOTO Takashi
ebe3b0d302 webclient: Report unexpected connection loss as an explicit error
Otherwise, it can end up with mysterious results in user apps.
2021-01-13 20:51:06 -06:00
Juha Niskanen
eceaeb926a netutils/ftpd, examples/ftpd: code cleanup and nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-13 20:22:55 -06:00
Juha Niskanen
31f52a1971 netutils/ftpd: fix compilation on dual-stack systems
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-13 20:22:55 -06:00
Juha Niskanen
5c8d6934a5 netutils/ftpd: fix hardfault when initial socket, bind or listen fails
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-13 20:22:55 -06:00
chenwen
756dc32fd0 netutils/iperf: Add iperf example.
system/argtable3: Add an ANSI C library for command-line parsing.
2021-01-07 08:43:26 -06:00
YAMAMOTO Takashi
f6f99c43aa netinit: Make the default SSID and passphrase empty
* It doesn't make much sense to have the default values for
  these highly environment-dependent settings.

* netutils/netinit/netinit_associate.c calls wpa_driver_wext_associate
  if the SSID is not empty. Depending on the environment, it can take
  long to fail. It slows down the boot of some configurations
  considerably. eg. esp32-devkitc:wapi
2020-12-22 01:23:55 -06:00
Huang Qi
3040c59ae9 Replace all wget with curl
wget is missing from some system (like macOS and Windows native),
it's better to use curl to simplify build environment.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-21 22:45:46 -06:00
Juha Niskanen
2a11d60246 netutils/ftpc: fix incorrect comments, nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-13 11:14:43 -06:00
Juha Niskanen
810398de01 netutils/ftpc: add some error checks
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-13 11:14:43 -06:00
Juha Niskanen
4a56546811 netutils/ftpc: add config for using binary type for size command
This is handy for FOTA clients and others that always get binary files.

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-13 11:14:43 -06:00
Juha Niskanen
8f0e872384 netutils/ftpc/ftpc_listdir.c: fix hardfault when issuing 'ls' before 'login'
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-13 11:14:43 -06:00
YAMAMOTO Takashi
ab83a12cff netutils/chat/chat.c: Avoid assumping debug macro expansion 2020-12-01 07:45:05 +01:00
YAMAMOTO Takashi
12a98433b7 netutils/chat/chat.c: Appease nxstyle
The following nxstyle error is intentionally left.
It's a nested function. I guess nxstyle doesn't support it.

netutils/chat/chat.c:110:8: error: Bad comment alignment
2020-12-01 07:45:05 +01:00
YAMAMOTO Takashi
3e015320e3 netutils/ftpd/ftpd.c: Fix syslog formats 2020-11-27 02:43:30 -06:00
YAMAMOTO Takashi
d1821c9bf0 netutils/thttpd/thttpd.c: Fix syslog formats 2020-11-26 19:28:14 -08:00
YAMAMOTO Takashi
c04f59cb2e netutils/thttpd/thttpd.c: Appease nxstyle
The following nxstyle errors are intentionally left.
The first one is in the copyright notice.
The others are identifiers like ClientData etc.

netutils/thttpd/thttpd.c:10:81: error: Long line found
netutils/thttpd/thttpd.c:99:2: error: Mixed case identifier found
netutils/thttpd/thttpd.c💯2: error: Mixed case identifier found
netutils/thttpd/thttpd.c:131:17: error: Mixed case identifier found
netutils/thttpd/thttpd.c:131:57: error: Mixed case identifier found
netutils/thttpd/thttpd.c:132:36: error: Mixed case identifier found
netutils/thttpd/thttpd.c:133:52: error: Mixed case identifier found
netutils/thttpd/thttpd.c:134:23: error: Mixed case identifier found
netutils/thttpd/thttpd.c:134:63: error: Mixed case identifier found
netutils/thttpd/thttpd.c:527:2: error: Mixed case identifier found
netutils/thttpd/thttpd.c:597:17: error: Mixed case identifier found
netutils/thttpd/thttpd.c:597:57: error: Mixed case identifier found
netutils/thttpd/thttpd.c:608:14: error: Mixed case identifier found
netutils/thttpd/thttpd.c:615:38: error: Mixed case identifier found
netutils/thttpd/thttpd.c:620:14: error: Mixed case identifier found
netutils/thttpd/thttpd.c:625:37: error: Mixed case identifier found
netutils/thttpd/thttpd.c:632:36: error: Mixed case identifier found
netutils/thttpd/thttpd.c:633:52: error: Mixed case identifier found
netutils/thttpd/thttpd.c:643:23: error: Mixed case identifier found
netutils/thttpd/thttpd.c:643:63: error: Mixed case identifier found
netutils/thttpd/thttpd.c:730:35: error: Mixed case identifier found
netutils/thttpd/thttpd.c:739:29: error: Mixed case identifier found
2020-11-26 19:28:14 -08:00