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

DNS dynamic sort (IDFGH-12207) #65

Closed

Conversation

sgryphon
Copy link

To address issue: espressif/esp-idf#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 sgryphon changed the base branch from 2.1.2-esp to master February 25, 2024 06:57
@sgryphon sgryphon marked this pull request as draft February 25, 2024 06:57
This fix adds an option to dynamically set the order based on whether
an the host has a global (or ULA) IPv6 address, allowing a device
with both IPv4 and IPv6 enabled to work in any network configuration,
including IPv4-only, IPv6-only, and dual-stack.

Without the option there is a static ordering preferring IPv4, which
means on an IPv6-only network, a dual-stack destination returns the
IPv4 address, which fails. Setting the static preference to IPv6
would have the opposite problem. A dynamic sort, based on available
source addresses, is required to work on all networks.
@sgryphon sgryphon changed the base branch from master to 2.1.2-esp February 25, 2024 07:03
@sgryphon sgryphon marked this pull request as ready for review February 25, 2024 07:04
@sgryphon sgryphon marked this pull request as draft February 25, 2024 22:06
@sgryphon sgryphon marked this pull request as ready for review February 25, 2024 22:07
@sgryphon
Copy link
Author

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

@github-actions github-actions bot changed the title DNS dynamic sort DNS dynamic sort (IDFGH-12207) Feb 25, 2024
@sgryphon
Copy link
Author

I have tested the full RFC 6724 implementation, so dropping the PR in favour of that one: #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants