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

undefined reference to `if_nametoindex' (IDFGH-12575) #13577

Closed
3 tasks done
AxelLin opened this issue Apr 10, 2024 · 1 comment
Closed
3 tasks done

undefined reference to `if_nametoindex' (IDFGH-12575) #13577

AxelLin opened this issue Apr 10, 2024 · 1 comment
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@AxelLin
Copy link
Contributor

AxelLin commented Apr 10, 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.1.3-416-gd23b7a0361

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

What is the expected behavior?

if_nametoindex() should pass compilation.

What is the actual behavior?

compile error: undefined reference to `if_nametoindex'

Steps to reproduce.

Follow https://docs.espressif.com/projects/esp-idf/zh_CN/v5.1.2/esp32/api-reference/kconfig.html#config-lwip-netif-api to set CONFIG_LWIP_NETIF_API=y.

Add below code and compile:
int rc = if_nametoindex("sta0");

Then got compile error: undefined reference to `if_nametoindex'

Build or installation Logs.

No response

More Information.

No response

@AxelLin AxelLin added the Type: Bug bugs in IDF label Apr 10, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Apr 10, 2024
@github-actions github-actions bot changed the title undefined reference to `if_nametoindex' undefined reference to `if_nametoindex' (IDFGH-12575) Apr 10, 2024
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Apr 16, 2024
@espressif-abhikroy
Copy link
Collaborator

espressif-abhikroy commented Apr 16, 2024

Hi @AxelLin,
Thanks for bringing this issue to our attention.
Enabling CONFIG_LWIP_NETIF_API doesn't really enable if_nametoindex() api.
As a result examples/protocols/sockets/tcp_client_multi_net also doesn't work with CONFIG_LWIP_NETIF_API enabled.
This will be fixed in a future release.

For a workaround you can use lwip_if_nametoindex() instead of if_nametoindex().

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: In Progress Work is in progress labels Apr 24, 2024
@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Reviewing Issue is being reviewed labels May 13, 2024
eshjordan pushed a commit to eshjordan/esp-idf that referenced this issue Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants