Commit Graph

114 Commits

Author SHA1 Message Date
David Čermák 4a59e94b4e Merge branch 'fix/lwip_dhcps_fuzz' into 'master'
[lwip]: Fix dhcp server minor issues found when fuzzing

See merge request espressif/esp-idf!42315
2025-10-24 04:41:24 +08:00
David Cermak 4709069e13 fix(lwip): Fix dhcp-server to use callback only if configured 2025-10-23 13:49:21 +08:00
David Cermak 0cc53db591 fix(lwip): Fix dhcp-server to mem_free() items allocated by mem_alloc() 2025-10-23 13:49:21 +08:00
David Cermak 18907c2c8f fix(lwip): Remove deprecated ping wrappers over lwip raw api 2025-10-20 17:51:39 +08:00
Abhik Roy d574382d7b feat(lwip): Remove deprecated LWIP_DHCPS_ADD_DNS Kconfig option 2025-09-29 21:26:01 +08:00
David Cermak 75e0d62739 feat(lwip/dhcps): Add support for reporting clients hostname 2025-09-26 07:54:20 +02:00
wangtao@espressif.com 40adbf5fa9 fix(dhcp): fix dhcp server recv decline issue 2025-03-14 10:45:48 +08:00
Abhik Roy b3523a6fbe fix(dhcps): Fixed DNS server handling for previous breaking changes 2025-02-17 13:19:28 +11:00
Lorenzo Consolaro 0fd3984c72 feat(dhcps): Support for multiple DNS servers 2025-02-17 13:15:03 +11:00
David Cermak 42d2a131f6 fix(lwip): Remove if_indextoname() impl in favor of LWIP_NETIF_API
ESP-IDF already hardcodes LWIP_NETIF_API=1, so the related netif APIs are
defined unconditionally.
2025-02-10 19:34:57 +08:00
David Cermak b46b3d1c1d fix(lwip): Fix potential data-race in ping tcpip callback
Need to use tcpip_api_call() instead of tcpip_callback(), since the
former waits for the tcpip task to complete and thus prevents potential
data races with subsequent TCP/IP tasks.
2025-01-22 21:13:57 +08:00
David Cermak c5955f8cf6 fix(lwip): Fix ping session calling thread unsafe API
Closes https://github.com/espressif/esp-idf/issues/14982
2024-12-20 08:09:22 +01:00
Abhik Roy d846929dc3 feat(lwip): Added wrapper for getaddrinfo to handle AF_UNSPEC 2024-11-22 13:06:34 +11:00
David Cermak 8b191dd7a1 fix(lwip): Fix ping_v6 receiving to accept only echo replies
This fixes a bug where we ping our own IP and the request itself
bounces back to the raw receive function and is incorrectly treated as
reply. (this bug was discovered when fixing ICMPv6 pings with incorrect
checksums, while the ping request was dropped in icmpv6.c due to wrong
checksum, but was also fed to raw layers where it was treated as
"correct" response, so the PINGv6 to ourselves still worked)
2024-11-08 12:21:35 +01:00
David Cermak 649816d9a1 fix(lwip/dhcps): Fallback DNS option to DHCP server's IP by default
Adds backward compatibity option CONFIG_LWIP_DHCPS_ADD_DNS, which
prevents breaking changes.
This option should be removed in IDF v6.0

Merges https://github.com/espressif/esp-idf/pull/14132
2024-10-07 21:07:57 +11:00
Showier Drastic 484a2d6d6c feat(lwip/apps): only hand out DNS in DHCP if explicitly specified 2024-10-07 21:07:01 +11:00
Abhik Roy 53ba6e97cd fix(example): Fixed updating recv addr for invalid packets for ping
Closes https://github.com/espressif/esp-idf/issues/14197
2024-08-13 21:51:58 +10:00
zhangyanjiao eaef3a2683 fix(lwip): fixed the dhcp pool error on dhcp server 2024-05-27 14:51:00 +08:00
David Čermák 31253679d9 Merge branch 'bugfix/bind_dhcps_netif' into 'master'
fix(lwip/dhcp_server): Bind dhcps netif to avoid handling the dhcp packet from other netif

