Commit Graph

6044 Commits

Author SHA1 Message Date
Simon Goldschmidt
ea9726056c and another codespell fix 2020-02-15 21:54:24 +01:00
Simon Goldschmidt
1ffcc5079c Fix-more-typos-using-codespell
Committing nearly all changes done by 'codespell_check.sh -w'

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-15 21:45:53 +01:00
jona
d6a6b661d9 Fix typos using codespell
Conservative strategy was used, maybe other typos remain.

Rebased: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-15 21:45:41 +01:00
Simon Goldschmidt
6e7ea92d56 ppp: fix compiling with CCP_SUPPORT=1 but MPPE_SUPPORT=0
Even if that might not make much sense, it still shouldn't
result in compiler warnings.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-15 20:53:47 +01:00
Paul Mackerras
d281d3e959 PPP, EAP: ignore received EAP messages when not doing EAP
This adds some basic checks to the subroutines of eap_input to check
that we have requested or agreed to doing EAP authentication before
doing any processing on the received packet.  The motivation is to
make it harder for a malicious peer to disrupt the operation of pppd
by sending unsolicited EAP packets.  Note that eap_success() already
has a check that the EAP client state is reasonable, and does nothing
(apart from possibly printing a debug message) if not.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Sylvain Rochet <gradator@gradator.net> (ported to lwIP PPP pcb struct)
2020-02-10 23:37:33 +01:00
Paul Mackerras
2ee3cbe69c PPP, EAP: fix bounds check in EAP code
Given that we have just checked vallen < len, it can never be the case
that vallen >= len + sizeof(rhostname).  This fixes the check so we
actually avoid overflowing the rhostname array.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Sylvain Rochet <gradator@gradator.net> (compiler warning fix about int vs uint comparisons)
2020-02-10 23:37:25 +01:00
Simon Goldschmidt
cc6d5b7a29 ppp: fix compiling eap after changing debug functions 2020-02-06 20:51:02 +01:00
Simon Goldschmidt
d843e47a1d icmp6: keep to the RFC and send as much as possible with icmp6 error messages
See bug 56013

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-05 20:43:25 +01:00
Gao Qingshui
a9ac18aebb ip6: enable ip6_autoconfig_enabled by default
See bug #56135

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-04 22:23:58 +01:00
Simon Goldschmidt
064d816ea1 altcp: fix altcp_tcp_close for LISTEN pcb
See bug #55219

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-03 22:13:07 +01:00
Simon Goldschmidt
84228d4f4b nd6: cache neighbour index for each next hop, not globally
See bug #47792

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-03 21:53:22 +01:00
Simon Goldschmidt
dc41eabf5f nd6: check defines for global tables for validity
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-03 21:49:57 +01:00
Simon Goldschmidt
b3046d938e nd6: use a pointer where appropriate to make the code more readable
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-03 21:33:21 +01:00
Simon Goldschmidt
177bb6ca06 nd6: update addr_hint only if the index has actually changed 2020-02-03 20:57:28 +01:00
Simon Goldschmidt
4c15191b1d snmp: update documentation 2020-02-03 20:35:22 +01:00
Simon Goldschmidt
5de4967f23 ip4: forward: try to fix the build...
... by adding a default case
2020-01-30 23:22:00 +01:00
Simon Goldschmidt
38894637e7 ip4: forward: remove invalid const modifiers
This should fix the build...
2020-01-30 23:13:07 +01:00
Simon Goldschmidt
61c67fc229 ip_forward: fix IPv4 forwarding with multiple netifs/offloading
When we have multiple netifs where at least one has checksum offloading
capabilities, IP forwarding needs to set various checksum fields to 0
to prevent HW algorithms on calculating an invalid checksum.

-> set checksum fields of IP/UDP/TCP/ICMP to 0 in ip4_forward().

