Skip to content

Resolve .local hostnames via mDNS fallback - #64

Open
omelia-iliffe wants to merge 1 commit into
Chleba:mainfrom
omelia-iliffe:mdns-hostnames
Open

omelia-iliffe wants to merge 1 commit into
Chleba:mainfrom
omelia-iliffe:mdns-hostnames

Conversation

@omelia-iliffe

Copy link
Copy Markdown

Adds mDNS reverse lookup for local IPv4 devices when the system reverse lookup returns no hostname.

Without it, devices that only advertise a .local hostname appear unnamed in Discovery and Ports, particularly on Linux with the minimal nss-mdns configuration.

If the system reverse lookup returns nothing, fall back to an mDNS PTR query for IPv4 addresses on a local interface's subnet, with a 1.5 s timeout. The multicast query goes out on the interface whose subnet contains the target, not whichever interface holds the multicast route. Without that, Wi-Fi devices were missed on a machine with both wired and Wi-Fi connections.

resolve_hostname in src/mdns.rs is used by both Discovery and Ports. Adds socket2 = "0.5" as a direct dependency (already in the tree through tokio).

IPv6 and off-subnet addresses continue to use the system reverse lookup only.

Falls back to an mDNS PTR query when the system reverse lookup finds no
name for an IPv4 host on a local subnet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant