Commit Graph

42 Commits

Author SHA1 Message Date
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
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 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
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
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
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
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 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
xueyunfei 1ae1723d23 dhcp server:bugfix softap excedes the range of subnet 2022-12-16 14:25:04 +08: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
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
David Cermak 05911fd4a1 lwip: Add dhcp servers post processing hook
In order to access DHCP messages from clients in different states
and possibly to implement custom handlers that alter the current state,
e.g. reject a client with specific hostname using NAK.
2022-01-26 07:18:48 +01:00
David Cermak e3d71c984a lwip: Add client's MAC addr to dhcp server cb
* Extended storage for staipassigned events to pass client's MAC address.
* Added client's MAC to dhcp server callback
* Posting the staipassigned events with clients IP and MAC address
2022-01-25 13:08:43 +01:00
David Cermak 96911fb7ea lwip: Fix DHCP Server to remove clients record if request not acked
When client's request refused by sending NAK, its record still resided
in the linked list of pooled addresses. It is okay from the spec
perspective (RFC2131.p16: Server MAY mark the offered address
unavailable), but would consume some memory if the client didn't retry.

Closes https://github.com/espressif/esp-idf/issues/6410
2021-06-24 15:10:24 +08:00
Angus Gratton 66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
David Cermak fa57bdbdbe dhcpserver: make subnet mask configurable
Closes https://github.com/espressif/esp-idf/issues/4988
2020-04-30 14:04:22 +00:00
David Cermak 72d54b68a6 lwip: dhcp-server fix static analysis warnings
1) kill_oldest_dhcps_pool() is only called when list has at least two members (assured with kconfig value limit), added assertion to ensure this function is used only when prerequisities are met
2) use after free reported in two places, since the analyzer checks also the scenario when the linked list has loops, added ignore tags
2020-03-27 18:46:39 +01:00
David Cermak ffe043b1a8 esp_netif: Introduction of esp-netif component as a replacement of tcpip_adpter
- provides object oriented access to network intefaces
- not limited to default netifs
- more generic abstraction to network input output functions
- event handler registration removed from component responsibility
- backward compatibility layer for legacy tcpip_apapter APIs

Closes IDF-39
2019-11-13 12:36:25 +01:00
Anton Maklakov afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
zhangyanjiao fa2998d70b dhcpserver: suppress send_nak debug output
Closes https://github.com/espressif/esp-idf/issues/2924
2019-03-14 14:00:35 +08:00
zhangyanjiao 27cc0d1f91 modify the behavior for dhcpserver and tcpip_adapter:
1. dhcp_server: suppress send_offer debug output
2. tcpip_adapter: zero-initialize system_event_t structures
3. tcpip_adapter: pass client IP address along with SYSTEM_EVENT_AP_STAIPASSIGNED

Closes https://github.com/espressif/esp-idf/issues/2924
Closes https://github.com/espressif/esp-idf/issues/2949
2019-03-11 12:11:05 +08:00
Zhang Yan Jiao 3578fe39e0 Feature/sync lwip as submodule 2018-09-06 19:43:08 +08:00