See bug #56288

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-30 23:02:16 +01:00
Simon Goldschmidt
695c323164 icmp: add a dedicated struct for the standard ICMP header
This is just to keep the code clean and prevent using the "echo" header
where any ICMP header is meant.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-30 22:50:25 +01:00
Simon Goldschmidt
75b2db4438 makefsdata: error files must start with "<errnr>." to match HTTP status
This is to prevent files like "4001.jpg" getting HTTP status 400 instead
of 100.

See bug #56290.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-30 21:22:36 +01:00
Simon Goldschmidt
0f5bf0aa37 httpd: error files must start with "<errnr>." to match HTTP status
This is to prevent files like "4001.jpg" getting HTTP status 400 instead
of 100.

See bug #56290.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-30 21:22:03 +01:00
Patrick Schlangen
8d7e436a9d Fix select_waiting not being decremented for sockets closed while in lwip_select()
See bug #57445. Short version of the description there: lwip_select() failed
to decrement 'select_waiting' of a socket since that code part failed on
'free_pending' sockets. However, the code does not have to check that as it
has marked the socket to be in use itself earlier.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-30 21:04:37 +01:00
Simon Goldschmidt
32a72b1a20 sntp: ensure sntp_retry_timeout reaches the configured limit
See bug #57620

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-30 20:47:19 +01:00
Felix Werner
3b2d7e289a Additional Debug-Print in api_msg.c
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-30 20:43:56 +01:00
Simon Goldschmidt
a4b578b483 pbuf: avoid using multiple PBUF_POOL buffers for IPv6
Use 'PBUF_IP_HLEN+PBUF_TRANSPORT_HLEN' instead of '40' to calculate
PBUF_POOL_BUFSIZE (the size of each PBUF_POOL buffer) since the former
can be 60 when IPv6 is enabled.

See bug #56355

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-30 20:42:15 +01:00
Simon Goldschmidt
d6b5b5222f opt: make LWIP_IPV6_SEND_ROUTER_SOLICIT default to LWIP_IPV6
This ensures struct netif doesn't contain 'rs_count' if LWIP_IPV6
is disabled but LWIP_IPV6_SEND_ROUTER_SOLICIT is at its default.

See bug #56509
2020-01-12 20:34:18 +01:00
Simon Goldschmidt
8a8058a436 netif: add IPV4_ADDR_VALID ext status callback reason
This ext-callback reason is always issued when an IPv4 config
has been set, even if it has not changed (e.g. DHCP reboot)

See bug #55121
2020-01-12 20:30:38 +01:00
Simon Goldschmidt
bb31fbd737 ip6: fix printing rx packet headers
The call to ip6_debug_print needs to be moved before the
next-header parsing code.

See bug #56708
2020-01-10 23:10:49 +01:00
Simon Goldschmidt
bf1285e3c9 ppp: don't link debug functions if disable
This converts all ppp_*() debug functions to ppp_*(()) macros that
ensure the code is left out by the linker if the corresponding debug
setting is disabled.

Downside is that many lines of code are touched, but since these
already differ to upstream PPP sources, I figured that's ok...

See bug #55199

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-01-10 21:42:45 +01:00
Simon Goldschmidt
827b60c155 debug: split debug enable checks from LWIP_DEBUGF to LWIP_DEBUG_ENABLED
In order to reuse the debug-enable checks for PPP debug macros,
move the flag and level checks from LWIP_DEBUGF to a new macro
that can be used elsewhere.
2020-01-10 20:50:25 +01:00
Simon Goldschmidt
b43f081b9a sockets: ioctl: fix _IO macros for 16 bit platforms
See bug #57565
2020-01-10 20:46:23 +01:00
David Girault
5c2887a241 sntp: remove existing timeout before creating new
This prevents sntp using more than 2 timeouts.
See bug #56431
2020-01-10 20:42:17 +01:00
Axel Lin
555812dcec netif_find: correctly check if atoi means '0' or error
Fixes: 4528215c99 ("netif_find: check if atoi means '0' or error")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2019-12-12 09:23:11 +08:00
David Girault
2be031e238 altcp_tls: ensure no memory leaks and entropy counter is protected 2019-12-11 21:22:42 +01:00
David Girault
dc7ba26e69 altcp_tls: use ERR_CLSD only for handshake error
This allow better handling of handshake error in application.
2019-12-11 21:22:42 +01:00
David Girault
316dbc792f altcp_tls: call the application sent() callback with usefull len
First calculate and sum TLS overhead when altcp_mbedtls_write() is called.
Then take care of it when calling application sent callback. Give reveived
len from inner_conn, minus calculated overhead.
2019-12-11 21:22:41 +01:00
David Girault
f97dacd014 altcp_tls: support for saving/restoring session information
According to mbedTLS source code and documentation, calls to
`mbedtls_ssl_conf_session_cache` and `mbedtls_ssl_conf_session_tickets_cb`
are only available if mbedTLS is configured for server mode (ie. MBEDTLS_SSL_SRV_C
is defined). This cannot be used on client mode to resume a previous session.

