Closed pho closed 2 years ago
Thanks @pho for reporting this issue, indeed the dhcp_cb
pointer should be restored after we dhcp_release_and_stop()
and dhcp_start()
again.
Please find the WIP patch attached below dhcp-Restore-dhcp_cb-on-restart-after-dhcp_release_a.patch.txt
On a DHCP lease renewal failure, the lwIP does a
dhcp_release_and_stop()
and then adhcp_start()
https://github.com/espressif/esp-lwip/blob/2.1.2-esp/src/core/ipv4/dhcp.c#L462The call to
dhcp_start()
zeroes the dhcp struct, thus removing thedhcp_set_cb()
callback, and even though the interface can obtain a new IP when the dhcp server comes back, it never notifies the app again https://github.com/espressif/esp-lwip/blob/2.1.2-esp/src/core/ipv4/dhcp.c#L850