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

[OpenThread]: When using WiFi DNS and Openthread DNS64 in the same code, an LwIP DNS Hook fail may happen (IDFGH-14276) #15069

Open
3 tasks done
SuGlider opened this issue Dec 20, 2024 · 2 comments
Assignees
Labels
Status: Opened Issue is new

Comments

@SuGlider
Copy link
Contributor

SuGlider commented Dec 20, 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.

General issue report

@wqx6 -

The issue is related to commit f62628d#diff-c64cd8bea4c6aa81e0c356a5f4e5dd0f4f8d9507fb7efee6a11d47f3dfcb3d76R58

Lines 58 and 64 have been added to use switching_lock Mutex.
Whenever the application tries to resolve DNS using, for instance WiFi, and OpenThread has not been initialized or has been deinitialized, the MUTEX will be NULL, therefore, lwip_hook_dns_external_resolve() that is called for any DNS query, will fail with these messages:

E (36035) OPENTHREAD: esp_openthread_task_switching_lock_acquire(38): Failed to acquire the lock because the mutex is not ready
E (36035) OPENTHREAD: esp_openthread_task_switching_lock_release(46): Failed to release the lock because the mutex is not ready
E (36046) OT_DNS64: Cannot find NAT64 prefix

This is impacting ESP 32 Arduino Framework:
espressif/arduino-esp32#10754

The error messages are caused by esp_openthread_task_switching_lock_acquire(portMAX_DELAY); and esp_openthread_task_switching_lock_release(); calls in esp_openthread_get_nat64_prefix(), which is called from lwip_hook_dns_external_resolve()


A proposed solution would be to first check if OpenThread stack is Active before performing any operation in the lwip_hook_dns_external_resolve() routine.

@SuGlider SuGlider changed the title [esp-idf][OpenThread]: When using WiFi DNS and Openthread DNS64 in the same code, an LwIP DNS Hook fail may happen [OpenThread]: When using WiFi DNS and Openthread DNS64 in the same code, an LwIP DNS Hook fail may happen Dec 20, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 20, 2024
@github-actions github-actions bot changed the title [OpenThread]: When using WiFi DNS and Openthread DNS64 in the same code, an LwIP DNS Hook fail may happen [OpenThread]: When using WiFi DNS and Openthread DNS64 in the same code, an LwIP DNS Hook fail may happen (IDFGH-14276) Dec 20, 2024
@KenFellows
Copy link

When will this issue get fixed?

@zwx1995esp
Copy link
Collaborator

Hi @KenFellows We have a internal PR to fix this issue. This PR is now under code reviewing and will be merged to our internal branch soon.

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

No branches or pull requests

4 participants