esp_netif_set_ip_info doesn't always trigger an IP_CHANGED event. (IDFGH-11836) #12927
Closed
3 tasks done
Labels
Resolution: NA
Issue resolution is unavailable
Status: Done
Issue is done internally
Type: Bug
bugs in IDF
Answers checklist.
IDF version.
v5.1.2-2-g11f9b315f7 (2 commits are unrelated phy changes, separate PR)
Espressif SoC revision.
ESP32
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
custom
Power Supply used.
External 3.3V
What is the expected behavior?
When I use esp_netif_set_ip_info() to change to a different static IP address, I expect the IP_EVENT_ETH_GOT_IP (as appropriate for interface) to be published. This is required so that (for instance) mDNS can update automatically.
What is the actual behavior?
Instead, the event is not published. Note, this only fails when the gateway portion of a static IP is null.
Steps to reproduce.
Debug Logs.
No response
More Information.
The problem is here: https://github.com/espressif/esp-idf/blob/master/components/esp_netif/lwip/esp_netif_lwip.c#L1836:
The new IP address is checked, and if any of ip/mask/gw are null, the actual check on whether the IP has changed is just skipped entirely, regardless of what changes have taken place. Given that a null gateway is perfectly legitimate, I propose at least removing the
ip4_addr_isany_val(ip_info->gw)
check. This does fix the problem for me, and makes the system behave much more predictably.Arguably, the entire triple check should be dropped though. The
memcmp
check below, that actually checks whether the addresses have changed at all should already completely cover this.The text was updated successfully, but these errors were encountered: