Description
Related area
WiFi softAP DHCP
Hardware specification
ESP32
Is your feature request related to a problem?
When several Wi-Fi stations are connected to an ESP's softAP and the ESP reboots, it can happen that some stations hold on to their old DHCP lease. However, the DHCP server does not know and re-assigns such still-in-use IP addresses. As a workaround for the problem, the DHCP server could use a different IP range after each restart (i.e. cycling through several ranges), but this requires the possibility of configuring the DHCP server.
Describe the solution you'd like
Possibility of configuring the DHCP server:
*) Adding IPAddress argument to softAPConfig:
bool softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dhcpstart);
(can be an optional argument using a default value, or the current 3-argument version softAPConfig(local_ip,gateway,subnet) calls the extended 4-argument version)
*) This requires adding an argument to set_esp_interface_ip:
esp_err_t set_esp_interface_ip(esp_interface_t interface, IPAddress local_ip=IPAddress(), IPAddress gateway=IPAddress(), IPAddress subnet=IPAddress(), IPAddress dhcpstart=IPAddress());
An implementation could look like this:
dhcps_lease_t lease;
lease.enable = true;
lease.start_ip.addr = static_cast<uint32_t>(dhcpstart);
lease.end_ip.addr = static_cast<uint32_t>(dhcpstart) + (10 << 24);
instead of
lease.start_ip.addr = static_cast<uint32_t>(local_ip) + (1 << 24);
lease.end_ip.addr = static_cast<uint32_t>(local_ip) + (11 << 24);
This extension would help me (and probably some others) a lot.
Thanks for all your great work,
Christian
Describe alternatives you've considered
No response
Additional context
No response
I have checked existing list of Feature requests and the Contribution Guide
- I confirm I have checked existing list of Feature requests and Contribution Guide.
Metadata
Metadata
Assignees
Type
Projects
Status