Commit Graph

6184 Commits

Author SHA1 Message Date
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
Dirk Ziegelmeier
4b10b4dab3 Add note about MEMP_NUM_SYS_TIMEOUT in four apps 2019-03-20 20:50:17 +01:00
Simon Goldschmidt
3b5eb7ca90 udp_bind: fix missing parenthesis warning
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-02-27 10:29:55 +01:00
Simon Goldschmidt
752cdb1a53 udp: fix udp_bind for IPADDR_TYPE_ANY
See bug #55171

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2019-02-26 14:48:44 +01:00
Dirk Ziegelmeier
e479bd56df Fix LWIP_ERROR macro - it should never be fatal (LWIP_ASSERT)
The only difference should be:
- LWIP_DEBUG enabled  -> print a diag message
- LWIP_DEBUG disabled -> NO diag message is printed
2019-02-08 12:29:05 +01:00
Dirk Ziegelmeier
27c226b5d6 Fix a few documentation errors in MDNS 2019-02-02 22:44:57 +01:00
Solganik Alexander
b1d3dcb8d7 tcp: don't reset dupack count upon non-empty packet receive
According to rfc5681:

https://tools.ietf.org/html/rfc5681

Paragraph 3.2.  Fast Retransmit/Fast Recovery
The TCP sender SHOULD use the "fast retransmit" algorithm to detect
and repair loss, based on incoming duplicate ACKs.  The fast
retransmit algorithm uses the arrival of 3 duplicate ACKs (as defined
in section 2, without any intervening ACKs which move SND.UNA) as an
indication that a segment has been lost.  After receiving 3 duplicate
ACKs, TCP performs a retransmission of what appears to be the missing
segment, without waiting for the retransmission timer to expire.

Now consider the following scenario:
Server sends packets to client P0, P1, P2 .. PK.
Client sends packets to server P`0 P`1 ... P`k.

I.e. it is a pipelined conversation. Now lets assume that P1 is lost, Client will
send an empty "duplicate" ack upon receive of P2, P3... In addition client will
also send a new packet with "Client Data", P`0 P`1 .. e.t.c. according to sever receive
window and client congestion window.

Current implementation resets "duplicate" ack count upon receive of packets from client
that holds new data. This in turn prevents server from fast recovery upon 3-duplicate acks
receive.
This is not required as in this case "sender unacknowledged window" is not moving.

Signed-off-by: Solganik Alexander <sashas@lightbitslabs.com>
2019-01-30 21:13:22 +01:00
Simon Goldschmidt
5666f305ce sntp: obey KoD when using multiple servers
See bug #55253 (SNTP retry next server instantly result as a flood of NTP request).
Added 'sntp_getkodreceived()' to check the status.
2019-01-30 20:42:56 +01:00
Simon Goldschmidt
8e86555f93 mdns: fix compiler errors and coding style 2019-01-30 20:15:26 +01:00
David Girault
b4be0d8808 mdns: added support for searching services
Two new API:
err_t mdns_search_service(const char *name, const char *service, enum mdns_sd_proto proto,
                          struct netif *netif, search_result_fn_t result_fn, void *arg,
                          s8_t *request_id);
void mdns_search_stop(s8_t request_id);

One compilation flags:
LWIP_MDNS_SEARCH

One options flags:
MDNS_MAX_REQUESTS

Some structure declarations moved to allow use by callback result function.

Result domain names are early uncompress before calling application callback
because it cannot be made by application itself.

Allow search services with multiples labels included, like '_services._dns-sd'.

Search for `_services._dns-sd._udp.local.` is handled in a special way.
Only `PTR` answers are send back to the application.

The `mdns_search_service()` function won't assert if no more space in `mdns_request`
table, just return an error if too many simultanous requests.
2019-01-30 20:05:51 +01:00
Ivan Warren
9263d44847 Small documentation fix for TFTP
Apparently the TFTP server now also invokes the error() function in the
tftp_context struct.

Some tftp clients (for example Windows 10 TFTP client) will open the
remote file before checking the local file can be opened - and will then
send an error indication to the server to indicate there was an error
opening the local file. When the happens, the LWIP tftp server will
invoke the error() member of the tftp_context.
2019-01-30 19:56:49 +01:00
David J. Fiddes
8f2f43f093 Implement RFC4075 Receive SNTP servers via DHCPv6
This adds support for RFC4075 SNTP server configuration via DHCPv6.
The DHCPv6 options transmitted are now conditional on how LwIP is
configured.

A new SNTP application option SNTP_GET_SERVERS_FROM_DHCPV6 is used
to enable. For simplicity this is configured to use the global
LWIP_DHCP6_GET_NTP_SRV configuration setting.

Tests:
 - Check the global options now control the DHCPv6 request sent
   in Wireshark
 - Check against 0, 1 and 3 SNTP servers configured on an odhcpd
   server configured to support RFC 4075 SNTP server lists.
   Verify that the SNTP server list is updated on connection
   establishment on an ESP8266 WeMOS D1.
 - Verify that SNTP packets are sent and recieved from a
   configured server and that system time is updated.

Signed-off-by: David J. Fiddes <D.J@fiddes.net>
2019-01-30 17:49:18 +01:00
David Girault
3cb6ae7770 altcp_tls: assert in altcp_mbedtls_bio_recv if bad state 2019-01-30 17:42:52 +01:00
David Girault
b04d8a6a6c altcp: support for setting keepalive parameters 2019-01-30 17:42:46 +01:00
David Girault
b298afabdc altcp_tls_mbedtls: remove entropy/ctr_drbg from altcp_tls_config struct
Use only one entropy/ctr_drbg context for all altcp_tls_config structure allocated.

(Small adjustments before committing: fix coding style, adapt to changes in master)
2019-01-30 17:42:39 +01:00
David Girault
2cc420e434 mqtt: remove bad assert in mqtt_message_received()
- client->msg_idx can be > MQTT_VAR_HEADER_BUFFER_LEN in long message splitted in multiple pbufs
- renamed fixed_hdr_idx to fixed_hdr_len because it is length of fixed header in rx_buffer, not an index to it
- removed the cpy_start as data always copied right after the fixed header
2019-01-30 14:29:21 +01:00
Simon Goldschmidt
ed561a578b tcp: improve debug message a little 2019-01-30 14:27:16 +01:00
Dirk Ziegelmeier
4c19a909c2 Fix bug #55537: Crash in SYN_SENT state when TCP_INPUT_DEBUG logs are ON 2019-01-28 14:21:34 +01:00
Dirk Ziegelmeier
941300c21c Apply patch #9737: Fix DHCPv6 DNS server assignment 2019-01-28 14:19:15 +01:00
Dirk Ziegelmeier
3efc43531b Fix bug #55536: lwIP 2.1.2: netconn_delete() called twice from lwip_accept()
netconn is deleted in free_socket() call
2019-01-28 14:13:52 +01:00
Dirk Ziegelmeier
8bf2e21b4d TCP/UDP documentation: Add reference to PCB mempool #defines 2019-01-28 13:47:03 +01:00
Dirk Ziegelmeier
926e399355 Fix bug #55513: Uninitialized variable in struct netconn
using patch from Karol Domagalski
2019-01-18 20:51:58 +01:00
Dirk Ziegelmeier
ea14b774c8 Replace several occurences of stdint types by lwIPs portability typedefs
Fixes bug #55405: Usage of uint8_t instead of ui8_t in TCP code
2019-01-06 21:19:04 +01:00
Dirk Ziegelmeier
d504e27142 dhcp.c: Fix typo in debug message 2019-01-04 11:08:46 +01:00
Jacob Kroon
c02fea0961 PPP, PPPoE: use service name and concentrator name
Make pppoe_create() actually store the passed service name and
concentrator name, so that they are passed in the PADI/PADR/PADS
packets.

Assume that the user application won't be freeing the strings and just
copy the string pointers, therefore remove the mem_free() in
pppoe_destroy().

Since only the pointers are copied now, make them 'const' in
pppoe_softc.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-12-20 13:24:04 +01:00
Sylvain Rochet
48615984c7 PPP, PPPoE: remove leftover from PPPOE_SCNAME_SUPPORT support
Stupid me managed to push a pending patch, remove it.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-12-18 22:19:37 +01:00
Jacob Kroon
7eab5947af PPP, PPPoE: fix build when PPPOE_SCNAME_SUPPORT is defined
lwip/src/netif/ppp/pppoe.c:768:24: error: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Werror=poin$
     l1 = (int)strlen(sc->sc_service_name);
lwip/src/netif/ppp/pppoe.c:772:24: error: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Werror=poin$
     l2 = (int)strlen(sc->sc_concentrator_name);

sc->sc_service_name and sc->sc_concentrator_name are best defined as
char* because there are passed to libc strings functions which expect
a char*.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-12-18 22:13:46 +01:00
Sylvain Rochet
96548ede2b PPP, PPPoE: rename PPPOE_TODO to PPPOE_SCNAME_SUPPORT, prepare service name and concentrator support
Rename PPPOE_TODO to PPPOE_SCNAME_SUPPORT because this is the only
feature enclosed by them. Prepare for proper service name and
concentrator name support by moving PPPOE_SCNAME_SUPPORT define to
ppp_opts.h.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-12-18 22:09:48 +01:00
Dirk Ziegelmeier
2ff0db9a9b Fix bug #55171: Binding UDP PCB with different IP type PCBs does not work
by additionally checking IP address type
2018-12-06 14:40:57 +01:00
Jasper Verschueren
75f33081c2 DEF: added lwip_strnistr() for case insensitive matching 2018-12-05 19:59:45 +01:00
Simon Goldschmidt
dcb29c591f nd6: fix copying more than one DNS server
See bug #55163
2018-12-05 19:56:48 +01:00
Simon Goldschmidt
282389a332 altcp_tls_mbedtls: listen: free members of the ssl context
The ssl context is not used on listening pcbs. This includes freeing
input/output buffers, so saves ~32KByte by default.
2018-12-03 07:14:02 +01:00
Dirk Ziegelmeier
781a4ccb62 mdns_domain.c: Fix doxygen comments 2018-11-25 14:39:31 +01:00
Dirk Ziegelmeier
92a18bf638 Fix bug #55078: Add custom data to pbuf struct
Add a #define that users can use to store custom data on a pbuf
2018-11-25 14:01:23 +01:00
Simon Goldschmidt
3f583a1757 altcp_tls: add functions to create servers with multiple certificates 2018-11-24 13:41:34 +01:00
Simon Goldschmidt
6f232b7c3f altcp_tls_mbedtls: add session tickes, improve configuration for session cache 2018-11-23 22:39:58 +01:00
Simon Goldschmidt
54448559bb altcp_tls_mbedtls: add debug output of mbedtls library 2018-11-23 22:25:21 +01:00
Simon Goldschmidt
7859c6832b makefsdata: fix compiling for win32 2018-11-23 12:59:07 +01:00
Axel Lin
d116d235a5 apps/smtp: Remove redundant LWIP_ASSERT checking in smtp_send_mail_bodycback
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-11-23 19:28:24 +08:00
Dirk Ziegelmeier
b1fbb5ad45 Fix warnings about ignored return values in makefsdata.c
These only show up when compiling with -O3
2018-11-22 21:53:12 +01:00
Dirk Ziegelmeier
e31f1b918c mdns.c: Fix accessing potentially uninitialized variable
myprobe_inpkt.pbuf may not be set to NULL in mdns_handle_probe_tiebreaking()
2018-11-22 13:36:20 +01:00
Dirk Ziegelmeier
45a055840d snmp_traps.c: Portability fix: Don't use non-constant initializers 2018-11-22 13:25:43 +01:00
Craig McQueen
ef76bbe3f0 DNS: Allow a DNS look-up with a trailing dot in the name
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-11-22 13:14:41 +01:00
Simon Goldschmidt
9071db11af snmp: don't allocat outbound msg for GET RESP (inform cb) 2018-11-22 12:54:50 +01:00
Simon Goldschmidt
ed59260b92 snmp: fix coding style
no need to initialize global static variables to NULL
2018-11-22 12:51:46 +01:00
Dirk Ziegelmeier
c23aa713f9 Try to fix compile warning in mdns.c
src/apps/mdns/mdns.c: In function 'mdns_debug_print_answer':
src/apps/mdns/mdns.c:796:24: warning: ', rdata = ' directive output may be truncated writing 10 bytes into a region of size between 8 and 15 [-Wformat-truncation=]
   snprintf(string, 35, "Type = %2d, class = %1d, rdata = ", a->info.type, a->info.klass);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/apps/mdns/mdns.c:796:3: note: 'snprintf' output between 31 and 38 bytes into a destination of size 35
   snprintf(string, 35, "Type = %2d, class = %1d, rdata = ", a->info.type, a->info.klass);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-11-22 11:37:24 +01:00
Dirk Ziegelmeier
10e0130a4a netbiosns_name_decode: Take CONST char* as first argument 2018-11-21 21:03:36 +01:00
Jens Nielsen
b0c753da96 Fix netbiosns expecting too large packet 2018-11-21 20:50:35 +01:00
Dirk Ziegelmeier
30b2d07362 Fix compile error with GCC 8 in makefsdata
lwip/lwip/src/apps/http/makefsdata/makefsdata.c:929:56: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
   snprintf(qualifiedName, sizeof(qualifiedName), "%s/%s", curSubdir, filename);

/home/dziegel/lwip/lwip/src/apps/http/makefsdata/makefsdata.c:929:3: note: ‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256
   snprintf(qualifiedName, sizeof(qualifiedName), "%s/%s", curSubdir, filename);

Reduce subdir string length by 3 bytes to make the warning go away. The whole file path including directory AND filename is limited to MAX_PATH_LEN - so it is reasonable to reserve 3 bytes less for directory - the filename won't fit anyway in the remaining 3 bytes.
2018-11-20 20:34:29 +01:00
Jasper Verschueren
ee1bab3411 mDNS: conflict resolution added
If the host observes a response (after probing) containing RR's
that he thought were unique to him, there is a conflict. If a host
observes such conflict, it resets back to probing and the probing
procedures will resolve the conflict. (RFC6762 section 9)
2018-11-20 12:49:58 +01:00
Simon Goldschmidt
3bd84aba4b snmp_v3: use strlen, not strnlen
strnlen is not portable.
In this case, it does not matter as we zero-terminate the string before.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-11-19 20:13:30 +01:00
Dirk Ziegelmeier
aa83bdf490 Fix bug #55034: apps/smtp.c fails to compile with strict C compatibility because of strnlen
by replacing strnlen with strlen. It's a user-supplied string, so we can assume it is correctly \0 terminated (as done several times elsewhere in the code)
2018-11-19 14:43:26 +01:00
Dirk Ziegelmeier
4adcd68ce4 Fix compile of mdns.c
Add missing stdio.h for snprintf()
Fix variable declaration in code
2018-11-19 14:32:05 +01:00
Jasper Verschueren
19cbf2a652 mDNS: probe rate limiting if more then 15 conflicts occur in 10s
According to RFC6762 section 8.1:
If fifteen conflicts occur within any ten-second period, then the
host MUST wait at least five seconds before each successive
additional probe attempt.
If the host restarts mDNS, instead of a probe wait timeout randomly
chosen between 0 and 250ms, we wait 5s if more then 15 conflicts
occured in 10seconds. This flag is reset from the moment probing
succeeded.
2018-11-19 14:26:25 +01:00
Jasper Verschueren
593c02aed4 mDNS: probe tiebreaking added
mDNS: first version probe tiebreaking added

This first version works for our MCU boards but does only compare
the first question and answer. It does not sort the list of answers
and it does not search for answers or questions.

mDNS: improved probe question handling

For every probe question in our packet, we check the presence
in the incomming packet until we find a match. then we perform
the tiebreaking. At the moment we still only look at the first
answer.

mDNS: evaluate all answers in the authoritative section

The authoritative sections of both messages are evaluated.
The records that answer the probe question are sorted in to lists.
Then the lists are compared pairwise. A winner and a loser are
chosen and the host reacts on the outcome (ignore or stop probing).

mDNS: add support for name decompression in rdata when comparing.

For probe tiebreaking we need to compare RR's. It is possible that
the rdata of an RR contains compessed names (SRV record). We need
to decompress it first before we do the comparison.
2018-11-19 14:25:31 +01:00
Jasper Verschueren
a09646c507 mDNS: split probe packet definition and split outpkt creation
Probe packet creation -> by splitting the definition and the sending
we can use the definition function for probe tiebreaking.
outpkt creation -> by splitting the creation and sending we can use
the creation function for probe tiebreaking.
2018-11-16 14:52:40 +01:00
Jasper Verschueren
861ce296b9 mDNS: respond to probe via multicast added
The host only responded to a probe query via unicast because
according to the RFC, a probe should have the QU bit on.
This is a should and not a must so we need to be careful.
We added multicast probe answering support with the needed timouts.
Avahi for example probes with the QM queries. With this commit the
conflict is resolved.
2018-11-14 16:52:17 +01:00
Dirk Ziegelmeier
d386388fb5 Move netif_mdns_data() and get_mdns_pcb() to mdns_priv.h 2018-11-13 12:22:24 +01:00
Dirk Ziegelmeier
2adc6d2687 MDNS: Minor compile fix, declare variables before code 2018-11-13 12:20:57 +01:00
Jasper Verschueren
405fc4d802 Revert "mDNS: authority section of probe message needs to contain all records"
This reverts commit e959e6efaf8a1cb57e9a5d4d8e0056c7ea52179f.
2018-11-13 12:18:19 +01:00
Jasper Verschueren
ee7ed8c87d mDNS: cleanup probing and announcing sequence
The implementation was not fully to the standard. This commit adds
a nicer state machine implementation and multiple announce messages
with a minimum of 2.
2018-11-13 12:18:04 +01:00
Jasper Verschueren
65eb36b10d mDNS: ignore responses with src port != 5353 (rfc6762 section 6) 2018-11-13 12:17:38 +01:00
Jasper Verschueren
16da67bb21 mDNS: source address check added
RFC6762 section 5.5 and 11 define that we should check that all
packets originated on the local link.
2018-11-13 12:17:38 +01:00
Jasper Verschueren
331368e3aa mDNS: add new files to filelists + solve compile errors
ttl setting removed from example code.
string.h included where needed.
2018-11-13 12:17:38 +01:00
Jasper Verschueren
201e772e15 mDNS: author comment update + things left to implement update 2018-11-13 12:17:38 +01:00
Jasper Verschueren
4289293061 mDNS: add support for output delaying
See below commit messages for more information

mDNS: support for direct and delayed sends

There are two ways to send a response, directly and after a delay.
A probe or an announce msg are now send via the direct way and
all responses are send via the delayed way.

mDNS improved delay vs direct send behavior on questions

All multicast answers are delayed at the moment. While all unicast
answers are send out directly. A unicast answer is send when this
is requested by the QU bit, when a unicast question was send or
when the question originated from a legacy querier.

mDNS: add probe query detection.

If a probe query is detected a direct unicast respond is send.
Independent of the QU/QM bit.

mDNS split delayed multicast msgs into ipv4 and ipv6 buffers.

We are implementing a two resolvers in one (IPv6 and IPv4 together).
For directly send answers, this does not matter. But for delayed
answers, we need to make a separate buffer for both.

mDNS: addr bug, we should not clear full outmsg

memset deleted also the dest_addr and dest_port, which should remain
and is constant. This commit contains a function that resets only the
needed parts of the outmsg struct.

mDNS: do not multicast a rr within one second.

RFC6762 section 6: prevent network flooding. When a multicast packet
is send out, we start a timeout of 1s within this 1 second all
multicast requests are ignored. We do not make a difference between
the records, we set the delay for all records.

mDNS: improved split for unicast vs multicast and direct vs delayed

unicast delayed message are now possible and multicast direct msgs to.

MDNS: changed printfs to lwip debug messages

MDNS: change timeouts from max time to random time

mDNS: send multicast response on QU questions if not multicasted recently.

If a QU question is received, the responder should multicast the
answer if it did not multicast that record within 25% of it's ttl.

we implemented a stripped down version, meaning that we look at the
records as one set and use one timer for all records. So if the
responder multicasted a record within 30s of the QU question it
will respond with a unicast answer. if not, it will respond
multicast.

mDNS: timeouts -> create function for mdns timeout handling

mdns_set_timeout will check if the timer is running or not and will
update the flag to running after starting the timer.
Multicast timeouts were not set everywhere they needed to be. This
is solved.
mulit <-> multi typo fixed.

mDNS: solve commenting and style issues

mDNS: add #if LWIP_IPVx to new code

LWIP_IPV4/6 can be enabled or disabled, all combination should work.
2018-11-13 12:17:37 +01:00
Jasper Verschueren
4ea5110662 mDNS: remove netif from mDNS structs
it's more practical to use netif as a wrapper instead of wrapping
netif in the mdns packets. netif contains all information.
Netif is passed along were needed.
2018-11-13 12:17:37 +01:00
Jasper Verschueren
62fb2fd749 mDNS fix TTL bug
MDNS_TTL changed to MDNS_IP_TTL for clarity.
The mDNS RR ttl does not need to be settalbe, this is against the
RFC. RFC6762 states that for rr's with the hostname in them
somewhere, the ttl should be 120s. If it's not in their it should
be 75 minutes and if the answer is send to a legacy dns querier,
it should be no more then 10s.
This patch corrects the ttl behavior to the RFC.
2018-11-13 12:17:37 +01:00
Jasper Verschueren
c4321330d0 mDNS: authority section of probe message needs to contain all records
see RFC 6762 section 8.2: for tiebreaking to work correctly in all
cases, the Authority section must contain all the records and
proposed rdata being probed for uniqueness.
2018-11-13 12:17:37 +01:00
Jasper Verschueren
3043d9d023 mDNS: move domain related functions and output related funtions
mDNS.c needed to become cleaner. Domain related functions are
moved to the mdns_domain.c util module. The output related
functions are split off (clear separation between defining the
packet and generating the packet). The output functions can
now be found in mdns_out.c.

mDNS move probe question packet generation to mdns_send_outpacket

The probe any questions were added to the pbuf in the send_probe
routine. It is better if we move all pbuf generation to the output
function so later on packets can be delayed etc. keep it all in
one place.

mDNS: move legacy question generation to mdns_send_outpacket

It's better to do the pbuf generation in one place.
Especially important for message delaying etc.

mDNS take out domain related functionality and put in other file.

The mDNS file is getting very big and a lot still needs to be added.
For clarity reasons it's better to split these domain functions
from the main mDNS file.

mDNS split off output related functionality and put in other file

A lot of functions are only needed for the generation of the pbuf,
by separating them into another file we clean up the mdns file.
We only need the mdns_send_outpacket function as interface.
Packet definition is now completely separated from packet
generation.
2018-11-13 12:17:36 +01:00
Simon Goldschmidt
1a10a942f2 tcp_recved: fix overflow check
Improved fix instead of patch #9699.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
(cherry picked from commit 98d1cb1c00)
2018-11-12 21:01:47 +01:00
Simon Goldschmidt
18b91b2841 Revert "tcp_recved: check for overflow and warn about too big values"
This reverts commit 684adaca29.

It changes the behaviour to assert for applications running good so far.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-11-12 21:01:05 +01:00
Axel Lin
292bd85db6 sockets: Trivial comment fixes
lwip_getsockopt_internal/lwip_setsockopt_internal were renamed to
lwip_getsockopt_impl/lwip_setsockopt_impl. Update the comment accordingly.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-11-09 17:14:20 +08:00
Axel Lin
7bcf0d3334 sockets: Fix missing err_to_errno conversion for ERR_VAL in lwip_recvmsg
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-11-08 22:43:51 +08:00
Dirk Ziegelmeier
7869d7c5f7 More snmp_traps.c documentation fixes 2018-11-08 08:35:39 +01:00
Dirk Ziegelmeier
98e31f7ba6 SNMP: Simplify two informs functions 2018-11-07 21:23:28 +01:00
Dirk Ziegelmeier
0e3bc53432 Fix comments in new SNMP code 2018-11-07 21:21:23 +01:00
Dirk Ziegelmeier
65033b6ba5 Apply patch for task #15072: SNMP support for notifications and informs (v2c)
Original author: Ognjen Bjelica
with minor fixes from Dirk Ziegelmeier
2018-11-07 21:04:53 +01:00
Simon Goldschmidt
f72227aadc fix compiling ETHARP_SUPPORT_VLAN without LWIP_HOOK_VLAN_SET and LWIP_VLAN_PCP 2018-11-07 10:49:06 +01:00
Simon Goldschmidt
153c295b6f altcp_tls_mbedtls: use mbedtls_entropy_func for mbedtls_ctr_drbg_seed
This is the default way for mbedTLS. Add entropy sources via defines (see
mbedtls_entropy_init).

This removes the use of ALTCP_MBEDTLS_RNG_FN

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-11-06 21:28:45 +01:00
Joan Lledó
284659156d Remove assertion about the end of pollfd array
See bug #54933.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-11-01 21:56:58 +01:00
Simon Goldschmidt
3c17c1e82e fix typo in comment 2018-11-01 21:42:09 +01:00
Dirk Ziegelmeier
7c2267b966 Fix bug #54670: 127.0.0.1 sent out to netif_default? 2018-11-01 21:36:24 +01:00
Dirk Ziegelmeier
0c34597b9e netif: Add getter for loopif for unit tests 2018-11-01 21:35:06 +01:00
Dirk Ziegelmeier
26a84d9307 Minor: add parenthesis for cleaner code 2018-10-28 21:08:24 +01:00
Florent Matignon
ffbe075d56 bug #54700: Unexpected expiry of pending ARP table entry
New etharp queries should restart the 5 second timeout on the ARP
table entry if it is still pending.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 20:59:10 +02:00
Simon Goldschmidt
fa37888da2 altcp_tls_mbedtls: update list of todos
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 20:43:06 +02:00
David GIRAULT
6e994f9df2 bug #54744: if altcp_close() called from recv() callback, there is some write to freed memory
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 19:56:54 +02:00
Simon Goldschmidt
a352f4e11c Explicitly check for TCP_MSS to be <= ~16 kByte
See bug #54890

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 19:43:13 +02:00
Simon Goldschmidt
a41c1fcc62 patch #9350: Sockets API: use OS's sys/socket.h instead of lwip/sock
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 19:33:47 +02:00
Dirk Ziegelmeier
ec28364a2f SNMP_ERR_NOTWRITABLE is a more appropriate return value for the last two commits
The instance of the SNMP node was found, that's why the functions have been called. So if set_test() and/or set_value() do not exist, it means the SNMP node instance is not writable.
2018-10-24 09:59:06 +02:00
Dirk Ziegelmeier
ee2f5c52d1 Fix the same issue as in snmp_scalar.c in snmp_threadsync.c 2018-10-24 08:54:08 +02:00
Dirk Ziegelmeier
36e2d2255e Fix wrong return value in snmp_scalar_array_get_value() 2018-10-24 08:34:32 +02:00
Simon Goldschmidt
6a1fbc7433 snmp: fix coding style in last commit 2018-10-23 20:01:06 +02:00
Dirk Ziegelmeier
2e7b4573a5 SNMP: Avoid NULL pointer dereference in snmp_scalar.c 2018-10-23 14:26:29 +02:00
Simon Goldschmidt
ff8d1a384f httpd: SSI types should be overridable (task #15071)
Add define LWIP_HTTPD_SSI_EXTENSIONS to make the extension list
overridable, clarify documentation of LWIP_HTTPD_SSI_BY_FILE_EXTENSION
a bit.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-23 08:17:45 +02:00
Simon Goldschmidt
f6b728b24c makefsdata: obey LWIP_HTTPD_SSI_BY_FILE_EXTENSION
Don't check SSI extension list if LWIP_HTTPD_SSI_BY_FILE_EXTENSION == 0

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-23 08:16:49 +02:00
Simon Goldschmidt
688b0935e2 Try to catch missing std includes on travis
By defining LWIP_PLATFORM_ASSERT to a function, we can prevent arch.h
from including stdio.h and stdlib.h

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-23 08:00:37 +02:00
Simon Goldschmidt
ef02b1dc20 fix missing standard includes
These were a problem only if arch.h does not include them.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-23 07:46:13 +02:00
Dirk Ziegelmeier
06cc825431 Whitespace cleanup lwIP 2018-10-22 20:53:58 +02:00
Simon Goldschmidt
e0e4240875 Revert "Allow the use of external Sockets headers"
This reverts commit 413b26a7e1.

It breaks the build if LWIP_SOCKET is disabled.
Plus it breaks git history for inet.h and sockets.h for no real reason.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-22 20:37:56 +02:00
Dirk Ziegelmeier
95aba99f41 Implement task #11620: Add outgoing VLAN PCP support for Ethernet level QoS
Apply rebased patch from Timmy Brolin
2018-10-19 22:30:17 +02:00
Dirk Ziegelmeier
64bc2c3df7 Fix bug #54805: IP address can not be obtained over dhcp if PBUF_POOL_BUFSIZE is too small
Patch by Christoph Chang
2018-10-19 21:06:15 +02:00
Joan Lledó
413b26a7e1 Allow the use of external Sockets headers
New macro LWIP_SOCKET_HEADERS can be used to replace
    LwIP sockets headers by OS's headers.

    By default LWIP_SOCKET_HEADERS==LWIP_SOCKET, when LWIP_SOCKET==1
    and LWIP_SOCKET_HEADERS==0, user must provide their custom headers
    by setting LWIP_INCLUDE_SOCKETS and LWIP_INCLUDE_INET.
2018-10-19 20:30:24 +02:00
Simon Goldschmidt
0be3e35bf2 tftp: mode_to_string() should be static 2018-10-17 21:53:04 +02:00
Simon Goldschmidt
0ee4784d0c tftp client: pass 'mode' as an enum, not as a string constant 2018-10-17 21:37:46 +02:00
Dirk Ziegelmeier
ee269ceec5 Fix bug #54850: lwip definition of htonX and ntohX do not properly cast to unsigned when byte order is Big Endian
Changes suggested by Ivan Warren
2018-10-17 20:23:28 +02:00
Dirk Ziegelmeier
8dd931ab27 Fix cyclic linking dependency when using MBEDTLS 2018-10-14 09:43:22 +02:00
Simon Goldschmidt
fa76861481 tftp: fix cast warnings; return all error codes
Also keep tftp_mode in tft_state

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-13 20:26:06 +02:00
Dirk Ziegelmeier
22c1c4ec8d Try to get CMake build running on travis 2018-10-13 10:45:58 +02:00
Simon Goldschmidt
a63a7d3c76 Fix bug #54806 (ppp: invalid LWIP_ASSERT_CORE_LOCKED() check)
pppos_input() is safe to call from outside tcpip_thread when
PPP_INPROC_IRQ_SAFE == 1, so only check if PPP_INPROC_IRQ_SAFE == 0

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-12 22:26:51 +02:00
Simon Goldschmidt
426a6004bf Revert "tcp_abandon: no need to buffer pcb->local_port"
This reverts commit 1570dd8ad1.

Buffering pcb->local_port is needed because TCP_PCB_REMOVE_ACTIVE()
sets it to 0 via tcp_pcb_remove() (comment: "reset the local port
to prevent the pcb from being 'bound'").

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-12 22:14:23 +02:00
Dirk Ziegelmeier
6826130d6f CMake: Use include_guard only when CMake >= 3.10.0 2018-10-12 22:01:25 +02:00
Simon Goldschmidt
e3cd915fb9 Fix whitespace error introduced when merging 684adaca
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-12 21:18:17 +02:00
Simon Goldschmidt
0d4e1beec4 Fix compiling ACD without LWIP_RAND
Copy bad rand implementation from old one in autoip.c

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-12 21:05:19 +02:00
Dirk Ziegelmeier
437e0a6756 Fix C++ style comments in TFTP 2018-10-12 14:27:31 +02:00
Jonas Rabenstein
d1da9ec5d3 err.h: move typedef of err_t after enum definition
This allows for 'typedef err_enum_t err_t' and thus strong type checking
of the enum in c++.
2018-10-11 07:32:55 +02:00
Jonas Rabenstein
684adaca29 tcp_recved: check for overflow and warn about too big values 2018-10-11 07:31:54 +02:00
Dirk Ziegelmeier
f61e57965f Minor coding style fix in tftp.c 2018-10-09 09:07:08 +02:00
Dirk Ziegelmeier
65b1a395f4 TFTP: Fix doxygen docs 2018-10-08 22:16:40 +02:00
Dirk Ziegelmeier
a6dc31433e Restructure CMake build system a bit
This should be easier to use for application devlopers
2018-10-08 21:18:18 +02:00
Dirk Ziegelmeier
abcf42b655 Fix compile of TFTP using GCC 2018-10-08 20:21:32 +02:00
Dirk Ziegelmeier
c8808f69b2 Fix tftp_init_client signature 2018-10-08 12:56:27 +02:00
Dirk Ziegelmeier
5a8bd37509 Improve TFTP comments 2018-10-08 12:48:16 +02:00
Dirk Ziegelmeier
6c2fd2d25d Improve TFTP implementation
- implement server/client mode (API is nicer to use)
- Increase TFTP_MAX_MODE_LEN to be able to contain "netascii" transfer mode
- Adapt tftp_example to changes
2018-10-08 12:45:29 +02:00
Dirk Ziegelmeier
54fc708c76 Apply fix from Axel Lin
(Build issue if LWIP_DHCP is set to 0)
2018-10-08 11:42:28 +02:00
Dirk Ziegelmeier
7ba69d875c Some TFTP cleanups 2018-10-08 11:41:51 +02:00
Ben Wijen
b2713601f0 tftp: Add client functionality
* add helper functions
* add tftp_get/tftp_put
* rename files
2018-10-08 09:00:20 +02:00
Joan Lledó
c683427bfd alloc_socket(): Check for LWIP_SOCKET_POLL when setting select-related variables 2018-10-08 08:51:55 +02:00
Dirk Ziegelmeier
ff44049baf Rename DHCP_DOES_ACD_CHECK ->LWIP_DHCP_DOES_ACD_CHECK 2018-10-05 11:04:48 +02:00
Dirk Ziegelmeier
a3cdf3c4cc Move two #defines from acd.h to acd.c since they are only useful in there 2018-10-05 10:58:30 +02:00
Dirk Ziegelmeier
015cff75fd Fix "switch missing default case" in dhcp.c 2018-10-05 10:49:21 +02:00
Dirk Ziegelmeier
7492bfb0dc Enable DHCP_DOES_ACD_CHECK by default 2018-10-05 08:38:13 +02:00
Dirk Ziegelmeier
d9c9b55766 CMake: add an include guard since files are intended to be included in other projects 2018-10-05 08:02:34 +02:00
Dirk Ziegelmeier
d4c8b3e7e8 Apply patch #9694: Update prev pointer when skipping entries in tcp_slowtmr to prevent hitting assertion 2018-10-04 17:38:17 +02:00
Dirk Ziegelmeier
9a80c865b0 Filelists.cmake: Minor message improvement 2018-10-04 17:34:44 +02:00
Dirk Ziegelmeier
9c86302113 acd.h: No "," at last enum element 2018-10-04 17:34:44 +02:00
Dirk Ziegelmeier
f8ed17082d A few ACD compile and doc fixes 2018-10-04 17:34:44 +02:00
Jasper Verschueren
7d1c26cc0c ACD module added + update and improve DHCP + AUTOIP behavior
Squashed commit of the following:

commit 2d98d8e2ef1941c3824ffb874f1e529d284667fc
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Thu Sep 13 16:15:06 2018 +0200

    AUTOIP: correct functionality autoip_supplied_address

    It does not mean that if autoip is bound, it also supplied the
    netif address. A check is added.

commit 2ca0a2183991ef73860c4207d95799b37acc64cc
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Thu Sep 13 16:06:49 2018 +0200

    AUTOIP: keep using the same link local address as much as possible

    Only calculate a new link local address at start up or when a
    conflict occured. On link up or down -> keep same address.

    TODO: in the future a function for persistent storage should be
    added.

commit aa70a693351e4c898aa28d8521308794614838f1
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Thu Sep 13 14:43:14 2018 +0200

    ACD, AUTOIP & DHCP: make link up & down functions where needed

    When the link goes down or up the approriate functions should be
    stopped or started again. To accomodate this, network_changed is
    adjusted to network_changed_link_up and network_changed_link_down.
    DHCP does not need to control AUTOIP. AUTOIP can take care of
    itself. The only thing DHCP needs to do is starting it when
    discovering is failing. The AUTOIP state variable is removed from
    DHCP.

commit ad469eb006b47f8a8c37f7c0de0216f47a8c19c7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Thu Sep 13 11:25:58 2018 +0200

    ACD: add address change listener + passive conflict detection mode

    In the case their previously was a LL address on a netif that
    is now configured with a routable address, we want the LL
    address to be able to keep receiving packets.
    for as long as the LL address is available on the interface it
    should do ongoing conflict detection. But we cannot defend when
    the LL address is not the netif address any more.
    An address change listener is added to detect when an ACD module
    needs to go from active ongoing conflict detection to passive.
    When a conflict is detected autoip is stopped and will not be able
    to receive packets any more. Because we have a valid routable
    address on the netif, autoip is not restarted.

commit 07c4ec20cea78e2b4a6f5599569abaf075619c62
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Sep 11 16:25:37 2018 +0200

    ACD: make module reusable within a netif

    DHCP and AUTOIP both have ACD running simultaniously. The ACD
    struct is added to the DHCP and AUTOIP structs. In the netif a list
    of ACD modules is kept to loop over if functions need to perform
    some action on all ACD modules (for example tmr function). With
    acd_add a module can be added to the list. ACD_FOREACH loops over
    the list similar to NETIF_FOREACH.

commit ee3b4585b7768f5353dd80190a2929bad45f7ff4
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Sep 10 16:36:18 2018 +0200

    etharp & acd: add probe and announce functions to etharp.

    The new probe and announce functions are independent of
    netif->ip_addr. This means we can keep the LL address working
    while we start to probe for the newly received routable address.
    The netif->ip_addr does not need to be any for probing to work
    with this patch.

commit 7d3032bae8f1b8081368a807682388eb642729e0
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Sep 3 13:35:51 2018 +0200

    autoip -> unused random function removed + small comment update

commit be749ba4eb26ddc69233c85d532dc035741275c5
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Fri Aug 31 16:37:36 2018 +0200

    ACD: update comment in header

commit 4491842991c90b3a58fa327f70aa42f04174546b
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Fri Aug 31 15:44:45 2018 +0200

    ACD: subscribe to link down messages to stop the acd process

    When the link goes down the acd process should be stopped
    independent of the acd client. Otherwise the acd will keep probing
    or announcing while their simply is no connection.

commit 71f668aa7583354e132c20b3b50ba2c86bf08738
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Fri Aug 31 13:59:44 2018 +0200

    DHCP coop autoip bug fix: wait after last discovery before starting autoip

    After the last dhcp discovery we need to give the dhcp server the
    time to respond. Currently the discovery message is send and autoip
    is started simultaniously. This is changed. Autoip will now be started
    after the next discovery timeout.

commit 0da16604ec079195533f2591f0d0f04bdf212a72
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Fri Aug 31 11:23:31 2018 +0200

    ACD: rate limit interval bug solved -> first decline then wait then restart.

    According the the ACD RFC we need to limit the rate of acquiring
    and probing addresses after MAX_CONFLICTS. It is important to first
    decline the address and stop the netif from using the address before
    the time is started. After this rate limit time, the address acquiring
    process can be started again.

    To make this possible we had to change the callback function and
    the location in the process were the rate limiting is done.

commit a89a0601a251acb14abe270116f38c6d25c2d7a9
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Thu Aug 30 17:27:10 2018 +0200

    DHCP: after a succesful dhcp_reboot, the address should be probed.

    Reboot means that the connection was gone for some amount of time.
    This is seen as a new connection for the ACD module so should be
    the address should be probed before use.

commit 853afb448ba35c6e2b35e8238c9c367c599dece7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Thu Aug 30 17:19:12 2018 +0200

    DHCP_DOES_ARP_CHECK changed to DHCP_DOES_ACD_CHECK

    small update in opt.h to add the correct dependencies.

commit e28b4766bdef69e76f6170c470c93f5b251c579a
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Thu Aug 30 17:05:43 2018 +0200

    DHCP check code replaced by ACD module.

    when DHCP_DOES_ARP_CHECK is enabled, the ACD module will take care
    of address conflict detection. Via a call back function the DHCP
    state machine will continue and bind to an address if no conflicts
    are found.
    dhcp_arp_reply is obsolete because the ACD module replaces its
    function.

commit 52193a0f5d13e8786a4db2fff1f1a8f1367a4eba
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Aug 27 16:05:22 2018 +0200

    Issue 2 + 3 from Comment #5, task #13508 solved

    Removed C++ comments and // ----... marks as requested.

commit 7faaf61275d67ccfb88ea7e26c249428c3088536
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Aug 27 15:55:24 2018 +0200

    Issue 1 from Comment #5, task #13508 solved

    Comments added to clarify how arp messages are handled.

commit 9348aea22623b705759fd30b873f06a50a104d16
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 24 11:45:35 2018 +0200

    acd: add comment for callback function

commit 49fdd1177c05b74d49fa179564dcaa5e650adbcc
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 24 11:42:59 2018 +0200

    autoip: Add debugging output and complete comments

commit 591856b82c029687a657a1b1ccc674522e6f4be0
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 24 11:25:18 2018 +0200

    Removed autoip from timeouts.c

    We do not need a timer anymore. All timing is part of acd.

commit 3b3272fdd14015cfca0b3b6d149505b1cf0e36b6
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 24 11:22:32 2018 +0200

    autoip_network_changed -> first bring down the netif and then acd

    Make it do what it says in the comment

commit 77b0ccf96efd22774279c6f9b5bade18c5e42c59
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 24 11:21:23 2018 +0200

    Simplified the autoIP states + update autoip_start()

commit 96e0581d36857f8b70c4b4cce4fb323fd3dd51ab
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 24 11:10:48 2018 +0200

    Deleted unused variables, functions and defines from autoip module

    The functionality is now embedded in the acd module so can be
    removed from autoip.

commit 9296e2ebb4b51019aaccfc47e8b9f51b265d37cd
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 24 11:07:34 2018 +0200

    Bug fix acd -> rate limiting needs to be after MAX conflicts

    It was only after MAX conflicts + 1.

commit c55e16903c045d0ea84336b50eccbf24d3d097e9
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 23 17:52:45 2018 +0200

    Small intruduction to module added

commit d1498a37293bd9f97f6b938b48e5980ab0a01bd1
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 23 17:49:58 2018 +0200

    Copyright information added

    I based the copyright text on the other files. I'm not sure this
    is how its done. I kept Dominik in their because I copied quite
    some code from the autoip module.

commit 359a845ef5e73061832069f364b370634ee0b071
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 23 17:08:44 2018 +0200

    Fixing comments in acd.c

commit 100d72549d0ef44157143d031848a727f5dfbe69
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 23 15:43:40 2018 +0200

    Probe wait time and Probe interval time made random via lwip_rand

    According to the RFC a random amount of time needs to be waited
    before probing can be started also a random amount of time
    needs to be waited between the probes.
    The random time is calculated via the LWIP_RAND function (see
    lwipopts and sys_arch).

commit f7f037c32e9416f8b803c3c7af617b871b55ee35
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 16:56:48 2018 +0200

    autoip will start probing again when the network has changed

commit 1f40f6274195f24aa1b05caf82b79285ad189c2a
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 16:55:47 2018 +0200

    Duplicate code removed -> already present in autoip_start

commit be59431271da862a8ca330dbca638842c87765bc
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 16:52:49 2018 +0200

    add rate limiting to acd when too many conflicts are detected.

    When more then max conflicts are detected during device on time,
    the rate at which probing for a new address starts is limited.
    For clarity we combined the conflict counting and the callback into
    a new function acd_restart.

commit 91448455e95edb24c1f418c341b6fb306391f4f1
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 15:50:01 2018 +0200

    ARP packet conflict detection added.

    If a conflict is detected between the begin until after announce
    wait, a new address needs to be chosen immediatly.
    This can occur in two situations:
    1) another host already has this ip address
    2) another host is also probing for the same address.
    If a conflict is detected during announcing or during the ongoing
    conflict detection, we defend our ip address once. If a second
    conflict occurs during defend interval, we take another ip address.
    If not we can keep our address and connections.

    When a conflict occurs and it's decided we need a new address,
    autoip is simply restarted. To do: test if a acd stop is needed.
    This will become more important when DHCP is added I believe.

commit 65f47ba9444d8b9f767dc908319579323eeb8664
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 15:33:44 2018 +0200

    Update ACD state machine with PROBE_WAIT and and ANNOUNCE_WAIT

    By adding the ANNOUNCE_WAIT state, we could remove duplicate code
    that was present in the original autoip state implementation.
    But because we cannot directly go to ANNOUNCING we needed this
    extra state during the wait period. It also makes the different
    states clearer.
    Their is no need to number the enum because the compiler takes
    care of this standard numbering.
    Also a indent issue on the state machine code is solved here.

commit 2d9f4414c7b1f2ed35c0b5cea78dabb9c9afee77
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 15:28:33 2018 +0200

    Added an extra check for etharp responses.

    Their is no need to answer a request that is initiated by ourselves.
    In my test case, a conflicting request would be seen here as a
    request needing a reply. Which off course isn't needed at all.
    The acd module will let the requester know that it is using our
    ip address.
    I could not think of a reason not to add this extra check but please
    check if this doesn't break other functionality.

commit f84cc1dba4061219bd1aadb97bd340278db07cd7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 15:27:13 2018 +0200

    Redirect all incoming ARP messages to the ACD module.

    The ACD module will scan the packets and react on conflicts.
    autoip does not need the arp packets any more.

commit 9faf266993cc2df0b9434720b59b5922f17d7d33
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 10:08:39 2018 +0200

    Initiate acd from autoip implementation.

    The state machine in autoip is now replaced by the acd module.

commit 40a5a40d911c98e6ee8566c0adce7716f26f20e0
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 10:05:59 2018 +0200

    Add simple acd state machine to timer function.

    This state machine will be started from acd_start and will go
    through the probing and the announcing state. At this moment the
    timings are made fixed for easy debugging. Will be made variable
    afterwards.

commit 0a2629bf1f7942e80ec11bcc3e163ac1a2b9a580
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 09:44:19 2018 +0200

    Disable gratuitous ARP send from netif_issue_report when acd is enabled

    The acd module needs to be fully under control on what arp messages are
    send. It wouldn't be a clean solution if we kept this announce as one
    of the announce messages.
    So when ACD is enabled, this message will not be send.

commit a7b9a4d5039168723c2043677176c5c8fc69f8df
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 09:42:46 2018 +0200

    ARP probe and announce functions added.

    Both use etharp_requests to send out an arp message.

commit e2f1ce3fa84e2ce01bc944d8049412e156cd7cc7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Tue Jul 17 09:26:07 2018 +0200

    Add conflict callback mechanism to acd module

    When starting the acd with acd_start, a conflict callback has to be
    provided. After probing when no conflict is detected, the callback
    is called with the conflict variable on 0. From the moment a conflict
    is detected, it will be called set to 1.
    By not making a fixed link between acd, autoip and dhcp but working
    with callback functions the user (caller) can easily use it for
    fixed ip too. This keeps the acd module completely independent from
    the other application layer protocols.

commit 21e7995888d2941601e99873ee129d1ea927e3f7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 16 14:41:52 2018 +0200

    acd_stop function added.

    When calling this function the acd state machine will be put in
    ACD_STATE_OFF. This will disable the acd functionality until
    acd_start is called.

commit 503037fb462504e46a14ce7486bc763dbc6a8690
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 16 14:35:48 2018 +0200

    acd_start function added

    This function will allocate a struct for the acd module if one wasn't
    added with acd_set_struct. It will then initialize the acd struct
    and start the probe wait timer (for now fixed).

commit e439f6dffc44e93078a2976783bdebfe17304d8c
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 16 14:22:39 2018 +0200

    ACD_DEBUG define added for enabling / disabling debug messages.

commit 80d33e1eaf092934ace1045fac096464cd5be5e9
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 16 11:39:37 2018 +0200

    ACD struct added together with set struct function

    ACD needs some variables: state, timing, probe counter etc.
    We added the struct as netif data. For now one ACD module per netif
    is enough. We found some unclarities about ACD with multiple IP
    address on one interface. For now, ACD will only be implemented for
    the IP address that is going to be used / is being used on the netif.

commit 2c4cca36744973318c3efe7cbae6384b52dc71a8
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Mon Jul 16 11:35:06 2018 +0200

    Add acd timer to timeouts.c with interval of 100ms.

    This timer will be used for time to wait counting etc.
    Very similar to the auto ip timer.

commit e2ed447e00c4df790df21509acb4ab09b5b79e66
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Fri Jul 13 16:56:39 2018 +0200

    Add ACD protocol definitions

commit 445733214460eae18817556439bed979e9b3747c
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Fri Jul 13 16:07:58 2018 +0200

    Add c++ option (to use C code module in c++)

commit 63d78bc1f77ac6698c3d663a1c67b40a0c297125
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Fri Jul 13 15:57:34 2018 +0200

    Added on off option for ACD module

commit d5ec4b69eb4175d4dd569bcfc80ae0e192780015
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date:   Fri Jul 13 15:09:40 2018 +0200

    ACD IPv4 module files added

    The files for IPv4 ACD or Address Conflict Detection are added
    to the lwip source.
2018-10-04 17:34:44 +02:00
Martine Lenders
a47d30ffc7 lowpan6.c: Fix IEEE 802.15.4 address setting
Reverts a regression introduced in
3a8af612b3b818a89de5846cc9b046756af184cc:

Use hardware address fetched from neighbor cache *not* the hardware
address of the interface as destination address.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-03 14:38:58 +02:00
Dirk Ziegelmeier
4b672a1f3c Adapt several comments to contrib rep move 2018-10-02 12:42:14 +02:00
Dirk Ziegelmeier
8068aab9f7 Commit new version info in doxygen file and init.h 2018-10-02 12:35:06 +02:00
Dirk Ziegelmeier
dd1ab2bf59 lwIP 2.2.0 development cycle start now 2018-09-30 09:02:15 +02:00
Simon Goldschmidt
e6a8415df3 Prepare 2.1.0 release
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-09-26 21:11:39 +02:00
Simon Goldschmidt
54a8112eb9 Documentation improvements for 2.1.0 (changelog, altcp) 2018-09-26 14:37:52 +02:00
Simon Goldschmidt
b9fc8cae68 Documentation improvements for 2.1.0 (mainly altcp/altcp_tls) 2018-09-24 22:44:32 +02:00
Simon Goldschmidt
a044c807f8 altcp_tls: rename altcp_tls_new -> altcp_tls_wrap, add altcp_tls_new
The new altcp_tls_new() is a type safe version of altcp_tls_alloc()

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-09-24 22:29:54 +02:00
Simon Goldschmidt
6229f9ef71 icmp_send_response: fix parameter order for LWIP_HOOK_IP4_ROUTE_SRC 2018-09-17 21:28:50 +02:00
Simon Goldschmidt
66838a70f3 more documentation preparations for v2.1.0 release 2018-09-17 21:16:58 +02:00
Simon Goldschmidt
0189e7b02f mqtt: allow user + pass longer than 255 chars
See bug #54655:
"MQTT brokers such as Google Cloud IoT Core requires MQTT clients
to send JSON Web Token (JWT) as password field of the MQTT Connect
packet. JWT can be more than 255 bytes.
Currently, the MQTT library restricts password to be less than 256
bytes, thus it prevents connectivity to Google Cloud IoT Core."

Fix that by just converting the local variables for these from u8_t
to u16_t.

Suggested-by: Richmond Umagat <richmond.umagat@brtchip.com>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-09-13 14:59:08 +02:00
Dirk Ziegelmeier
796f98beb2 Fix no newline at end of http_client.c 2018-09-12 22:41:07 +02:00
Simon Goldschmidt
fc24d4139f altcp_tls_mbedtls: convert #error on too small TCP_WND to warning
Many TLS use cases are OK with a small TCP_WND, so don't prevent these
by having a preprocessor check that cannot be disabled.
2018-09-12 22:24:05 +02:00
Simon Goldschmidt
bbf80b05c8 ppp: fix implicit conversion from size_t to u8_t
Found when compiling with VS2017
2018-09-12 22:22:10 +02:00
Simon Goldschmidt
bc48eb512e Fix bug #54506 (LWIP_CHECKSUM_ON_COPY causes wrong checksum (0xFFFF))
one's complement sum was not correctly done, which could result in the
checksum being 0xFFFF instead of 0 in some cases.
2018-09-12 21:56:16 +02:00
Dirk Ziegelmeier
cdfa3dfa9d http_client.c: Fix compile when TCP is disabled 2018-09-12 08:27:43 +02:00
Dirk Ziegelmeier
be18fa98e4 Fix cleanup of existing documentation of target lwipdocs 2018-09-11 08:16:01 +02:00
Dirk Ziegelmeier
257dc1d6fd Fix doxygen warnings in altcp_proxyconnect.c 2018-09-10 13:30:50 +02:00
Dirk Ziegelmeier
236d6df495 Fix lwipdocs target in Filelists.cmake
EXCLUDE_FROM_ALL is not supported at add_custom_target()
2018-09-10 13:28:01 +02:00
Simon Goldschmidt
93b2074f2b Remove LWIP_DHCP_CHECK_LINK_UP define as it's useless
See bug #54574

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-09-07 21:01:32 +02:00
Simon Goldschmidt
7749088a83 Fix 2way-auth connections for TLS clients
TLS clients that need 2-way authentication (e.g. Amazon AWS IoT cloud mqtt)
need to pass a certificate and private key when creating the tls altcp_pcb.

Added a new function altcp_tls_create_config_client_2wayauth() for this that
replaces altcp_tls_create_config_client() for such clients.

See bug #54601.
2018-09-07 20:59:31 +02:00
Dirk Ziegelmeier
24fc93e12f Remove checks that the SO_* socket options and SOF_* lwIP-internal flags match
not needed any more since commit b0344518e8
"sockets.c: Don't rely on #defines in socket.h to be in sync with ip.h
Map SO_* to SOF_* #defines"

Reported by Joan Lledó on mailinglist 6.Sep.2018
2018-09-07 10:01:59 +02:00