To allow session reuse in client mode, application must save session parameters
(including tickets provided by the server if any) after successfull connection
and restore them before attemting to reconnect. Since `alctp_close()` free the
structure, it cannot be used to store the required information.

So, two new API were added, directly wrapped to mbedTLS functions, allow application
to do that by itself.

Also added full declaration of `struct altcp_tls_session` in altcp_tls.h to allow
easier usage in application when using mbedTLS port.
2019-12-11 21:22:41 +01:00
David Girault
d84a84e5ca altcp_tls_mbedtls: ensure configuration is properly freed 2019-12-11 21:22:41 +01:00
Simon Goldschmidt
44a3f631b3 inet: added missing IN6_IS_ADDR_* macros 2019-12-11 21:11:55 +01:00
Simon Goldschmidt
a9e73bc412 ip6addr_aton: support scoped address strings (via '%')
See task #15393

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:43:28 +01:00
Simon Goldschmidt
4528215c99 netif_find: check if atoi means '0' or error
Since atoi() returns 0 on error, we need to check if name[2] is '0'.
If it's not, atoi() failed.
2019-12-11 20:42:36 +01:00
Simon Goldschmidt
fbe032d05d mdns: fix clang warning about documentation error 2019-12-11 20:23:14 +01:00
David Girault
4baf17d5b2 mdns: restart probing when IP addresses has changed
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:13:10 +01:00
David Girault
4ca115a08e mdns: move MDNS_PROBE_DELAY_MS to mdns_opts.h to allow customisation
In some noisy WiFi environment, it may be necessary to increase this value to
300ms to accomodate WiFi latencies which may result in less than the required
250ms between two probe frames received by the Apple BCT application.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:13:10 +01:00
David Girault
2441c6fa3f mdns: abort packet analysis if conflict detected
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:13:10 +01:00
David Girault
6302423d7f mdns: handle tiebreaking loose like conflict
- Count tiebreaking loss in num_conflicts to include them in rate limit detection
- Restart probing using mdns_resp_restart allowing rate limiting for those cases

This ensure rate limiting is well activated during Apple Bonjour Conformance Tests.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:13:10 +01:00
David Girault
9301225895 mdns: support for multi-packet known answer (questions with TC bit)
This allow Apple Bonjour Conformance Test to not fail with the following tests:
- DISTRIBUTED DUPLICATE SUPPRESSION
- MULTIPLE QUESTIONS - DISTRIBUTED DUPLICATE SUPPRESSION

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:13:01 +01:00
David Girault
e85e473838 mdns: remove service TXT record from probe packets
TXT records isn't required to be unique in network, so it shouldn't be
included in probe packets.

Additionnaly, when TXT record is present, the Bonjour Conformance Test
from Apple Inc. always fail because generated probe nevert have TXT record.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:12:26 +01:00
David Girault
710b7fc158 mdns: add mdns_resp_restart_delay to allow re-probe delay selection
Called with `MDNS_INITIAL_PROBE_DELAY_MS` or `MDNS_PROBE_DELAY_MS` according to
needs.

When `mdns_resp_restart_delay()` called by `mdns_resp_rename_(netif|service)()`
functions, it is assumed this is because a conflict. So we should not use
`MDNS_INITIAL_PROBE_DELAY_MS` because the Bonjour Conformance Test will
complain like this:

```
START (PROBING)
NOTICE  16:40:09.501911: conflicting probe:
        smarTrEMotE-f8d0a4.Local.
ERROR   16:40:09.607288: Device did not provide a sufficient time gap between receiving a conflicting probe and reprobing.
ERROR   16:40:09.607333: expected_time_gap=237,actual_time_gap=105
```

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:12:04 +01:00
David Girault
cd278c426d mdns: remove duplicate acd_state_enum_t declaration
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:11:13 +01:00
David Girault
aa79b90d3c mdns: update probe conflict function to provide service in conflict
- Send service slot index to the mdns result function. In case of conflict, the user
  will have to remove the service or rename it.
- Break after hostname conflict in order to managed it first, and managed service name
  conflict after.
- Provide a function to get the TXT userdata for a service (allowing app to match with
  its own data).

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:11:13 +01:00
David Girault
a2498898b0 mdns: increase mDNS output packet size
When more than one service (just 2) need to be probed for conflict, generation
of the probe packet fail because pbuf is too small!

So OUTPACKET_SIZE renamed to MDNS_OUTPUT_PACKET_SIZE and moved to mdns_opts.h
to allow configuration. Default configuration raise it to 1450 to have enough
space when MDNS_MAX_SERVICES > 1 else it remain 512.

Extract from RFC 6762, chapter 17, Multicast DNS Message Size:

   The 1987 DNS specification [RFC1035] restricts DNS messages carried
   by UDP to no more than 512 bytes (not counting the IP or UDP
   headers).  For UDP packets carried over the wide-area Internet in
   1987, this was appropriate.  For link-local multicast packets on
   today's networks, there is no reason to retain this restriction.
   Given that the packets are by definition link-local, there are no
   Path MTU issues to consider.

   Multicast DNS messages carried by UDP may be up to the IP MTU of the
   physical interface, less the space required for the IP header (20
   bytes for IPv4; 40 bytes for IPv6) and the UDP header (8 bytes).

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-11 20:11:13 +01:00
Simon Goldschmidt
0caacf82b4 netif_add: zero-init netif->acd_list 2019-12-11 19:49:50 +01:00
Christoffer Lind
f47d2ed5fe sys_arch_mbox_tryfetch not validated correctly
sys_arch_mbox_tryfetch() shall return SYS_MBOX_EMPTY or 0 according
to the documentation. Wherever the function is used the return
value is incorrectly compared to SYS_ARCH_TIMEOUT. For now
SYS_MBOX_EMPTY is defined to SYS_ARCH_TIMEOUT so this is not an
issue as long as SYS_MBOX_EMPTY isn't re-defined.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-10 21:46:47 +01:00
Simon Goldschmidt
af0499131f autoip: fix typo
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-10 21:43:47 +01:00
David Girault
30d445bd39 acd: inform address is good only when going in ongoing state
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-10 21:37:03 +01:00
David Girault
05ffe144dd acd: reset conflict count to ensure fast re-probing after announcing
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-10 21:37:03 +01:00
David Girault
e09add37c1 acd: fix MAX_CONFLICTS check accorting RFC.
As written in RFC5227 in 2.1.1 Probe Details:

   A host implementing this specification MUST take precautions to limit
   the rate at which it probes for new candidate addresses: if the host
   experiences MAX_CONFLICTS or more address conflicts on a given
   interface, then the host MUST limit the rate at which it probes for
   new addresses on this interface to no more than one attempted new
   address per RATE_LIMIT_INTERVAL.

But `acd_restart` restart function check for `acd->num_conflicts > MAX_CONFLICTS`
which allow one more probe than expected.

So this commit change the test to `acd->num_conflicts >= MAX_CONFLICTS`.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-10 21:37:03 +01:00
Georgy Komarov
eaa8f34f6a lowpan6.c: fix unuinitialized variable if LWIP_6LOWPAN_IPHC==0 2019-12-10 21:19:53 +01:00
Simon Goldschmidt
fe25ca66af httpd: makefsdata: fix passing deflate level via commandline
See bug #57187