See merge request espressif/esp-idf!30537
2024-05-09 19:44:19 +08:00
jkingsman 3035ce294d feat(esp_netif): add support for DHCP Option 114 captive portal URI
DHCP Option 114 provides a modern method of indicating a captive
portal redirect to DHCP client. This introduces Option 114 to
the DHCPS component as well as provides examples for usage.
2024-05-02 22:50:09 +08:00
Xu Chun Guang 294b418686 docs: Correct spell error in comment 2024-04-28 17:48:04 +08:00
Xu Chun Guang 226c7772b8 fix(lwip/dhcp_server): Bind dhcps netif to avoid handling the dhcp packet from other netifs 2024-04-28 16:28:48 +08:00
David Cermak c30f2825d5 fix(netif): Add missing SNTP get-reachablitiy API 2024-02-29 23:37:45 +08:00
zhangyanjiao 04ea824740 fix(lwip): Modify the DHCP offer and DHCP ack from broadcast to unicast 2023-10-09 17:52:01 +08:00
xueyunfei fff7c6a399 fix(dhcp server):fix set dhcp server poll fail issue 2023-09-13 10:20:02 +08:00
David Cermak c510560890 lwip: Fix print format -Wformat issues 2023-08-15 11:01:01 +02:00
xueyunfei 15be9a0c3a fix(dhcp server): Fix dhcp server address pool issue 2023-07-25 20:48:19 +08:00
Ondrej Kosta 3288f83401 feat(network/examples): extended LwIP bridge example
Extended LwIP bridge example to support WiFi AP interface and DHCP Server

https://github.com/espressif/esp-idf/issues/5697
2023-06-30 14:38:24 +02:00
wuyuanyi135 97c44ee95d Fix incorrect invocation of the hook LWIP_HOOK_DHCPS_POST_APPEND_OPTS
Fix https://github.com/espressif/esp-idf/issues/11373
2023-05-10 19:52:40 +08:00
Jiang Jiang Jian df6b33712f Merge branch 'Bugfix/softap_support_CIDR' into 'master'
Bugfix for softap support CIDR

Closes IDFGH-8574

See merge request espressif/esp-idf!22471
2023-03-02 14:03:00 +08:00
David Čermák 956e62c461 Merge branch 'feature/lwip_ipv6_only' into 'master'
lwip: Support IPv6 only mode

Closes IDF-6023

See merge request espressif/esp-idf!20468
2023-03-01 21:38:10 +08:00
David Cermak 5f6cb31105 lwip: Support IPv6 only mode 2023-02-27 08:53:34 +01:00
xueyunfei 4f0732cf05 Fixed bug for dhcp server support CIDR
Closes https://github.com/espressif/esp-idf/issues/10024

Closes https://github.com/espressif/esp-idf/issues/10559
2023-02-24 14:24:49 +08:00
David Cermak 708641204e lwip: Add missing esp_sntp_enabled() 2023-02-24 07:23:55 +01:00
David Cermak e8ee09d817 lwip/sntp: Fix esp_sntp_ API races
Some of the esp_sntp_...() APIs that wrap lwip's SNTP
module use tcpip_callback() to execute the lwip functionality
in the correct state (either with locked TCP/IP core,
or within the TCP/IP thread).
tcpip_callback() however doesn't wait for completion of the callback,
which doesn't prevent from using the stack variables after destroy
if used as a parameter.
Introduced in a71fa82.
Fixed by using of tcpip_api_call() instead of the tcpip_callback().

