Closed dannybackx closed 4 months ago
Ok I think I found the reason for this problem but no solution yet.
The esp-netif layer gives the impression that DNS servers are specified per netif. (You call it with a netif as a parameter.) When querying the DNS servers after network setup, it's clear that each successful connection sets the DNS servers (that part is documented). Example :
I (20:06:27.660) Network: fixup_dns: default netif wifi
I (20:06:27.666) Network: List DNS servers
I (20:06:27.671) Network: IF 0 ppp dns 0 : 80.201.237.238
I (20:06:27.677) Network: IF 0 ppp dns 1 : 80.201.237.239
I (20:06:27.683) Network: IF 0 ppp dns 2 : 0.0.0.0
I (20:06:27.688) Network: IF 1 wifi dns 0 : 80.201.237.238
I (20:06:27.695) Network: IF 1 wifi dns 1 : 80.201.237.239
I (20:06:27.701) Network: IF 1 wifi dns 2 : 0.0.0.0
FYI my code currently sets up wifi first, then cell service, so it's the DNS servers of the mobile network you see. That's why my app wouldn't work : I'm on another network via WiFi so they don't respond.
The netif layer calls LWIP without the netif argument (see esp_netif_set_dns_info_api()) so that's where info gets lost.
Setting servers 0, 1, 2 for DNS doesn't reliably work either, see attempt results in the comments :
#if 1
// This works
uint32_t ip1 = esp_ip4addr_aton("195.130.130.1"); // asse.dnscache01.telenet-ops.be.
uint32_t ip2 = esp_ip4addr_aton("195.130.131.1"); // asse.dnscache02.telenet-ops.be.
uint32_t ip3 = esp_ip4addr_aton("80.201.237.238"); // something jimmobile.be
#endif
#if 0
// This fails
uint32_t ip1 = esp_ip4addr_aton("195.130.130.1"); // asse.dnscache01.telenet-ops.be.
uint32_t ip2 = esp_ip4addr_aton("80.201.237.238"); // something jimmobile.be
uint32_t ip3 = esp_ip4addr_aton("195.130.131.1"); // asse.dnscache02.telenet-ops.be.
#endif
#if 0
// This fails
uint32_t ip1 = esp_ip4addr_aton("195.130.130.1"); // asse.dnscache01.telenet-ops.be.
uint32_t ip2 = esp_ip4addr_aton("80.201.237.238"); // something jimmobile.be
uint32_t ip3 = esp_ip4addr_aton("216.239.32.10"); // ns.google.com
#endif
It's unclear to me why only one of these appears to work, and how to proceed. Should an application catch esp-netif availability and set DNS servers based on priority ? If yes then it would seem that the priorities in the netif layer are not useful/working. Help ;-)
This is a known limitation in IDF/lwip (also documented in: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/lwip.html#adapted-apis)
This will be handled on esp_netif
layer in https://github.com/espressif/esp-idf/issues/6270 (closing this one as a duplicated issue)
Answers checklist.
IDF version.
5.2.1
Espressif SoC revision.
esp32s3 (lilygo t-sim7080g s3 board)
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.
lilygo t-sim7080g s3 board
Power Supply used.
USB
What is the expected behavior?
With two netifs (wifi and cell) the DNS client appears to fail. Works well without activating cell netif. This log shows three dns_recv events as it should.
What is the actual behavior?
Different patterns for good/bad :
More detail from the failed run - a succeeded and a failed cal :
Steps to reproduce.
Code at https://sourceforge.net/p/lilygo-t-sim- ... webserver/
Debug Logs.
No response
More Information.
Please tell me how to figure out what's wrong