Commit Graph

88 Commits

Author SHA1 Message Date
David Cermak
64f4f0ac1e esp_netif/lwip: Use netif-client-data to store esp_netif ptr
lwip/netif struct has two places to store user's data
* netif->state (1 void*) but that might be occupied in special cases
* netif->client_dtat (n void*s) but that must be enabled in opts.h
This commit stores esp_netif_t* primarily in state, but if any special
netif is enabled in menuconfig (bridgeif, pppos), it uses netif->client_data.
This commit also fixes incorrect esp_netif that is attached to
IP_EVENT_GOT_IP6 event posted by pppos interfaces in:
c585618b97/components/esp_netif/lwip/esp_netif_lwip_ppp.c (L114)

Closes https://github.com/espressif/esp-idf/issues/9345
2022-07-27 11:55:18 +00:00
David Cermak
58b0def0d9 lwip: Fix on-demand timers to update internal system touts
If on-demand timers (IGMP+MLD6) were enabled, idf updated user config
MEMP_NUM_SYS_TIMEOUT. The implementation of these timers are in lwip
project so the internal system timeout shall be updated accordingly,
enabling port layers to modify MEMP_NUM_SYS_TIMEOUT.

Closes https://github.com/espressif/esp-idf/issues/9150
2022-07-14 05:09:53 +00:00
Ondrej Kosta
53082a22f7 esp_netif: added support for LwIP bridge
examples: created bridge example
2022-06-14 15:29:44 +02:00
David Cermak
c67f4c2b4c lwip: Remove vanilla-lwip config until it's fully deployable 2022-06-02 20:45:24 +02:00
David Cermak
7efcb5e625 lwip: Add missing null-checks, rename to vanilla-lwip 2022-06-01 20:38:40 +02:00
David Cermak
e7f19f39bc lwip: Fix the CI 2022-05-18 17:11:35 +02:00
David Cermak
a6154a5f10 lwip: Update default MEMP_NUM_SYS_TIMEOUT if timers on-demand 2022-05-18 17:11:35 +02:00
David Cermak
5d6afa3c4b dhcp: Implement additional dhcp options 2022-05-18 17:11:35 +02:00
David Cermak
1564e8d5a9 lwip: Implement DHCP hook supporting MTU option 2022-05-18 17:11:35 +02:00
David Cermak
b6eb9002a8 add dhcp custom values 2022-05-18 17:11:35 +02:00
David Cermak
356bc603c4 lwip: Support DHCP restore last IP 2022-05-18 17:11:35 +02:00
David Cermak
53c009e626 lwip: Update socket API to include port-version of sockets/netdb
Added socket extention to the lwip hooks for implementing non-vanilla
{get/set}sockopts()
2022-05-18 17:10:42 +02:00
David Cermak
dbc91f73e6 lwip: Use custom pbufs for eth and wifi port/netif 2022-05-18 17:10:42 +02:00
David Cermak
65bf5f2b10 lwip: Add mem-heap options to support ALLOCATION_FROM_SPIRAM_FIRST 2022-05-18 17:10:42 +02:00
David Cermak
808ac7427a lwip: Add freertos sys-arch port layer
Added sys_thread_sem_func(), sys_sem_signal_isr(), g_lwip_task
2022-05-18 17:10:42 +02:00
David Cermak
5b471a1848 esp_netif/lwip: Implement basic support for vanilla-lwip (2.1.3-REL)
* Reference lwip-2.1.3-REL vanilla lwip version
* Use inherent NETIF callbacks instead of dhcp/ipv6/autoip
2022-05-18 17:10:42 +02:00
Darian Leung
e08d574a5d lwip: Update AFL host test mock
This commit updates and refactors the AFL host test mock as follows:
- Isolates the mock so that it only relies on lwip component and linux stdlib headers
- Grouped all mock functions in 'esp32_mock.h/c'
- Updates the lwip esp32 port files to include 'esp32_mock.h' when building for linux
- Use host stdlib headers instead of xtensa stdlib headers
2022-04-29 15:11:44 +08:00
David Čermák
3692b15965 Merge branch 'feature/lwip_dns_debug_logs' into 'master'
lw-IP: Add DNS debug option.

Closes IDFGH-7076

See merge request espressif/esp-idf!17668
2022-04-06 21:59:09 +08:00
Mengsk
42efbb1a57 Add lwip dns debug option. 2022-03-30 15:45:56 +02:00
David Cermak
c005b04d1c lwip/dhcps: Support for dynamic dhcp server instances 2022-03-13 19:39:21 +01:00
David Cermak
92f7ecd632 lwip: Security fixes; PPPoS null-deref; NAPT ip-forward
* Cherry-pick important fixes to 2.1.2-esp
  - CVE-2020-22283: Attacker could craft a packet that would disclose 8 bytes of some heap memory:
    - icmp6: Don't copy too much data
    - icmp6: Fix copying of chained pbuf in reply
    - icmp6: keep to the RFC and send as much as possible with icmp6 error messages
  - CVE-2020-22284: ZEP - ZigBee Encapsulation Protocol/6LoWPAN is not supported in IDF,
    the netif module (zepif.c) is not included in the build, but users can still inject
    the file into compilation process, implement IO interface and use this.
    - zepif: Copy possibly chained output pbuf properly
    - Add #define for minimum IPv6 MTU length
    - pbuf: Add pbuf_copy_partial_pbuf library function
* PPPoS: Fix null-deref when processing double break packet
  - pppos: fix in_tail null (espressif/esp-lwip@537c69d5)
  - PPP: Add test exhibiting empty packet null-deref (espressif/esp-lwip@202a07da)
* NAPT: Fix PBUF_REF type to clone the pbuf before forwarding
  - IP-FORWARD: If packet-type is PBUF_REF clone it before forwarding
  - Add NAPT unit test to exercise NAT feature for both RAM and REF pbuf types
* version: Update version numbers to match 2.1.2-esp

* Update submodule: 2749568fe1...76303df238
  - test/napt: Add unit test for IP forward with PBUF_REF (espressif/esp-lwip@76303df2)
  - napt: Fix PBUF_REF type to clone the pbuf before forwarding (espressif/esp-lwip@39068263)
  - version: Update version numbers to match 2.1.2-esp (espressif/esp-lwip@2b922919)
  - pppos: fix in_tail null (espressif/esp-lwip@537c69d5)
  - PPP: Add test exhibiting empty packet null-deref (espressif/esp-lwip@202a07da)
  - pbuf: Add pbuf_copy_partial_pbuf library function (espressif/esp-lwip@1c9cd9c1)
  - Add #define for minimum IPv6 MTU length (espressif/esp-lwip@d2dc577b)
  - zepif: Copy possibly chained output pbuf properly (espressif/esp-lwip@64ab7f2a)
  - icmp6: Don't copy too much data (espressif/esp-lwip@4a64731b)
  - icmp6: Fix copying of chained pbuf in reply (espressif/esp-lwip@7c822ff4)
  - icmp6: keep to the RFC and send as much as possible with icmp6 error messages (espressif/esp-lwip@29100ab6)
  - dns: Add API to clear dns cache (espressif/esp-lwip@ee59f77d)
  - CI: Fixed adding gitlab key (espressif/esp-lwip@5a2bdba7)
  - test case: modify test case test_tcp_new_max_num_remove_FIN_WAIT_1 (espressif/esp-lwip@6b090f7d)

Closes https://github.com/espressif/esp-idf/issues/8300
Closes https://github.com/espressif/esp-idf/issues/8451
2022-03-08 09:38:42 +01:00
Sudeep Mohanty
a9fda54d39 esp_hw_support/esp_system: Re-evaluate header inclusions and include directories
This commit updates the visibility of various header files and cleans up
some unnecessary inclusions. Also, this commit removes certain header
include paths which were maintained for backward compatibility.
2022-03-07 11:18:08 +05:30
David Cermak
5d7489eae4 lwip: Fix minor lwip dependency issue
Clean-up config option rename file
2022-01-14 16:41:38 +01:00
David Cermak
cfc52bacbc lwip: Cleanup lwipopts flags and options
* Removed unused and flags
* Fixed comments
* Order of flags lwip/esp-specific
* Used 1/0 logic for boolean flags
2022-01-14 16:41:38 +01:00
Liu Han
49cd81ccf3 lwip/dhcp: add configure for enable vendor class identify option
Closes https://github.com/espressif/esp-idf/issues/6786
2021-10-22 11:17:59 +08:00
yuanjm
9e2f15ae51 lwip: Support DHCP option length configuration 2021-09-18 17:24:27 +08:00
David Cermak
213727c4f2 lwip: IPv6: Add support for DHCPv6 stateless config
Closes https://github.com/espressif/esp-idf/issues/5245
2021-09-07 14:48:21 +08:00
Jiang Jiang Jian
cec0f5edfb Merge branch 'optimization/config_option_LWIP_TCPIP_CORE_LOCKING' into 'master'
optimization config option LWIP_TCPIP_CORE_LOCKING

Closes IDF-2478