Closes https://github.com/espressif/esp-idf/issues/10611
2023-01-31 18:25:35 +01:00
David Cermak fa97004faf lwip: Support for linux target
Implement linux port layer and reuse the original FreeRTOS layer
that's compiled and used on linux target as well, by means of FreeRTOS
simulator.
2023-01-31 08:43:45 +01:00
David Cermak a71fa82177 esp_netif/lwip: Fix core-locking config
* Fix thread safety issues in non-core locking
* Add option to verify thread safety issues in lwip (core-lock assertion)
* Make esp_sntp.h thread safe API
* Fix sntp examples
* Fix openthread libs

Closes https://github.com/espressif/esp-idf/issues/9908
Closes https://github.com/espressif/esp-idf/issues/10502
Closes https://github.com/espressif/esp-idf/issues/10466
2023-01-17 16:15:58 +01:00
xueyunfei 1ae1723d23 dhcp server:bugfix softap excedes the range of subnet 2022-12-16 14:25:04 +08:00
David Cermak 9e31c5077d lwip: Document 32 bit NTP timestamp converstion to 64b time_t 2022-09-21 17:38:37 +02:00
David Cermak b5d13b9837 lwip/dhcpserver: Support for adding extra opts
This enables users appending an extra, user defined options in dhcp
server messages. Example of adding captive_portal option (160) to dhcp
offer message is provided:
* Add idf-lwip hook file (project makefile):
  idf_component_get_property(lwip lwip COMPONENT_LIB)
  target_compile_options(${lwip} PRIVATE "-I${PROJECT_DIR}/main")
  target_compile_definitions(${lwip} PRIVATE "-DESP_IDF_LWIP_HOOK_FILENAME=\"add_captive_portal.h\"")
* Implement appending (add_captive_portal.h):
  #pragma once
  #define LWIP_HOOK_DHCPS_POST_APPEND_OPTS(netif, dhcp, state, pp_opts) \
  if ((state)==DHCPOFFER) { *(pp_opts) = append_captive_portal_uri(*(pp_opts)); }
  static inline uint8_t *append_captive_portal_uri(uint8_t *optptr)
  {
    const static uint8_t DHCP_OPTION_CAPTIVE_PORTAL=160;
    const static char CAPTIVE_PORTAL_URI[]="my_uri";
    int size = sizeof(CAPTIVE_PORTAL_URI) - 1;
    *optptr++ = DHCP_OPTION_CAPTIVE_PORTAL;
    *optptr++ = size;
    for(int i = 0; i < size; ++i) {
        *optptr++ = CAPTIVE_PORTAL_URI[i];
    }
    return optptr;
  }

Merges https://github.com/espressif/esp-idf/pull/3308
2022-07-26 07:09:22 +00:00
xueyunfei 45ad770c37 Icmp: get tos parameter in icmp reply 2022-07-05 11:37:41 +08:00
xueyunfei b569f4069a bugfix for add ttl for ping socket 2022-07-05 11:37:41 +08:00
David Cermak 5aa3be11fd dhcpserver: Minor #idfef fix 2022-05-18 17:11:35 +02:00
David Cermak 27375c7917 esp_netif: Cleanup dhcp-server allocations 2022-03-13 19:40:00 +01:00
David Cermak 1b49cf373f lwip/dhcps: Fix fuzzer compilation 2022-03-13 19:40:00 +01:00
David Cermak 3d1c05aefb lwip/dhcps: Add dhcps callback argument for associated netif 2022-03-13 19:40:00 +01:00
David Cermak 5f135741a1 lwip/dhcpserver: Add return value to API that could fail 2022-03-13 19:40:00 +01:00
David Cermak afe6bc0c88 lwip/dhcp_server: Fix mem-leaks caught by UT's 2022-03-13 19:40:00 +01:00
David Cermak c005b04d1c lwip/dhcps: Support for dynamic dhcp server instances 2022-03-13 19:39:21 +01:00
David Cermak bab051f450 lwip/dhcps: Cleanup internal lwip and esp-netif dependency 2022-03-13 19:38:15 +01:00