It seems the configured dhcps->dhcps_lease_time was multiplied by a factor when offering. Wouldn't this cause mismatch of the LWIP DHCP pool retention time and the client lease time? i.e., LWIP only offers 5 minutes of lease but the client was told the lease time is 300 minutes.
If I want to change the default lease time, what is the correct way?
idf.py menuconfig and set LWIP_DHCPS_LEASE_UNIT to 7200 (because the default lease time is 120, 864000/120 ==7200)
P.S. The description of LWIP_DHCPS_LEASE_UNIT is not very clear to me:
The DHCP server is calculating lease time multiplying the sent and received times by this number of seconds per unit. The default is 60, that equals one minute.
According to the FAQ, the unit of ESP_NETIF_IP_ADDRESS_LEASE_TIME is minute. I will stick to this method. But it does not answer whether the dhcp server and client would having different lease time.
Answers checklist.
General issue report
DHCPS_LEASE_UNIT
was defined in https://github.com/espressif/esp-idf/blob/bdb9f972c6a1f1c5ca50b1be2e7211ec7c24e881/components/lwip/include/apps/dhcpserver/dhcpserver.h#L68DHCPS_LEASE_UNIT
's usage: https://github.com/espressif/esp-idf/blob/bdb9f972c6a1f1c5ca50b1be2e7211ec7c24e881/components/lwip/apps/dhcpserver/dhcpserver.c#L429-L432It seems the configured
dhcps->dhcps_lease_time
was multiplied by a factor when offering. Wouldn't this cause mismatch of the LWIP DHCP pool retention time and the client lease time? i.e., LWIP only offers 5 minutes of lease but the client was told the lease time is 300 minutes.If I want to change the default lease time, what is the correct way?
call
esp_netif_dhcps_option
idf.py menuconfig
and setLWIP_DHCPS_LEASE_UNIT
to 7200 (because the default lease time is 120, 864000/120 ==7200)P.S. The description of
LWIP_DHCPS_LEASE_UNIT
is not very clear to me:what is
the sent and received times
?