Commit Graph

6270 Commits

Author SHA1 Message Date
Erik Ekman
379d55044e zepif: Copy possibly chained output pbuf properly
Fixes bug #58554
2021-08-15 10:57:17 +02:00
Erik Ekman
843a116155 pbuf: Add pbuf_copy_partial_pbuf library function
Like pbuf_copy, but can copy part of a pbuf to an offset in another.
pbuf_copy now uses this function internally.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2021-08-15 10:56:50 +02:00
Simon Goldschmidt
1c6202c414 pbuf: fix allocating large PBUF_RAM
See bug #59974
2021-08-15 10:32:21 +02:00
yuanjm
066a2b022d lwip_selscan: lwip_selscan return -1 without setting errno number
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2021-08-15 10:31:40 +02:00
Simon Goldschmidt
aca41b0beb icmp: Fix copied length in response packets
Fixes bug #59364, reported by Yi Guai
2021-08-15 10:30:20 +02:00
Erik Ekman
b5e8ab6c15 tcp: Fix double free in tcp_split_unsent_seg()
Fixes bug #57377 (found by Hiromasa Ito).
2021-08-15 10:24:47 +02:00
Hannes Gredler
896c8a9f72 tcp_out: fix tcp_output_fill_options() arguments
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2021-08-15 10:23:06 +02:00
Simon Goldschmidt
59ecea3d8c Fix last commit for all netif loopback traffic 2021-08-15 10:20:31 +02:00
Nick Ballhorn-Wagner
b1f8ce8769 fix memory leak in netif_loop_output if tcpip_try_callback fails
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2021-08-15 10:20:11 +02:00
Patrick Schlangen
8c43d83689 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>
2021-08-15 10:17:44 +02:00
Simon Goldschmidt
87d44bbfcd sntp: ensure sntp_retry_timeout reaches the configured limit
See bug #57620

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2021-08-15 10:17:25 +02:00
Simon Goldschmidt
07d3b3330d 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>
2021-08-15 10:17:02 +02:00
Simon Goldschmidt
61349cf124 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
2021-08-15 10:16:40 +02:00
David Girault
7316b26740 sntp: remove existing timeout before creating new
This prevents sntp using more than 2 timeouts.
See bug #56431
2021-08-15 10:15:59 +02:00
Axel Lin
d4b3a006dc 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>
2021-08-15 10:15:38 +02:00
Simon Goldschmidt
2f8886794f 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.
2021-08-15 10:15:05 +02:00
Christoffer Lind
02ab8c91a9 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>
2021-08-15 10:14:19 +02:00
Simon Goldschmidt
74ea1e43ca dhcp: don't use LWIP_ERROR in dhcp_parse_reply()
See bug #56643

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2021-08-15 10:11:33 +02:00
Joan Lledó
e9000658fb IF_NAMESIZE: define it only if it's not defined before by system headers 2021-08-15 10:08:43 +02:00
Simon Goldschmidt
d58e0f1a1a fix compiling unit tests after adding compile-time check for LWIP_NETCONN_FULLDUPLEX 2021-08-15 10:07:58 +02:00
Simon Goldschmidt
674c4ed080 LWIP_NETCONN_FULLDUPLEX is not alpha any more 2021-08-15 10:07:09 +02:00
Dirk Ziegelmeier
a68d6f1a9a Fix bug #56136: The netif->mtu6 was updated by Router Advertisement abnomally
Using patch from Gao Quingahui plus improvement
2021-08-15 10:06:37 +02:00
Dirk Ziegelmeier
c0643e21ed Apply patch for bug #56239: compile fail when disable TCP 2021-08-15 09:43:40 +02:00
Dirk Ziegelmeier
3fbb84f950 Fix bug #55702: SSI bug
Apply patch from Stanislav
2021-08-15 09:41:43 +02:00
Dirk Ziegelmeier
053f5aa10d Fix compile of last patch 2021-08-15 09:40:51 +02:00
Dirk Ziegelmeier
6b9264b49e Fix bug #55972: The Neighbour Solicitation used to do IPv6 address resolution was wrong
Apply patch from Gao Qingshui
2021-08-15 09:40:33 +02:00
Dirk Ziegelmeier
e60f9bb24f Fix bug #55973: The parsing of max response time in MLD Query message was wrong
Apply patch from Gao Qingshui
2021-08-15 09:40:18 +02:00
Simon Goldschmidt
1bb6e7f52d udp_bind: fix missing parenthesis warning
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
(cherry picked from commit 3b5eb7ca90)
2019-02-27 10:31:56 +01:00
Jacob Kroon
108ca1521e 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>
(cherry picked from commit c02fea0961)
2019-02-26 16:26:22 +01:00
Sylvain Rochet
ea2bb9cd5b 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>
(cherry picked from commit 48615984c7)
2019-02-26 16:26:21 +01:00
Jacob Kroon
e6d05db86f 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>
(cherry picked from commit 7eab5947af)
2019-02-26 16:26:21 +01:00
Sylvain Rochet
d1f920a7d1 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>
(cherry picked from commit 96548ede2b)
2019-02-26 16:26:21 +01:00
Simon Goldschmidt
fee64d7515 udp: fix udp_bind for IPADDR_TYPE_ANY
See bug #55171

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
(cherry picked from commit 752cdb1a53)
2019-02-26 16:25:19 +01:00
Jacob Kroon
aad77fcacb Fix compile of UDP unit test
Fix building unit tests via contrib/ports/unix/check on Debian 9, gcc 6.3.0.