Reported-by: Anton Chasnyk <anton.chasnyk@gmail.com>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-02 21:13:45 +01:00
Simon Goldschmidt
bef201e162 sockets: fix IS_SOCK_ADDR_ALIGNED() for 16 bit platforms
See bug 57344

Reported-by: Victor Brzeski <VBrzeski@gmail.com>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-12-02 20:53:13 +01:00
Simon Goldschmidt
03998f5147 autoip: fix 'autoip_remove_struct()' after changing storage to 'netif_client_data'
Reported-by: Amena El Homsi <amena.elhomsi@gmail.com>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-11-21 22:19:35 +01:00
Dirk Ziegelmeier
79cd89f99d Fix possible NULL pointer dereference in autoip_start()
autoip variable is dereferenced (autoip->state) before it is checked for NULL pointer
2019-08-28 07:24:31 +02:00
Joan Lledó
7fd158a109 Make socket functions depend on LWIP_SOCKETS
* Socket functions definitions moved out of the
  #define LWIP_SOCKET_EXTERNAL_HEADERS as all users who
  set LWIP_SOCKETS to 1 will need them regardless they use
  lwip's or external socket headers.
2019-08-16 10:59:31 +02:00
Joan Lledó
785b7aba3c Sockets: Unit tests and apps corrections
* Include lwip/inet.h in some unit tests and apps
  * Since they use htons() and pals.
* test/unit/api/test_sockets.c:
  * write() could be declared by external socket headers
    * Call lwip_write() instead.
  * Code expects fcntl() to return 6
    * But O_RDWR could have another value if external
      socket headers are present
    * Replace 6 by O_RDWR.
* apps/tftp/tftp.c:
  * recv() could be declared by external socket headers
    * Rename it to tftp_recv()
2019-08-11 20:12:47 +02:00
Joan Lledó
f92d6702bc Sockets: declare msghdr->msg_iovlen as msg_iovlen_t
* Lwip declares msghdr->msg_iovlen as int, but when
  using external socket headers, some systems declare
  msg_iovlen as size_t or others.
* This patch creates a new type msg_iovlen_t and
  expects users to typedef it to the type they need
  for their system.
2019-08-11 20:12:02 +02:00
Simon Goldschmidt
602a66fe58 sockets: convert _HAVE_SA_LEN to lwip style 2019-08-01 21:04:06 +02:00
Joan Lledó
f126750ccd Add support for struct sockaddr with no sa_len field.
Lwip's struct sockaddr includes sa_len, but some systems
like Linux doesn't have this filed, which produces many
compilation problems when using external headers.

A set of macros has benn added to detect the absence of
sa_len and adapt sockets.c
2019-08-01 20:49:54 +02:00
Simon Goldschmidt
c53a8444e8 dhcp: don't use LWIP_ERROR in dhcp_parse_reply()
See bug #56643

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-07-26 20:43:08 +02:00
Simon Goldschmidt
6b3ed88d9c ALTCP_TLS_MBEDTLS: include mbedtls/net_sockets.h instead of deprecated mbedtls/net.h
See patch #9815

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-07-26 20:29:27 +02:00
Joan Lledó
fa6f8054eb Move LWIP_MARK_TCPIP_THREAD to include/lwip/sys.h
* LWIP_MARK_TCPIP_THREAD moved to include/lwip/sys.h
* Unix port macro definitions moved to sys_arch.h
  * LWIP_MARK_TCPIP_THREAD
  * LOCK_TCPIP_CORE
  * UNLOCK_TCPIP_CORE

(goldsimon@gmx.de: fixed unix Makefile build and win32 build)
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-07-26 20:09:40 +02:00
Freddie Chopin
8291ff3dc0 Fix definition of LWIP_NUM_SYS_TIMEOUT_INTERNAL
In timeouts.c commit 7d1c26cc0c replaced
timeout for AUTOIP with a timeout for ACD, however the value of
LWIP_NUM_SYS_TIMEOUT_INTERNAL was not updated and still counts
LWIP_AUTOIP instead of LWIP_ACD. If user has AUTOIP disabled (or not
explicitly enabled) and DHCP enabled, then ACD gets automatically
enabled too. In this case there will be one timeout too little for lwIP
and first TCP packet received causes an assertion.

