espressif / esp-lwip

Fork of lwIP (https://savannah.nongnu.org/projects/lwip/) with ESP-IDF specific patches
Other
79 stars 126 forks source link

DNS dynamic sort (IDFGH-12207) #65

Closed sgryphon closed 4 months ago

sgryphon commented 4 months ago

To address issue: https://github.com/espressif/esp-idf/issues/13255

Also useful is setting up to configure the option via KConfig (a separate PR to the main esp-idf repository).

This is not a full implementation of RFC 6724 for destination address selection, but a rough approximation that checks if we have a global (or ULA) IPv6 address, and if so prioritise IPv6 first (otherwise prioritise IPv4).

The previous approach had a static preference for IPv4, which doesn't work on an IPv6-only network trying to connect to a dual-stack server.

The new option will work for all IPv4-only, IPv6-only, and dual-stack networks with standard network types (IPv4 public or private-with-NAT44, and IPv6 global addresses) and standard DNS queries (public IPv6, public IPv4). It will even work for private IPv4 and if you configure ULA and have private IPv6 to ULA addresses.

sgryphon commented 4 months ago

Working on a proper RFC 6724 implementation, but not quite ready yet; still need to do testing around different scenarios. https://github.com/sgryphon/esp-lwip/tree/sgryphon/dns-dynamic-sort-rfc6724

sgryphon commented 4 months ago

I have tested the full RFC 6724 implementation, so dropping the PR in favour of that one: https://github.com/espressif/esp-lwip/pull/66