Commit Graph

999 Commits

Author SHA1 Message Date
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
YAMAMOTO Takashi
92843ede9d netutils/thttpd/thttpd.c: Replace a non-ascii character
Replace a character (0xa9, which is the copyright sign in ISO 8859)
with "(C)".
2020-11-26 19:28:14 -08:00
YAMAMOTO Takashi
9aeade97d5 netutils/thttpd/fdwatch.c: Fix syslog formats 2020-11-26 19:28:14 -08:00
YAMAMOTO Takashi
d4f751f41f netutils/thttpd/fdwatch.c: Replace a non-ascii character
Replace a character (0xa9, which is the copyright sign in ISO 8859)
with "(C)".
2020-11-26 19:28:14 -08:00
YAMAMOTO Takashi
e1cfa52efa netutils/dhcpd/dhcpd.c: Fix syslog formats 2020-11-26 19:28:14 -08:00
YAMAMOTO Takashi
6520eb65b3 netutils/webserver/httpd.c: Fix syslog formats 2020-11-26 19:28:14 -08:00
YAMAMOTO Takashi
72d9b34fb1 netutils/tftpc/tftpc_put.c: Fix syslog formats 2020-11-24 18:44:23 -08:00
YAMAMOTO Takashi
5a4bf6b349 netutils/tftpc/tftpc_get.c: Fix a syslog format 2020-11-24 18:44:23 -08:00
YAMAMOTO Takashi
eeded9daa1 netutils/ntpclient/ntpclient.c: Fix syslog formats 2020-11-24 18:44:23 -08:00
YAMAMOTO Takashi
13424fc404 netutils/ftpc/ftpc_putfile.c: Fix syslog formats 2020-11-24 18:44:23 -08:00
YAMAMOTO Takashi
2a3f2ea8c6 netutils/ftpc/ftpc_putfile.c: Appease nxstyle 2020-11-24 18:44:23 -08:00
YAMAMOTO Takashi
7b3ccfa9da netutils/ftpc/ftpc_getfile.c: Fix a syslog format 2020-11-24 18:44:23 -08:00
YAMAMOTO Takashi
f83caca9ac netutils/ftpc/ftpc_getfile.c: Appease nxstyle 2020-11-24 18:44:23 -08:00
YAMAMOTO Takashi
5065d470ce netutils/netlib/netlib_ipmsfilter.c: Fix a syslog format 2020-11-23 04:59:11 -08:00
YAMAMOTO Takashi
cbaf05bfd0 netutils/netlib/netlib_ipmsfilter.c: Appease nxstyle 2020-11-23 04:59:11 -08:00
YAMAMOTO Takashi
37aa346da6 netutils/dhcpc/dhcpc.c: Fix syslog formats 2020-11-23 04:59:11 -08:00
YAMAMOTO Takashi
73fb7baa05 webclient: Distinguish request size and buffer size in body callback
This fixes the case when webclient_set_static_body is used
for data larger than webclient_context::buflen.

Note: as of writing this, webclient_set_static_body is the
only user of body_callback in NuttX apps tree.
2020-11-19 18:46:38 -08:00
Philippe Coval
4a5152fc91 netutils/netcat: Add netcat tool
Check readme for usage and demo:

[![weboftwins-osvehicle-2020-rzr](
https://files.mastodon.social/media_attachments/files/105/163/916/892/863/178/original/05468e28b4463f95.png
)](
https://mastodon.social/@rzr/105225153152922220#weboftwins-osvehicle-2020-rzr
"weboftwins-osvehicle-2020-rzr")

Change-Id: I2eac915954ca6cf585f01addb53df581631a7ae6
Bug: https://github.com/apache/incubator-nuttx/pull/1999
Relate-to: https://github.com/rzr/aframe-smart-home/issues/3
Origin: https://github.com/CrossStream/nuttx-apps/tree/sandbox/rzr/review/master/netutils/netcat
Forwarded: https://github.com/apache/incubator-nuttx-apps/pull/482
Signed-off-by: Philippe Coval <rzr@users.sf.net>
2020-11-17 09:12:54 -08:00
YAMAMOTO Takashi
b4651db64f netutils/webserver/httpd_dirlist.c: Fix a printf format warning 2020-11-13 05:51:23 -08:00
YAMAMOTO Takashi
28296d539d netutils/ftpd/ftpd.c: Fix a printf format warning 2020-11-13 05:51:23 -08:00
Simon Piriou
a3e27eb1a0 netutils/webserver: fix build error 2020-11-08 17:44:08 -08:00
ligd
0781dbf9e9 usrsock_rpmsg: fix can't wake ppoll when no ACTION
N/A

no matter open/close CONFIG_SIGUSR1_ACTION, usrsock always do,
unmask SIGUSR1, set action to NULL.

Change-Id: I39ba51db8e4c77b4923c97598b3cb73c12473a2c
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-10-27 10:16:55 -07:00
Xiang Xiao
8375a2177e Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-18 22:27:57 -07:00
Xiang Xiao
8a63e58936 Change all 'Nuttx' to 'NuttX'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-18 22:27:57 -07:00
David Sidrane
cb111c0ee8 netinit:Fix typo IPCFG_USE_DHCPC->IPCFG_USE_DHCP 2020-10-16 10:11:21 +08:00
Gregory Nutt
f65b16bb2e Incorporate IP configuration files into netinit.
Uses logic from apps/fsutils/ipcfg to obtain the IP address configuration from a file, if available.  This only effects the behavior of netinit if CONFIG_FSUTILS_IPCFG is selected and if an IP configuration file is available on a file system. Otherwise, it reverts to the preceding behavior.

Also adds definitions to apps/include/fsutils/ipcfg.h to formalize a bit encoding of the prototype which was already in use, but not documented.

