Esp-idf: Double interface can fail DNS resolution: dns_clear_servers called twice (IDFGH-4440)

Created on 15 Dec 2020  路  2Comments  路  Source: espressif/esp-idf

Hi,

In the v4.2 but also in the 4.3-dev, the https_request_example allows in the sdkconfig to enable both ethernet and wifi. (CONFIG_EXAMPLE_CONNECT_ETHERNET and CONFIG_EXAMPLE_CONNECT_WIFI)
Both will then run a dhcp client and the example will wait until both interfaces are up and have an IP.

However, in the case that one of the two interfaces does not get a DNS server through its DHCP lease, it is possible for no DNS servers to be configured at all, causing all subsequent name resolutions to fail.

What seems to happen is that esp_netif_dhcpc_start_api is called for every interface. In this function all dns servers are cleared. If the _slower_ interface does not restore another dns server, the system will be without any dns server, which is clearly undesired.

(Tested on ESP32-WROOM-32)

Kind regards,
Arnout

Most helpful comment

This is a common issue for dual-interface use cases.
e.g. In STA + PPP case, when PPP is down the dns server settings are clear.
i.e. STA then fail to do DNS resolution.

The problem is lwIP does not support DNS per netif.
There is a patch available to support dns servers per netif, see
https://savannah.nongnu.org/bugs/?func=detailitem&item_id=58571#options

Maybe esp-lwip can test and pickup this patch.

@david-cermak

All 2 comments

This is a common issue for dual-interface use cases.
e.g. In STA + PPP case, when PPP is down the dns server settings are clear.
i.e. STA then fail to do DNS resolution.

The problem is lwIP does not support DNS per netif.
There is a patch available to support dns servers per netif, see
https://savannah.nongnu.org/bugs/?func=detailitem&item_id=58571#options

Maybe esp-lwip can test and pickup this patch.

@david-cermak

@arnoutdekimo @AxelLin Thanks for the report and the pointers. Will check the issue and see if we can cherry-pick the patch.

Was this page helpful?
0 / 5 - 0 ratings