Also add LWIP_IPV6_DHCP6 to the value of LWIP_NUM_SYS_TIMEOUT_INTERNAL,
as it was also not accounted for.
2019-07-26 19:44:35 +02:00
Joan Lledó
9dca4a0211 New function tcpip_callback_wait() * Call a function inside the tcpip thread and block the calling thread until the callback finishes.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-07-13 20:52:48 +02:00
Joan Lledó
3546a0a4a0 IF_NAMESIZE: define it only if it's not defined before by system headers 2019-07-13 20:49:48 +02:00
Simon Goldschmidt
5465fdfd69 netconn: add callback arg storage
This reuses the member 'int socket' by making it a union containing
both int and void pointer.

See bug #56593.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
Suggested-by: Wilfred <wilfrednilsen@hotmail.com>
2019-07-13 20:46:36 +02:00
Simon Goldschmidt
f37925dad2 api_lib: fix duplicate NULL check with sys_sem_valid() 2019-07-10 21:55:28 +02:00
Simon Goldschmidt
aa545fbbc6 LWIP_NETCONN_FULLDUPLEX is not alpha any more 2019-07-10 21:14:35 +02:00
Giuseppe Modugno
832490eec8 Added the configuration option ALTCP_MBEDTLS_AUTHMODE to set the certificate verification mode.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-06-11 21:15:45 +02:00
Giuseppe Modugno
edeeef0d20 mqtt: fix ping request coming too late
See bug #56022 and patch #9813

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-06-11 21:13:05 +02:00
Axel Lin
b3a939417e sockets: Get rid of sock_set_errno
The err field is removed from struct lwip_sock since commit e0a2472706
("netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received")
sock_set_errno() simply calls set_errno() now, so use set_errno() instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Dirk Ziegelmeier <dziegelmeier@de.pepperl-fuchs.com>
2019-05-06 19:47:56 +08:00
Dirk Ziegelmeier
0255106d55 Fix bug #56136: The netif->mtu6 was updated by Router Advertisement abnomally
Using patch from Gao Quingahui plus improvement
2019-05-06 12:37:19 +02:00
Our Air Quality
ff17530997 mdns mdns_search_service mdns_search_stop: define the request id as unsigned. 2019-04-30 14:53:58 +02:00
Dirk Ziegelmeier
3d7ff53070 Apply patch for bug #56098: Support for MQTT over TLS port 443 instead of 8883 2019-04-30 13:22:09 +02:00
Dirk Ziegelmeier
295996f912 Apply patch for bug #56239: compile fail when disable TCP 2019-04-30 13:16:30 +02:00
Dirk Ziegelmeier
534d3a794c Minor compile fix for last commit 2019-04-30 13:05:50 +02:00
David Girault
fc8f6e8fd9 mqtt: fix first packet checking which fail if MQTT_VAR_HEADER_BUFFER_LEN > 1516
If client reception buffer is bigger than the first frame we receive, the first packet test
will always fail for the second one if it is shorter the the diffence between reception
buffer size and first frame length.

For example, if we receive a PUBLISH message with length = 1517 (payload len = 1514 +
header len = 3), this result in total message length of 1517.

altcp_tls will send MQTT client frame up to 1516 bytes max. This result to PUBLISH
message splitted in two frame: first is 1516 bytes, the second of 1 bytes.

If MQTT_VAR_HEADER_BUFFER_LEN is 1520 (1516 + 4 bytes for stored fixed header), the
second frame of 1 bytes is considered as first publish frame because
client->msg_idx (1517) < MQTT_VAR_HEADER_BUFFER_LEN (1520).

This result in disconnection AND application callback never called for the end of the
payload.