Also fixes some bad assertions (duplication of PR #420) and makes use of variable names consistent in ipcfg.h comments and in ipcfg_text implementation.
2020-10-06 10:42:35 -07:00
YAMAMOTO Takashi
a1db71fa43 webclient improvements
Highlights:

* TLS support (a hook to allow users to provide TLS implementation)
* ability to add extra request headers
* ability to use PUT method
* ability to report http status
* error handling improvements

Proposed on the ML while ago:
https://www.mail-archive.com/dev@nuttx.apache.org/msg03803.html

The original API is kept for now.
I plan to remove them after adapting the existing users.
(examples in this repo)
2020-10-01 15:32:25 +08:00
YAMAMOTO Takashi
b78370dbf2 webclient: move WGET_USE_URLENCODE definiton to the header
Because it's used by the header.

This fixes warnings while building wgetjson.
2020-09-30 08:22:16 +02:00
Masayuki Ishikawa
e8a353af05 netutils: dhcpc: Fix dhcpc.c
Summary:
- dhcpc now uses gethostname() but the hostname might be empty
- This commit fixes this issue

Impact:
- All use cases which use dhcpc

Testing:
- Tested with spresense:wifi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-09-20 08:19:38 -07:00
chao.an
3061dbf2f8 wireless/wapi: add option to associate with bssid
Change-Id: I68ef42edfc50ef5baf0f02a570d0e7f79669659f
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 04:20:43 -07:00
chao.an
77aa0e8908 netutils/dhcpc: try to get the host name via syscall first
Change-Id: I22aa8316f5c126bf3bafe9476a27a43c01da6129
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 01:13:05 -07:00
Pierre-Olivier Vauboin
bd537f286d ntpclient: fix NTP daemon state in case of DNS failure 2020-09-15 01:18:37 +08:00
Xiang Xiao
837b405624 Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-23 15:44:32 -06:00
SPRESENSE
78e8090842 examples: wget: Fix nxstyle issues 2020-08-18 10:07:47 -05:00
SPRESENSE
7a1d626504 netutils/webclient: Enable to send long HTTP request
Call send() repeatedly until whole buffer to be sent.
2020-08-18 10:07:47 -05:00
Xiang Xiao
e71e537e24 ftpc_transfer.c:667:15: Fix error: ‘argc’ undeclared
forget in commit efeb1d10b1

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I93a99e909dac57821366f7b522404e673fbcd9d8
2020-08-15 18:19:31 +01:00
Xiang Xiao
efeb1d10b1 netutils/ftpc: Change watchdog callback prototype
follow up the kernel side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-14 08:20:05 -06:00
Xiang Xiao
ebf37162ed Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-11 12:33:50 -06:00
Xiang Xiao
bf4c36c83f netutils/ftpc: Embed wdog_s in ftpc_session_s directly
follow up the kernel side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-11 12:33:50 -06:00
Xiang Xiao
e6c5ff9208 Remove the unnecessary touch and clean from Makefile
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-11 19:10:19 +01:00
chao.an
8917467d04 netutils/dhcpd: correct the member name
Change-Id: I4dc6be8550a938851ae897fd93200a995e5c5178
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-07 14:16:14 -05:00
SPRESENSE
c1bf012211 netutils/usrsock_rpmsg: Change to pass the flags to the psock interface
Pass the sendto/recvfrom flags argument to the psock interface.
2020-08-06 20:52:09 +09:00
Masayuki Ishikawa
cb9eb7cfd7 netutils: webserver: Replace license header with Apache License 2.0
Summary:
- This commit replaces license header in httpd_dirlist.c

Impact:
- No impact

Testing:
- Buid check only
2020-07-29 01:05:31 -05:00
Masayuki Ishikawa
caaf343bad netutils: webserver: Fix style violations
Summary:
- This commit fixes style violations in httpd_dirlist.c

Impact:
- No impact

Testing:
- Buid check only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>>
2020-07-29 01:05:31 -05:00
Maciej Wójcik
21049ece6e Rewritten READMEs to Markdown 2020-07-25 01:01:51 -07:00
Maciej Wójcik
51e6645f71 Rename README and README.txt to README.md 2020-07-25 01:01:51 -07:00
Masayuki Ishikawa
63068ce602 netutils: netclient: Introduce CONFIG_NETUTILS_NTPCLIENT_WITH_AUTH
NOTE: currently, no authentication-related code is implemented.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-18 04:44:38 -05:00
Xiang Xiao
317f0159a4 telnetd: Fix the buffer overflow
Should only memset ipv6 part of socket address(exclude famliy and port field)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-12 14:11:54 +01:00
Xiang Xiao
deaa6c5b7b build: Replace $(TOPDIR)/Make.defs with $(APPDIR)/Make.defs
and move NUTTXLIB defintion to the common place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-09 15:17:37 -03:00
chao.an
24407f16f5 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: I143477d8884dd44913c5685028ee62854e4c11ac
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-29 21:07:04 -05:00
Peter van der Perk
839b3530d4 netlib: add AF_CAN family and CONFIG_NET_CAN support 2020-06-15 07:23:37 -06:00
YAMAMOTO Takashi
faba0249c1 Include malloc.h instead of stdlib.h for mallinfo()
Adapt to the change in the main repo.

mallinfo is meant to be API compatible with Linux,
where it's provided by malloc.h.

(I think the API actually originated with System V. I don't
remember how it was there though. Anyway, I guess the
compatibility with Linux is more important than System V
these days.)
2020-06-15 07:21:52 -06:00
YAMAMOTO Takashi
83324b68f9 webclient: Fix errno in case of recv failure
When recv() failed, the current code assumes the return value
of recv() is a negative errno. It's wrong. Actually the return value
in case of error is -1. The wrong assumption ends up with reporting
EPERM, as EPERM happens to be -(-1).

This commit changes the code to leave the errno set by the failed
recv() as it is. It should be fine as wget_base() has the same
error returning convention as recv(). That is, return -1 (ERROR)
and set errno in the case of failure.

NOTE: the close() after the errout label can also fail and overwrite
the errno. I don't feel it's a big problem as wget_base() doesn't have
any promise about which error should be reported.
2020-06-12 05:22:45 -07:00
YAMAMOTO Takashi
a49f951c86 netlib_parsehttpurl: Fix pathlen check 2020-05-28 19:59:03 +08:00
YAMAMOTO Takashi
585d63b30d netlib_parseurl: Fix pathlen check 2020-05-28 19:59:03 +08:00
YAMAMOTO Takashi
a455f13ec1 webclient: Check the return value of netlib_parseurl correctly 2020-05-28 19:58:53 +08:00
YAMAMOTO Takashi
415010b7fd webclient: include string.h for strlen
Instead of relying on indirect namespace pollutions.
2020-05-28 11:15:18 +02:00
YAMAMOTO Takashi
276bf42e0d webclient: Fix http -> https redirection
http -> https redirection is rather common. The old code was
just broken in that case.

Also, this commit is a step towards https support.

* Switch to netlib_parseurl
* Fix error propagation in wget_parseheaders
* Bail out on a redirect to a URL with unsupported scheme
2020-05-26 15:38:12 +08:00
YAMAMOTO Takashi
e939e55a50 webclient.c: Limit the number of redirections 2020-05-25 23:54:38 +08:00
YAMAMOTO Takashi
6b00c37a65 dhcpc.c: Fix an nxstyle complaint 2020-05-25 23:53:29 +08:00
YAMAMOTO Takashi
1cb82e58ac dhcpc: Don't use an uninitialized variable 2020-05-25 23:53:29 +08:00
Xiang Xiao
69f013e74e build: Remve the unnecessary .gitignore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-23 15:56:35 +01:00
Xiang Xiao
3f933d073c netuitls/thttpd: Add $(APPDIR)/netutils/thttpd into search path
to fix config.h can't be found

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-22 12:25:09 +01:00
Masayuki Ishikawa
34305351c4 netutils: ftpd: Fix style violations in ftpd.c
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-22 16:53:37 +08:00
Masayuki Ishikawa
e6196d2c9c netutils: ftpd: Fix EPSV mode in ftpd.c (IPv4 only)
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-22 16:53:37 +08:00
Xiang Xiao
ea135b89c6 build: Replace all -I to INCDIR
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-21 17:43:42 +01:00
Xiang Xiao
ead498a788 build: Remove the workaround for the inexistence of .config/Make.defs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-21 17:43:42 +01:00
Xiang Xiao
6a26547dec build: Move INCDIROPT to common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-18 15:37:24 -06:00
Xiang Xiao
3b98acc87c netutils/dhcpd: correct the option header check
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-14 07:51:55 -06:00
Xiang Xiao
ed3ac15526 netutils/dhcpd: Fix the minor typo error
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-14 07:51:55 -06:00
chao.an
7a9eea5aba netutils/dhcpd: fix nxstyle warning
Change-Id: I92c4c9426629c728c70b3f6bb047f218816580a2
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-09 13:31:15 -06:00
chao.an
018c9420ac netutils/dhcpd: cancelable dhcp daemon
Change-Id: Iea3c0b8f91b0d6d8ececcd3932d8756a9d021608
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-09 13:31:15 -06:00
Gregory Nutt
b2d8c501f6 Remove use of set_errno() from application code.
The normal assignment errno = errcode should work fine now.
2020-05-07 22:23:19 +01:00
Gregory Nutt
779635afa6 netutils/usrsock_rpmsg: Fix build failures
Not all files were correctly modified when usrsock_rpmsg was moved from apps/system to apps/netutils.  Changes were overlooked in the Makefile and Make.defs file.
2020-05-07 03:00:27 +01:00
Xiang Xiao
4389885cf6 Move usrsock_rpmsg from system to netutils folder
This is a more suitable location

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-06 08:59:53 -06:00
Xiang Xiao
7a99d62ca1 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaox
iang@xiaomi.com>
2020-05-06 07:31:10 -06:00
Xiang Xiao
8a1f5ee34c debug: Reduce CONFIG_CPP_HAVE_VARARGS usage
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-06 07:31:10 -06:00
Xiang Xiao
e72608e0d8 Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-02 09:45:44 -06:00
Gregory Nutt
7b2e06b674 Fix errors from DEFAULT_TASK_SIZE change
There were several places where default sector and buffer sizes of 2048 were changed to DEFAULT_TASK_STACKSIZE.  This is not correct.  This was noted by Xiao Xiang.
2020-04-25 16:13:28 -03:00
Juha Niskanen
2aabd1c9a7 webclient: run through nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-23 09:29:36 -06:00
Juha Niskanen
f8f16975a9 webclient: use getaddrinfo to get IPv4 addresses on dual stack systems
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-23 09:29:36 -06:00
Alan C. Assis
6e403fc343 Fix remaining issues with nxstyle 2020-04-16 20:39:47 -06:00
Alan C. Assis
d10eb2ae3a Fix nxstyle issue for Juha patch 2020-04-16 20:39:47 -06:00
Gregory Nutt
3e73991857 nxstyle fixes for PR 170 2020-04-11 20:32:53 +01:00
Gregory Nutt
05f2253a33 Remove CONFIG_CAN_PASS_STRUCT
This is the companion to PR #766.  It removes the CONFIG_CAN_PASS_STRUCT option as recommended by Issue #620

NuttX PR #766 depends on PR being in place but not vice versa.  This PR should be merge-able without #766 and then PR #766 should also pass its checks.
2020-04-11 20:32:53 +01:00
Xiang Xiao
95efbf7e62 netlib: fix nxstyle issue for netlink related code
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 09:22:08 -06:00
Xiang Xiao
63157f3a4d nshlib: use rtgenmsg for netlib_get_arptable/netlib_get_nbtable lik Linux
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0b28eea6a70d0b5f6c5beef26f6624edfb3d6c86
2020-04-10 09:22:08 -06:00
Xiang Xiao
300bc2729a netlib: correct netlink usage to follow Linux convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iae98b0a008dc42dddb77f47d79511ae4fb4bbfca
2020-04-10 09:22:08 -06:00
Xiang Xiao
f5ea28e9ad netlib: Remove AF_FAMILY and PF_FAMILY definition
use the common one(NETLIB_SOCK_FAMILY)

Change-Id: Ifc255f82f169d3bb37604c49006361a40c9933d1
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-09 07:36:19 -06:00
chao.an
c6b678fa60 netutils/dhcpc: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-04-03 18:11:27 -06:00
chao.an
70bb13ce3b netutils/dhcpc: configurable timeout and retry count.
Change-Id: I92e77bd24ddd7ffff39de9215f4b7c05a7b55bee
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-04-03 18:11:27 -06:00
chao.an
6ab29d4ffb wapi: skip associate if ssid is invalid
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-04-03 13:29:19 +01:00
archer
52abe148ce
netutils/base64: correct the buffer type 2020-04-03 11:16:12 +01:00
Xiang Xiao
595c72b38e
ping/ping6: Support the dual stack host correctly 2020-03-31 22:18:26 +01:00
YAMAMOTO Takashi
c9c1d2bbc6 Change the default of stack size configs to DEFAULT_TASK_STACKSIZE
Where:
 * Under examples and testing
 * And the default value is less than 2048

Using a bit more memory for examples and tests should not
be a critical problem.
2020-03-27 02:43:11 -05:00
YAMAMOTO Takashi
e7156be066 Change the defaults of stack size configs to DEFAULT_TASK_STACKSIZE
This commit changes only ones with the default 2048 and
leaves the others.
E.g. this leaves SYSTEM_RAMTEST_STACKSIZE, whose default is 1024.
I guess those need to be inspected one-by-one.
2020-03-27 02:43:11 -05:00
Xiang Xiao
1511403fdf Revert "Don't generate .depend anymore"
This reverts commit cc5ad09caa.
2020-03-22 23:09:40 -05:00
Xiang Xiao
cc5ad09caa
Don't generate .depend anymore 2020-03-22 18:15:21 +00:00
Xiang Xiao
d96bc5a4fb netinit: Unregister notification at the end in netinit_monitor 2020-03-07 13:13:55 -06:00
Xiang Xiao
127fe118b9 telnet: Fix compile error by commit 39bf19d 2020-02-28 08:08:37 -06:00
Xiang Xiao
39bf19d1f4 Fix some wrong state handler in _negotiate
Also run file through nxstyle and correct coding standard issues.
2020-02-27 13:14:32 -06:00
chao.an
52ad01f0bf netutils: save wapi config to file system
save and reload the wapi config from file system
2020-02-26 16:11:46 +00:00
chao.an
ee615f0568 net/wapi: remove unnecessary cast 2020-02-26 16:11:39 +00:00
Xiang Xiao
41d88f06e7 Run codespell -w with the latest dictonary again 2020-02-23 07:10:14 -06:00
Xiang Xiao
d660492289 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:41:36 -06:00
chao.an
f28eca9dbc Make.defs: Use complete include path 2020-02-19 12:56:10 -06:00
Xiang Xiao
d81b7af407 ntpclient: Use sem protect global variable instead sched_lock/unlock 2020-02-14 09:08:31 -06:00
Xiang Xiao
02a800c930 ntpclient: Initialize g_ntpc_daemon at the definition
Change-Id: I4dad2e246aca7d30092cf8a4bc8136e90668f134
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-14 09:01:57 -06:00
Xiang Xiao
782953ff05 ntpclient: the 2nd arg of MKLVM should be version number
Change-Id: I742c3a5082f48fcc8e291100ff81c60093bc7538
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-14 09:01:57 -06:00
Gregory Nutt
c8dbd59e9a netutils/telnetd/telnetd_daemon.c: Avoid a warning if CONFIG_NET_SOCKOPTS=n 2020-02-09 00:33:39 +08:00
Gregory Nutt
d2522e2821 apps/netutils/telnetd: Fix undefined reference to setsockopt.
Recent change from Xiao Xiang enabled the SO_REUSEADDR socket option unconditionally.  This, of course, causes link time failures if socket options are not enabled:

apps/netutils/telnetd/telnetd_daemon.c:182: undefined reference to 'setsockopt'.

Observed during build testing with configuration rddrone-uavcan144:nsh
2020-02-09 00:33:39 +08:00
Miguel Herranz
960a92c652 Make SO_REUSEADDR not mandatory in netlib
This functionality is not available in NuttX so far.
2020-02-06 23:43:37 +01:00
Xiang Xiao
bf3e6e2367 Improvements for telnet server
Author: Xiang Xiao <xiaoxiang@xiaomi.com>

    Check POLLHUP and POLLERR in telnet poll loop

      to handle the remote end close correctly

    Send "NVT"(network virtual terminal) as the default if getenv("TERM") return NULL

      telnet should trigger the error handling if inet_pton return zero
      since zero mean the string has format error

    Don't return 1 in _environ_telnet to avoid trigger the compression
    and remove the redundant TELNET_TELOPT_COMPRESS2 check

    Change telnet_error_u to telnet_error_e required by the coding standard

    Ensure telnet object get freed before the abnormal exit
2020-02-04 19:09:22 -03:00
Xiang Xiao
e0adf5ee0b Remove all CONFIG_NET_HAVE_REUSEADDR guard 2020-02-03 15:13:19 -06:00
Gregory Nutt
724a34bd3b Run all files modified by pr45 through nxstyle. 2020-02-03 07:38:57 -06:00
Xiang Xiao
72bbc27b0f Free daemon struct in all telnetd_daemon error path
Change-Id: I7f014dc5f327a6ae6adf9cdbea8089ffab2efe37
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-03 07:17:22 -06:00
Xiang Xiao
d6e450e39a Skip to close acceptsd since it is already closed in SIOCTELNET handler
Change-Id: I669224fd5cd44162bb67c8316b56348f7f298883
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-03 07:17:22 -06:00
Xiang Xiao
579327a972 Remove CONFIG_NET_HAVE_REUSEADDR check from telnetd_daemon
since this option doesn't exist at all

Change-Id: I9ee8e61d0a8af1c9eb690b2f2945a7f7f7b5f834
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-03 07:17:22 -06:00
Xiang Xiao
28891ef27e Remove the global variable in telnetd_daemon
Change-Id: I264d10c0f141109ada6ac90afb2ba3e8cfad4404
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-03 07:17:22 -06:00
Xiang Xiao
1154735ca6 Refine the preprocess conditional guard style 2020-01-31 11:04:10 -06:00
Xiang Xiao
e0dcfa0c55 Remove extra whitespace from files (#43)
* Remove multiple newlines at the end of file
* Remove the white space from the end of line
2020-01-31 08:29:24 -06:00
Alin Jerpelea
59b763add4 netutils/netlib: Fix buffer overflow 2020-01-29 00:29:30 -08:00
Ouss4
eb1af03259 examples/sendmail: Few fixes to make the example run on a local SMTP
server.
2020-01-25 16:39:21 -06:00
Gregory Nutt
72a934c6c2 Add configuration settings for apps/examples/sendmail.
The sendmail example hasn't been used in years.  I am not sure it was ever debugged.  It is so old that it still expects hand editted .config files.  As a result, all of the configuration settings were missing from the Kconfig file.

This commit adds the missing apps/examples/sendmail configuration settings so that the example at least builds.  I cannot test it because I have no smtp server that I am willing to spam.

This configuration also adds missing configuration dependencies and runs the C files in apps/examples/sendmail and apps/netutils/smtp through nxstyle.

This commit resolves an issue reported by surya prakash rased in the Google group:  https://groups.google.com/forum/#!topic/nuttx/idr-M164Y24
2020-01-24 19:07:54 -03:00
Xiang Xiao
fd3775e068 Remove CONFIG_TIME_EXTENDED conditioning
Remove CONFIG_TIME_EXTENDED related stuff since kernel remove this option
2020-01-23 08:36:03 -06:00
Xiang Xiao
db61c92100 Fix dhcpd #17
apps/netutils/dhcpd/dhcpd.c:  Fix unused const variable

dhcpd.c:273:29: warning: 'g_anyipaddr' defined but not used [-Wunused-const-variable=]
 static const uint8_t        g_anyipaddr[4] = {0, 0, 0, 0};

apps/netutils/dhcpd:  Make dhcpd interface configurable

apps/netutils/dhcpd:  Lease address directly if hit in address range

apps/netutils/netinit: Initialize dhcpc_state

update the addresses only on request success
2020-01-16 12:06:25 -06:00
Gregory Nutt
b2cd439b10 Remove unselectable CONFIG_NET_TCP_READHEAD dependencies.
NuttX commit 346336bb9e5c9199b82e34d08bf23dd1bc389460 make CONFIG_NET_TCP_READADHEAD unselectable and removed all references to CONFIG_NET_TCP_READHEAD from the the NuttX repositories.  However, there was no corresponding removal of CONFIG_NET_TCP_READHEAD from the apps/ repository.  As a result, there was logic that depended on the selection of CONFIG_NET_TCP_READHEAD that could never be enabled.

This was found during build testing using the configuration olimex-lpc1766stk/thttpd-binfs.  THTTPD was not being build fully because it had dependencies on CONFIG_NET_TCP_READHEAD.  There resulted int numerous new warnings and, finally, the error:

(.../apps.examples.thttpd.o): in function `thttp_main':
thttpd_main.c:(.text+0x104): undefined reference to `thttpd_main'
2020-01-15 11:16:17 -03:00
Xiang Xiao
53efd71d6d Fix format warn (#13)
* fix warning: format '%u' expects argument of type 'unsigned int *', but argument 3 has type 'uint16_t *

Change-Id: I3eccf8e2cd917f19b7a9edab233b327297d74bb7
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>

* fix warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'int'

Change-Id: Ic59a1e9e49256637fa73459c46b8cded036cf971
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-14 03:21:13 +01:00
Gregory Nutt
561fc02ae5 netutils/ftpd/ftpd.c: Fix an error introduced in PR10. In error clean-up, it was trying to free memory on an error where we failed allocated memory. Not good. 2020-01-12 11:55:16 +00:00
Gregory Nutt
e67850971d apps/netutils/ftpd/ftpd.c: Fixes several problems:
1. This fixes the issue reported in Bitbucket apps/ Issue 15.  That is, if fopen() fails, the NULL stream handle would be used in subsequent logic.  The handling of the failure was incomplete.
2. Some of the error handling was fixed.  In the event of an error, it was return return an error value ONLY if we failure to report the error and even then the wrong error would be reported.  This change now preserves and returns the correct error number that is the root cause of the failure.
3. Ran the file through tools/nxstyle and cleaned up many formatting problems.
2020-01-11 22:22:46 -03:00
Xiang Xiao
857158451b Unify the void cast usage
1.Remove void cast for function because many place ignore the returned value witout cast
2.Replace void cast for variable with UNUSED macro

Change-Id: Ie644129a563244a6397036789c4c3ea83c4e9b09
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-02 23:21:01 +08:00
Gregory Nutt
9b77f80740 apps/netutils/dhcpd/dhcpd.c: Correct backward conditional logic in dhcpd_leaseexpired(). Noted by surya prakash <suryaec1684@gmail.com>. 2019-12-19 07:35:52 -06:00
Xiang Xiao
3a2bd2c05f apps/netutils/ntpclient/ntpclient.c: Merge local structure variables xmit and recv into pkt to save the stack. 2019-12-18 09:39:57 -06:00
Gregory Nutt
3da8091d30 Include nuttx/symtab.h instead of nuttx/binfmt/symtab.h since symtab.h under binfmt folder is for internal use. 2019-12-10 08:39:22 -06:00
Xiang Xiao
0218a2fcc7 Fix compiler warnings:
tftpc_get.c: In function 'tftp_write': tftpc_get.c:307:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   int fd = (int)ctx;
            ^
tftpc_get.c: In function 'tftpget': tftpc_get.c:368:57: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   result = tftpget_cb(remote, addr, binary, tftp_write, (void*)fd);
                                                         ^
2019-12-05 07:14:29 -06:00
Xiang Xiao
3bf17d602e apps/netutils/ftpc: ix the compiler warnings:
ftpc_transfer.c:652:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)arg1;
                                        ^
ftpc_getreply.c: In function 'fptc_getreply': ftpc_getreply.c:218:58:
warning: passing argument 3 of 'wd_start' from incompatible pointer type [-Wincompatible-pointer-types]
       ret = wd_start(session->wdog, session->replytimeo, ftpc_timeout, 1, session);
                                                          ^~~~~~~~~~~~
 In file included from
/workspace/mirtos/out/sim/miai/mirtos/nuttx/include/nuttx/sched.h:56:0,
                 from /workspace/mirtos/out/sim/miai/mirtos/nuttx/include/sched.h:49,
                 from /workspace/mirtos/out/sim/miai/mirtos/nuttx/include/stdio.h:48,
                 from ftpc_internal.h:48,
                 from ftpc_getreply.c:46: /workspace/mirtos/out/sim/miai/mirtos/nuttx/include/nuttx/wdog.h:247:5: note: expected 'wdentry_t {aka void
(*)(int, long long unsigned int)}' but argument is of type 'void (*)(int, uint32_t) {aka void (*)(int, unsigned int)}'
 int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...);
     ^~~~~~~~