See merge request espressif/esp-idf!11809
2021-08-25 08:52:43 +00:00
David Cermak
e54523708d Merge branch 'master' into feature/lwip_sntp_max_servers 2021-08-24 18:16:07 +02:00
David Cermak
457d837b40 lwip: Fix sntp custom options if sntp_get_system_time used 2021-08-23 11:47:44 +02:00
xueyunfei
0d07569fff optimization config option LWIP_TCPIP_CORE_LOCKING 2021-08-18 21:32:13 +08:00
Emil Muratov
34be62665c lwip: menuconfig option to enable ntp servers option request via DHCP
This could be toggled on/off, off is the default.
SNTP debug option. Example update for ntp via DHCP

Signed-off-by: Emil Muratov <gpm@hotplug.ru>
2021-08-02 01:21:35 +03:00
Emil Muratov
80810971c8 lwip menuconfig option for max number of SNTP servers
LWIP has two definess for setting max number of sntp servers:
 - Total number of handled servers
 - max number of sntp's picked via DHCP

by default both values are equal to 1, but could be set separately

Signed-off-by: Emil Muratov <gpm@hotplug.ru>
2021-07-27 22:38:36 +03:00
David Čermák
f86140eb8d Merge branch 'feature/add_rdnss_kconfig' into 'master'
lw-ip: Add ND6 RDNSS DNS server Kconfig option

Closes IDFGH-5209

See merge request espressif/esp-idf!14090
2021-06-24 18:51:43 +00:00
liuhan
7d5ae1ee26 esp_netif: Add CONFIG_LWIP_DHCPS to sperate the code 2021-06-24 09:49:45 +08:00
yuanjm
b0e1a8e752 lwip: Add ND6 RDNSS DNS server Kconfig option
Closes https://github.com/espressif/esp-idf/issues/6982
2021-06-23 10:09:26 +08:00
liuhan
2d80c122b1 lwip: Add CONFIG_LWIP_ICMP and CONFIG_LWIP_ICMP6 to sperate the code 2021-06-21 15:14:19 +08:00
David Cermak
49022e99f5 lwip: Add config for DHCP client id; Fix DNS server idx assert issue
This commit brings two esp-lwip fixes to IDF:

1) Add configuration to disable DHCP client identification
2195f7416f
This config could be used to disable option 61 in DHCP packets, so that
clients will be identified by their  chaddr only.
(This is the lwip upstream original behaviour)

2) Fix server_idx increasing to DNS_MAX_SERVERS and trigger the LWIP_ASSERT
5a567d52f7
When lwip doesn't have DNS server and resolve a domain address, the server_idx
will increase to DNS_MAX_SERVERS, which will trigger the LWIP_ASSERT and make device crash.

Closes https://github.com/espressif/esp-idf/issues/6878
2021-05-07 14:11:51 +02:00
Jiacheng Guo
fd3553b66d lwip: add config options for Thread IPv6 border routing 2021-04-22 06:13:47 +00:00
yuanjm
ef7583517d lwip: Fix LWIP_DEBUG define which is always defined 2021-04-12 14:41:46 +00:00
David Cermak
d6f66465ff lwip: Made LCP ECHO bool for better user experience 2021-04-09 06:53:30 +00:00
xueyunfei
181e87d700 bugfix for assert when tcp send data 2021-03-31 08:59:22 +00:00
David Čermák
3bc3407aeb Merge branch 'bugfix/lwip_ppp_echo_interval_config' into 'master'
lw-IP: added configuration values for echo interval

Closes IDFGH-3098

See merge request espressif/esp-idf!12487
2021-03-18 11:59:07 +00:00
Jiri Schiebel
ece7cb4545 lwip: added configuration values for echo interval 2021-03-17 17:54:30 +00:00
Jiri Schiebel
0c58d5fc6a lwip: added config option to enable LWIP_NETIF_API 2021-03-17 17:53:07 +00:00
yuanjm
d80db218da lwip: Add LWIP_IPV6 macro to strip IPv6 function in LWIP component 2021-02-23 18:26:03 +08:00
xueyunfei
b50fca4aa0 optimization dhcp key state transition message 2021-01-25 03:54:20 +00:00
Krzysztof Budzynski
e277d8ef23 Merge branch 'bugfix/esp_sntp_header' into 'master'
docs: Add esp_sntp to API reference as it's default idf header

Closes DOC-854

See merge request espressif/esp-idf!11796
2021-01-13 10:28:39 +08:00
David Čermák
76f6dd6214 lwip: Moved default SNTP API to esp_sntp.h
and make sntp.h in port folders of lwip component obsoleted
2021-01-13 10:28:34 +08:00
David Cermak
9ffa9cce73 lwip: Add warning to use ESP_IDF_LWIP_HOOK_FILENAME if LWIP_HOOK_FILENAME defined 2021-01-08 14:28:21 +00:00