The fix will check `(client->msg_idx - (fixed_hdr_len + length)) == 0` which can be
only true for the first frame of a message.

Below logs showing the bug:
```
April 3rd 2019, 23:14:05.459    lwip_dbg    mqtt_parse_incoming: Remaining length after fixed header: 1514
April 3rd 2019, 23:14:05.460    lwip_dbg    mqtt_parse_incoming: msg_idx: 1516, cpy_len: 1513, remaining 1
April 3rd 2019, 23:14:05.460    lwip_dbg    mqtt_incomming_publish: Received message with QoS 1 at topic: v2/inte...
April 3rd 2019, 23:14:05.461    lwip_dbg    mqtt_parse_incoming: Remaining length after fixed header: 1514
April 3rd 2019, 23:14:05.461    lwip_dbg    mqtt_parse_incoming: msg_idx: 1517, cpy_len: 1, remaining 0
April 3rd 2019, 23:14:05.461    lwip_dbg    mqtt_message_received: Received short PUBLISH packet
```
2019-04-30 12:57:48 +02:00
David Girault
df0699c143 mqtt: support mostly zero-copy message analysis
also ensure no parts of message are lost because cpy_len != buffer_space!
2019-04-30 12:57:40 +02:00
Our Air Quality
156bb74d17 mdns_resp_add_service: simplify the max services guard. 2019-04-30 12:41:19 +02:00
Our Air Quality
224b884c1e mDNS: output search queries to the IP v4 and v6 groups.
These had been broadcasting to the *_ANY addresses.
2019-04-30 12:38:07 +02:00
Our Air Quality
c156cd2a33 ND6: add an explicit queue size check.
When using the MEMP_MEM_MALLOC option, memp_malloc() can not be relied on to
limit the number of allocations allowed for each MEMP queue, as the ND6 code
had been. This caused the ND6 queue to keep growing until the heap allocation
failed when using the MEMP_MEM_MALLOC option. So add an explicit queue size
check in ND6.
2019-04-30 12:34:43 +02:00
Our Air Quality
46bbfe4ee2 mdns: defined the service slot id as unsigned rather than signed. 2019-04-30 12:33:22 +02:00
Our Air Quality
2229c51704 mdns_search_service: simply the search for a free slot. 2019-04-30 12:29:43 +02:00
Our Air Quality
af5906370f mDNS: change some debug line terminations to just newlines.
Some of there were using carriage-return and newline, yet the
rest of the code base consistently uses only newline.
2019-04-30 12:29:08 +02:00
Freddie Chopin
ec11b289cb Fix and simplify newlines in doxygen documentation
Replace '\n' with '<br>', as this allows doxygen to understand reference
names followed by newline. For some cases just drop the newline if it's
not required.

Doxygen 1.8.15 doesn't like if the name of reference is followed by
anything else than (selected?) punctuation or whitespace.

bug #56004
2019-03-28 08:18:20 +01:00
Freddie Chopin
c594599350 Fix doxygen @ref in altcp.c
Doxygen 1.8.15 doesn't like if the name of reference is followed by
anything else than (selected?) punctuation or whitespace.

bug #56004
2019-03-28 08:18:19 +01:00
Dirk Ziegelmeier
53818ad3e4 Add #define for minimum IPv6 MTU length 2019-03-28 08:16:47 +01:00
Dirk Ziegelmeier
ecd8c5b936 Fix bug #55702: SSI bug
Apply patch from Stanislav
2019-03-24 21:47:56 +01:00
Dirk Ziegelmeier
d0d86b5ba1 Fix compile of last patch 2019-03-24 21:46:43 +01:00
Dirk Ziegelmeier
aa7009b2fc Fix bug #55972: The Neighbour Solicitation used to do IPv6 address resolution was wrong
Apply patch from Gao Qingshui
2019-03-24 21:34:08 +01:00
Dirk Ziegelmeier
4f6fd6c845 Fix bug #55973: The parsing of max response time in MLD Query message was wrong
Apply patch from Gao Qingshui
2019-03-24 21:32:26 +01:00