2019-12-05 07:11:47 -06:00
liuhuahang
ee53a90fa5 apps/netutils/ntpclient/Kconfig: NTP client should depend on NET_SOCKOPTS. 2019-12-05 07:09:27 -06:00
Gregory Nutt
1859f56380 apps/netutils/netinit, apps/netutils/netlib/, and apps/include/netutils/netlib.h: Extend a few definitions to permit building netutils and netinit with only Netlink sockets enabled. 2019-11-19 09:49:36 -06:00
Gregory Nutt
370bd94a6b netutils/netlib/netlib_getdevs.c: Add comments and a placeholder for the RTM_NEWROUTE response. 2019-11-12 10:37:40 -06:00
Gregory Nutt
449290c8da apps/examples/netlink_route: Add test/example of NETLINK_ROUTE 'get' opeations. apps/netutils/netlib: Fixes to NETLINK_ROUTE helpers found by testing with apps/examples/netlink_route. 2019-11-11 13:40:57 -06:00
Gregory Nutt
438777cd38 netutils/netlib/netlib_getroute.c: Add function to retrieve routing tables using netlink. 2019-11-10 12:36:34 -06:00
Gregory Nutt
e260ea779c apps/netutils/netlib/netlib_getnbtab.c: Add a utility function that will return a list of all network devices in the UP state. 2019-11-09 17:38:02 -06:00
Gregory Nutt
2507cc15e8 netutils/netlib/netlib_getnbtab.c: Add support for retrieving a snapshot of the IPv6 neighbor table using Netlink sockets. 2019-11-08 11:30:32 -06:00
Gregory Nutt
f4f1ddccd7 netutils/netlib/netlib_getarptab.c: Per an old Linux Journal article, the nl_pid fild of struct sockaddr_nl should be set to the PID of the task that created the Netlink socket. Also fixes a warning. 2019-11-07 14:08:03 -06:00
Gregory Nutt
de9101a1d9 apps/netutils/netlib/netlib_getarptab.c: Fix typos in comments. 2019-11-04 12:31:13 -06:00
Gregory Nutt
af6719d78d netutils/netlib/netlib_getarptab.c: Do not initialize response buffer, it is write-only. Also add a check to assue that the sequence number in the response is the same as the sequence number in the request. 2019-11-04 09:04:17 -06:00
Gregory Nutt
b65c3dac0e netutils/netlib/netlib_getarptab.c: Misc fixes from initial testing with the 'arp -t' commeand. 2019-11-03 19:29:20 -06:00
Gregory Nutt
400995dec6 nshlib/nsh_netcmds.c: Add a -t option to the arp command which will enable printing the entire ARP table. 2019-11-03 16:19:14 -06:00
Gregory Nutt
768218ee81 netutils/netlib/netlib_getarptab.c: Add a function to read the entire ARP tableusing NETLINK_ROUTE protocol. 2019-11-03 15:13:47 -06:00
Xiang Xiao
403b4a0178 In all Make.defs files, append CONFIGURED_APPS with the consistent ifeq/ifneq. 2019-10-17 11:42:49 -06:00
Xiang Xiao
7808eb62d2 apps/: In all Make.def files, append to CONFIGURED_APPS patch with the absolute path. 2019-10-17 11:33:59 -06:00
Gregory Nutt
3a23523147 Makefiles: This reverts part of commit cf0365ea9. It restores 'conditional' inclusion of TOPDIR/Make.defs. Otherwise all make targets fail if the board has not been configured. That is okay most of the time, but not for things like clean and distclean which should not depend on being configured. 2019-10-15 09:25:48 +08:00
Xiang Xiao
92e7b1f400 apps/: In Makefiles remove 'INCDIROPT = -w' which is already defined in apps/Make.defs. 2019-10-07 02:53:47 -06:00
Xiang Xiao
e806097c70 Application.mk and main.c files: Change builtin's entry point from main to xxx_main by macro expansion. This change make the entry point fully compliant with POSIX/ANSI standard. 2019-10-06 06:14:56 -06:00
raiden00pl
ab7c5a7d4e Merged in raiden00/apps (pull request #200)
Some improvements to netutils/cjson and testing/unity

* netutils/cjson/Makefile: fix the error when creating Make.dep

* testing/unity/Makefile: fix the error when creating Make.dep

* include/.gitignore: ignore cJSON headers

* netutils/cjson/Kconfig: update default version to 1.7.12. Previous releases raise compilation warnings about redefined true/false

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-10-06 11:55:23 +00:00
Xiang Xiao
e829f047bc apps/; Change space to tab and help to ---help--- in Kconfig files. 2019-10-05 21:37:19 -06:00
Xiang Xiao
cf0365ea92 Clean up Makefile under apps folder no functional changes. 2019-10-04 08:35:46 -06:00
Xiang Xiao
e73ca15c99 Makefiles: Change ${shell pwd} to $(CURDIR) since pwd doesn't exist on Windows 2019-10-02 07:06:50 -06:00
Nathan Hartman
664e8a1410 Fix minor typos in docs and comments. 2019-09-29 12:53:39 -06:00
Xiang Xiao
70e7fafaed Revert netutils/netlib: correct ICMPv6 socket create error. This reverts commit 0bcd3b76280ad100b2d0f7d813fa6d970f54b4f4. 2019-09-20 12:47:04 -06:00
ligd
2c34489e81 netutils/netlib/netlib_autoconfig.c: Correct ICMPv6 socket create error. 2019-09-15 08:40:05 -06:00
Nathan Hartman
b2a3ba57ff Fix typos 2019-09-11 08:59:08 -06:00
Masayuki Ishikawa
811086ff85 Merged in masayuki2009/nuttx.apps/dhcpc_host_name (pull request #197)
netutils/dhcpc: Add host name support to dhcp client

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-14 11:29:18 +00:00
Nathan Hartman
d6a3beadfb Remove 'executable' bit on several files 2019-08-01 14:19:02 -06:00
Gregory Nutt
9e1cda95fb Cosmetic fixes to spacing. 2019-07-27 08:49:34 -06:00
Nathan Hartman
4fd1058200 apps/netutils/netinit/netinit.c: Improve cleanup, removing 1 of 2 warnings. Unhook PHY notification signal handler when cleaning up, if an error occurs after the signal handler is put into place. 2019-07-26 10:59:28 -06:00
Anthony Merlino
87098590b5 Merged in antmerlino/apps/dhcpd-arp-fix (pull request #187)
netutils/dhcpd: Fixes bug where hwaddr was being used instead of ipaddr in the ARP update.

This bug seems to have been introduced 3 years ago during a rewrite to remove a direct OS call to arp. I'm not sure how others have not run into issues with this. The behavior I was observing was that the DHCPD would go to offer an IP address, but then send a ARP request for the IP instead because it didn't know where to send the data.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-26 01:52:57 +00:00
Nathan Hartman
44a8d7c80e netutils/netinit/Kconfig: Fix some typos. 2019-07-23 16:09:31 -06:00
Gregory Nutt
8f0b299e82 Trivially cosmetic 2019-07-11 12:15:08 -06:00
Masayuki Ishikawa
89d820e7d4 Merged in masayuki2009/nuttx.apps/fix_httpd_dirlist (pull request #184)
neutils/webserver: Fix file corruption in httpd_dirlist.c

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-10 11:33:13 +00:00
Michael Jung
bf066f11e7 apps/netutils/cjson/Kconfig: stdio floating point support required. cJSON requires floating point support in printf (specifically the 'g' conversion specifier). Thus, select LIBC_FLOATINGPOINT when NETUTILS_CJSON is selected. 2019-07-07 11:33:44 -06:00
Masayuki Ishikawa
9eff955556 Merged in masayuki2009/nuttx.apps/fix_webserver_with_period (pull request #183)
netutils/webserver: Fix directory listing containing period in name

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-06 13:05:45 +00:00
Masayuki Ishikawa
2bb4834775 Merged in masayuki2009/nuttx.apps/add_webserver_info (pull request #182)
netutils/webserver: Add web server info based on uname()

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-05 11:42:54 +00:00
Gregory Nutt
39ad02f72e netutils/webserver: Fix a few complaints from nutts/tools/nxstyle. 2019-07-04 21:21:26 -06:00
Masayuki Ishikawa
0b352178c1 Merged in masayuki2009/nuttx.apps/add_dirlist_to_webserver (pull request #181)
netutils/webserver: Add directory listing to httpd

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-05 02:58:53 +00:00
Masayuki Ishikawa
c1317331d3 Merged in masayuki2009/nuttx.apps/mp3_on_webserver (pull request #180)
netutils/webserver: Add mp3 mime type to httpd.c

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-04 11:28:29 +00:00
Masayuki Ishikawa
b12b61df69 Merged in masayuki2009/nuttx.apps/fix_webserver (pull request #179)
apps/examples/webserver: Fix to compile with CONFIG_NETUTILS_HTTPD_SENDFILE=y

Also, in this PR, some configs such as CONFIG_NETUTILS_HTTPDFILESTATS
can be selected by menuconfig.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-03 12:20:29 +00:00
Gregory Nutt
bd14bf7165 apps/netutils/json: Removed. Replaced with apps/netutils/cjson. 2019-06-03 19:17:25 -06:00
Gregory Nutt
87c1083357 apps/netutils/netinit: MAC address configuration was represented by type long long. That is a problem for architectures that do not support typle long long. Replaces by two long configuration items. 2019-06-03 10:04:44 -06:00
Gregory Nutt
63de16bd58 netutils/telnetd/telnetd_daemon.c: Fix another C89 violation that caused the ez80 build to fail. 2019-06-03 09:07:07 -06:00
Gregory Nutt
dd35a7cacc apps/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled. 2019-05-21 19:08:12 -06:00
Sebastien Lorquet
fc7aa92b57 apps/netutils/libcurl4nx: This is an initial comit libcurl4nx. It is not complete yet, but I still wish to commit the unfinished bits to describe the roadmap, and because it is already usable. It will be updated and fixed in the future weeks and months, certainly including POST support and later, SSL.
Some improvements could be made by anyone.  For example, I know the main routine in perform() shall be split into several parts for readability. I apologize in advance for this kind of spaghetti code, but I was short on time to refactor it.  Also chunked HTTP transfer encoding would be a nice contribution from anyone interested. It is detected but not yet supported.
2019-05-03 07:26:13 -06:00
Gregory Nutt
8f5944c4a8 Squashed commit of the following:
include/ and netutils/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    nshlib/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    system/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    testing/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    examples/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
2019-04-29 14:53:38 -06:00
Gregory Nutt
ad57b3de4d apps/graphics/twm4nx: Add options to initialize the system via boardctl() and to bring up the network using the new apps/netutils/netinit. This latter is only necessary because VNC is being used to provide graphics. 2019-04-29 11:49:15 -06:00
Gregory Nutt
94a0d92b54 This commit removes the private network initialization logic from NSH and puts in a common location at apps/netutils/netinit. Now that netork initialization logic can be used by applications that do not include NSH.
Squashed commit of the following:

    apps/nshlib:  Remove NSH initialization.  Now uses the common apps/netutils/netinit logic (which was cloned from nshlib to begin with).

    apps/netutils/netinit:  Clone network initialization logic from NSH to this directory so that it can be available for general use.
2019-04-29 10:22:56 -06:00
Gregory Nutt
07b6eb555c Trivial changes from review of last PR 2019-04-28 06:47:03 -06:00
raiden00pl
75aca388a4 Merged in raiden00/apps/cjson (pull request #175)
netutils: support for the current version of cJSON

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-04-28 12:34:20 +00:00
Sebastien Lorquet
fe0954cd62 netutils/netlib/netlib_parseurl.c: Add a more flexible version of netlib_parsehttpurl. This one can parse any URL, and is extensible so future improvements keep the same API. 2019-04-26 13:08:38 -06:00
Alan Carvalho de Assis
5492fcdafa apps//netutils/webclient/Kconfig: NET_SOCKOPTS is needed to get webclient compiled. 2019-02-24 13:55:19 -06:00
Gregory Nutt
b2f46360de apps/: Remove/replace all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0. That value is always greater than zero now. In places just replace with #ifdef CONFIG_NET. 2019-02-11 16:23:55 -06:00
Gregory Nutt
a14f3fbffb apps/netutils/tftpc: Fix unmatched #endif found in build testing 2019-02-11 15:52:37 -06:00
Gregory Nutt
9db029e318 The file system can no longer be disabled. Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS==0 2019-02-11 13:10:10 -06:00
Kevin Liu
721bb64e52 apps/netutils/dhcpc/dhcpc.c: Fix an error for DHCP REQUEST receiving a NAK.In DHCP Request operation, no need to update ciaddr to the client address and keep it as 0. 2019-01-30 07:49:37 -06:00
ligd
557cd8e454 netutils/codecs/base64.c: Add base64_[de|en]code_length() API 2019-01-27 07:20:25 -06:00
Xiang Xiao
4d2f580568 apps/netutils/codecs/base64.c: Remove the big stack array 2019-01-27 07:17:07 -06:00
Alan Carvalho de Assis
25c0387c44 apps/examples/battery: Add Battery Charger Monitor Example 2019-01-04 12:15:05 -06:00
Gregory Nutt
0c615ed586 Fix a few typos. 2018-12-27 08:48:52 -06:00
Gregory Nutt
3adf8af266 netutils/webserver/httpd.c: Eliminate some warnings found in build testing. 2018-11-25 18:43:09 -06:00
Gregory Nutt
e88a529010 From patch attached to nuttx/ Bitbucket Issue #136 from Vlado Vidovic:
The patch provided in issue 135, which adds support for HTTP Chunked Encoding, covers all paths in the webserver app except CGI callbacks. As a result, if a page being served happens to use CGI, it could generate stream content that does not comply with HTTP Chunked Encoding.

The patch attached amends the webserver app's CGI callbacks to use the HTTP Chunked Encoding sender function instead of using send() directly.
2018-11-23 17:29:07 -06:00
Gregory Nutt
d3c36663d0 netutils/webserver: Contributed by "Anonymous" via attachment to Bitbucket issue #135: "webserver broken when scripting support enabled - support for chunked encoding fixes it"
The webserver/httpd app is currently broken when script support is enabled (CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE). The root cause has been tracked down to the "Content-length" not being available ahead of time in this case (length of -1 passed to send_headers() ). On the other hand, the server closing the socket does not result in FIN being sent to the browser either (FIN not supported by NuttX yet).

Simple solution: Add support for HTTP Chunked Encoding to webserver/httpd (attached patch).

The attached patch is simple. It adds a configuration option to enable chunked encoding. When enabled, the implementation will auto-detect the cases where content length is not available ahead of time, and will automatically engage chunked encoding transfers.

Without this patch, the browser/client hangs forever, as it is expecting more data. With this patch, the browser displays the content.
2018-11-23 10:13:34 -06:00
ligd
f954b15cac pps/system/ping and pings and apps/netutils/ping: Extract icmp ping and icmpv6 ping6 logic from system/ to C-callable library in netutils/. 2018-11-08 09:32:05 -06:00