Commit Graph

742 Commits

Author SHA1 Message Date
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