Skip to content

fix: filter link-local (APIPA) addresses from DNS resolution results#8181

Merged
Arkatufus merged 5 commits into
akkadotnet:devfrom
Aaronontheweb:fix/dns-link-local-filter
Apr 24, 2026
Merged

fix: filter link-local (APIPA) addresses from DNS resolution results#8181
Arkatufus merged 5 commits into
akkadotnet:devfrom
Aaronontheweb:fix/dns-link-local-filter

Conversation

@Aaronontheweb

@Aaronontheweb Aaronontheweb commented Apr 23, 2026

Copy link
Copy Markdown
Member

Closes #8178

Changes

On Windows hosts with multiple network adapters, Dns.GetHostEntryAsync can return APIPA (169.254.x.x) addresses from DNS results when a secondary NIC fails DHCP and registers the link-local address via dynamic DNS.

Previously ResolveNameAsync unconditionally selected the last matching address in the DNS result list. When the last entry was a link-local address, the transport would bind to or attempt to connect to an unreachable address, breaking cluster formation.

This fix:

  • Filters out IPv4 link-local (169.254.0.0/16) and IPv6 link-local (fe80::/10) addresses
  • Falls back to the original unfiltered behavior if all candidates are filtered, preserving backward compatibility
  • Switches from LastOrDefault to FirstOrDefault for the filtered list, preferring the DNS server's primary result order
  • Preserves loopback addresses (localhost still works normally)

Checklist

…kkadotnet#8178)

On Windows hosts with multiple network adapters, Dns.GetHostEntryAsync
can return APIPA (169.254.x.x) addresses from DNS results when a
secondary NIC fails DHCP and registers the link-local address via
dynamic DNS.

Previously ResolveNameAsync unconditionally selected the last matching
address in the DNS result list. When the last entry was a link-local
address, the transport would bind to or attempt to connect to an
unreachable address, breaking cluster formation.

This fix:
- Filters out IPv4 link-local (169.254.0.0/16) and IPv6 link-local (fe80::/10) addresses
- Falls back to the original unfiltered behavior if all candidates are filtered, preserving backward compatibility
- Switches from LastOrDefault to FirstOrDefault for the filtered list, preferring the DNS server's primary result order
- Preserves loopback addresses (localhost still works normally)

Closes akkadotnet#8178

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs some cleanup

Comment thread src/core/Akka.Remote/Transport/DotNetty/DotNettyTransport.cs Outdated
…ug logging

- FilterLinkLocalAddresses returns IEnumerable<IPAddress> instead of IPAddress[]
- Collapse 8 individual Fact tests into a single Theory with MemberData
- Add debug-level logging when link-local addresses are filtered from DNS results
Comment thread src/core/Akka.Remote/Transport/DotNetty/DotNettyTransport.cs

@Arkatufus Arkatufus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Arkatufus Arkatufus merged commit ec1dad4 into akkadotnet:dev Apr 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants