Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONFIG_LWIP_DHCP_RESTORE_LAST_IP fails to compile: dhcp_network_changed not defined (IDFGH-13710) #14582

Open
3 tasks done
xobs opened this issue Sep 15, 2024 · 2 comments · May be fixed by #14640
Open
3 tasks done

CONFIG_LWIP_DHCP_RESTORE_LAST_IP fails to compile: dhcp_network_changed not defined (IDFGH-13710) #14582

xobs opened this issue Sep 15, 2024 · 2 comments · May be fixed by #14640
Assignees
Labels
Status: Opened Issue is new Type: Bug bugs in IDF

Comments

@xobs
Copy link
Contributor

xobs commented Sep 15, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.4-dev-3023-g3c99557eee

Operating System used.

Windows

How did you build your project?

Command line with Make

If you are using Windows, please specify command line type.

PowerShell

What is the expected behavior?

Previously, CONFIG_LWIP_DHCP_RESTORE_LAST_IP compiled just fine.

What is the actual behavior?

As of tonight, CONFIG_LWIP_DHCP_RESTORE_LAST_IP fails to compile. This is because it invokes a macro defined as:

#ifdef CONFIG_LWIP_DHCP_RESTORE_LAST_IP
/*
 * Make the post-init hook check if we could restore the previously bound address
 * - if yes reset the state to bound and mark result as ERR_OK (which skips discovery state)
 * - if no, return false to continue normally to the discovery state
 */
#define LWIP_HOOK_DHCP_POST_INIT(netif, result) \
    (dhcp_ip_addr_restore(netif) ? ( dhcp_set_state(dhcp, DHCP_STATE_BOUND), \
                                     dhcp_network_changed(netif), \
                                     (result) = ERR_OK , \
        true ) : \
        false)
#else
#define LWIP_HOOK_DHCP_PRE_DISCOVERY(netif, result) (false)
#endif /* CONFIG_LWIP_DHCP_RESTORE_LAST_IP */

However, dhcp_network_changed() no longer exists.

Steps to reproduce.

  1. Enable CONFIG_LWIP_DHCP_RESTORE_LAST_IP

Build or installation Logs.

In file included from C:/Users/Sean/esp/esp-idf/components/lwip/lwip/src/include/lwip/opt.h:51,
                 from C:/Users/Sean/esp/esp-idf/components/lwip/lwip/src/core/ipv4/dhcp.c:66:
C:/Users/Sean/esp/esp-idf/components/lwip/lwip/src/core/ipv4/dhcp.c: In function 'dhcp_start':
C:/Users/Sean/esp/esp-idf/components/lwip/port/include/lwipopts.h:365:38: error: implicit declaration of function 'dhcp_network_changed'; did you mean 'dhcp_network_changed_link_up'? [-Wimplicit-function-declaration]
  365 |                                      dhcp_network_changed(netif), \
      |                                      ^~~~~~~~~~~~~~~~~~~~
C:/Users/Sean/esp/esp-idf/components/lwip/lwip/src/core/ipv4/dhcp.c:945:7: note: in expansion of macro 'LWIP_HOOK_DHCP_POST_INIT'
  945 |   if (LWIP_HOOK_DHCP_POST_INIT(netif, result)) {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~


### More Information.

This started failing this evening.
@xobs xobs added the Type: Bug bugs in IDF label Sep 15, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 15, 2024
@github-actions github-actions bot changed the title CONFIG_LWIP_DHCP_RESTORE_LAST_IP fails to compile: dhcp_network_changed not defined CONFIG_LWIP_DHCP_RESTORE_LAST_IP fails to compile: dhcp_network_changed not defined (IDFGH-13710) Sep 15, 2024
@xobs
Copy link
Contributor Author

xobs commented Sep 27, 2024

It looks like network_changed() was split into network_changed_link_down() and network_changed_link_up(), and in fact network_changed() was simply renamed to network_changed_link_up().

So this should be as simple as renaming the function.

@xobs xobs linked a pull request Sep 27, 2024 that will close this issue
6 tasks
xobs added a commit to farpatch/esp-idf that referenced this issue Sep 27, 2024
The function `dhcp_network_changed()` was renamed to
`dhcp_network_changed_link_up()` upstream. Use the new function name.

This closes espressif#14582.

Signed-off-by: Sean Cross <sean@xobs.io>
@xobs
Copy link
Contributor Author

xobs commented Sep 28, 2024

As a workaround while this is getting fixed, you can add this to your CMakeLists.txt:

idf_build_set_property(COMPILE_DEFINITIONS "dhcp_network_changed=dhcp_network_changed_link_up" APPEND)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Bug bugs in IDF
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants