Open Marttico opened 4 months ago
Hi, @Marttico For the thread running on esp32C6, what device role of openthread? Is it an border router or just a normal thread router device? Could you please share the topology of your test env? That might be helpful to us to understand what happens. Thanks.
Hey @zwx1995esp,
My setup in step 7 is specifically that my Thread device is a child. It's connected to an OpenThread border router hosted on a Raspberry Pi 4 connected to an nrf52840 as an RCP.
Do note that the issue I'm experiencing is specifically that an MQTT connection does not work while having compiled OpenThread DNS64 into my project but not initializing OpenThread. The way I'm expecting to connect to the MQTT broker is through a Wi-Fi connection, which usually works, but not when CONFIG_OPENTHREAD_DNS64_CLIENT
is enabled in sdkconfig.
Connectivity through OpenThread seems to work fine with the CONFIG_OPENTHREAD_DNS64_CLIENT
enabled in sdkconfig.
Thanks in advance for any help or suggestions you can offer!
Hi, @Marttico Sorry for the delay. So your project is running Thread and Wi-Fi together in one APP and you want both Thread and Wi-Fi can connect MQTT server at same time, right? Or you just want to run them separated and you want to run Wi-Fi or Thread MQTT client with the same configuration?
Hi, @zwx1995esp I'd want them to work seperately. I currently have a project set up that I can switch between Thread and WiFi. To fix my issue I currently use a different library (mongoose) to connect to an MQTT server. I haven't tested whether my problem is resolved with an esp-idf, since I was out of office for the past two months. Before this, I found out that the DNS client seems broken for WiFi, when Thread is compiled in.
@Marttico Ok, for supporting OT device DNS feature, we add a hook to lwip_hook_netconn_external_resolve
to send the resolve and get the result manually. When using wifi, this hook should not be processed. So you can define a global flag to
distinguish when wifi or thread are active. Return 0
in the function lwip_hook_netconn_external_resolve
when using wifi, and process this logic when using thread. Please have a try.
FYI: lwip_hook_netconn_external_resolve and CONFIG_OPENTHREAD_DNS64_CLIENT
should be enabled.
@zwx1995esp When replacing the logic in esp_openthread_dns64.c to just return 0, it seems to work with WiFi again! I haven't added any global flags yet though. This may be a little off topic for this issue, but would the best course of action currently just be to modify the OpenThread component and use a custom component for this?
int lwip_hook_netconn_external_resolve(const char *name, ip_addr_t *addr, u8_t addrtype, err_t *err)
{
return 0;
}
Answers checklist.
General issue report
Summary:
When enabling
CONFIG_OPENTHREAD_DNS64_CLIENT
insdkconfig
, WiFi fails to connect to the MQTT broker. Disabling this option resolves the WiFi connection issue but causes the Thread connection to the MQTT broker to fail, likely due to the absence of DNS64 functionality.Steps to Reproduce:
CONFIG_OPENTHREAD_DNS64_CLIENT
in sdkconfig.CONFIG_OPENTHREAD_DNS64_CLIENT
in sdkconfig.Expected Behavior:
Both WiFi and Thread should be able to connect to the MQTT broker when
CONFIG_OPENTHREAD_DNS64_CLIENT
is enabled.Actual Behavior:
CONFIG_OPENTHREAD_DNS64_CLIENT
enabled:CONFIG_OPENTHREAD_DNS64_CLIENT
disabled:Additional Observations:
CONFIG_OPENTHREAD_DNS64_CLIENT
enabled.CONFIG_OPENTHREAD_DNS64_CLIENT
is enabled.System Information:
Suggested Fix:
Investigate the interaction between MQTT and DNS64 client settings to ensure compatibility across both WiFi and Thread connections.