Fixes:
  <snip>/ip_addr.h:105:58: error: the comparison will always evaluate as ‘true’ for the address of ‘ip1’ will never be NULL [-Werror=address]
   #define IP_SET_TYPE(ipaddr, iptype)     do { if((ipaddr) != NULL) { IP_SET_TYPE_VAL(*(ipaddr),iptype); }}while(0)

Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
(cherry picked from commit 2f098c42a7)
2019-02-26 16:25:10 +01:00
Dirk Ziegelmeier
bebf072b77 Fix bug #55171: Binding UDP PCB with different IP type PCBs does not work
by additionally checking IP address type

(cherry picked from commit 2ff0db9a9b)
2019-02-26 16:23:06 +01:00
Dirk Ziegelmeier
7f53f7ced4 Add testcase for bug #55171: Binding UDP PCB with different IP type PCBs does not work
(cherry picked from commit 91037b4c28)
2019-02-26 16:23:05 +01:00
Simon Goldschmidt
91a4d59eb4 dhcp_release_and_stop: don't clear netif ip address that was not assigned by dhcp.c
See bug #55380
2019-02-18 13:15:37 +01:00
David Girault
1bd34ea364 altcp_tls: assert in altcp_mbedtls_bio_recv if bad state
(cherry picked from commit 3cb6ae7770)
2019-02-18 13:13:24 +01:00
David Girault
a9a215c52e altcp: support for setting keepalive parameters
(cherry picked from commit b04d8a6a6c)
2019-02-18 13:13:24 +01:00
David Girault
5cea646b12 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)

(cherry picked from commit b298afabdc)
2019-02-18 13:13:10 +01:00
Simon Goldschmidt
ff14bbb3c1 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.

(cherry picked from commit 282389a332)
2019-02-18 13:12:42 +01:00
Simon Goldschmidt
89be04ce7a altcp_tls: add functions to create servers with multiple certificates
(cherry picked from commit 3f583a1757)
2019-02-18 13:12:19 +01:00
Simon Goldschmidt
4b3c59e4cc altcp_tls_mbedtls: add session tickes, improve configuration for session cache
(cherry picked from commit 6f232b7c3f)
2019-02-18 13:12:18 +01:00
Simon Goldschmidt
beeb300c18 altcp_tls_mbedtls: add debug output of mbedtls library
(cherry picked from commit 54448559bb)
2019-02-18 13:12:18 +01:00
Simon Goldschmidt
79732693f3 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>
(cherry picked from commit 153c295b6f)
2019-02-18 13:12:17 +01:00
Simon Goldschmidt
ef3d12c60e altcp_tls: whitespace cleanup 2019-02-18 13:11:27 +01:00
Simon Goldschmidt
608a2f9741 Revert "altcp_tls_mbedtls: implement mbedTLS debug output, comment fixes"
This reverts commit 422623a87b.
2019-02-18 13:09:32 +01:00
Dirk Ziegelmeier
174cc87227 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

(cherry picked from commit e479bd56df)
2019-02-18 13:05:53 +01:00
David J. Fiddes
0d6d8922f2 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>
(cherry picked from commit 8f2f43f093)
2019-02-18 13:02:48 +01:00
David Girault
67350e3c01 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

(cherry picked from commit 2cc420e434)
2019-02-18 13:01:37 +01:00