mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #24] Support for mDNS, Multicast DNS #21
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bluejekyll on GitHub (Jun 26, 2016).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/24
Should be very simple extension over the UDP version.
https://tools.ietf.org/html/rfc6762
also, see IPv6 neighbor discovery and SLAAC:
https://tools.ietf.org/html/rfc4861
https://tools.ietf.org/html/rfc4862
@briansmith commented on GitHub (Jan 1, 2018):
I suggest adding "mDNS" to the issue title.
There are two parts to this: Querying and responding (serving). It isn't possible to implement serving without querying because the first step of serving is "[...] for all those resource records that a Multicast DNS responder desires to be unique on the local link, it MUST send a Multicast DNS query asking for those resource records, to see if any of them are already in use." This implies that querying should be implemented first.
Regarding responding, ideally a multicast DNS responder implementation will be very compact; i.e. .the size considerations that prompted the minimization work for the resolver would also apply to the multicast DNS responder. In particular, it would be great to be able to embed the responder into a tiny IoT-like device.
@briansmith commented on GitHub (Jan 2, 2018):
Note also that Multicast DNS reserves special semantics to ".local" addresses:
@bluejekyll commented on GitHub (Jan 29, 2018):
My current plan is to build two implementations (not sure if they will be new crates yet). There will be a new
trust_dns_proto::MuticastStream, which is nearly identical totrust_dns_proto::UdpStream. I want to try and just useUdpStreamunder the covers. TheClientwill be able to sendone-shot, https://tools.ietf.org/html/rfc6762#section-5, queries using this stream.For the resolution, the
Resolverwill gain a new multicast resolution component through theNameServerPool.multicast_connswill be a new field, with IPv4 and IPv6 associated (thought I'm not yet sure about registering IPv6 and IPv4 at the same time here, that might create unnecessary duplication of multicast messages on the network). https://tools.ietf.org/html/rfc6762#section-20 only discusses IPv4 and IPv6 from the stand-point of registration, and doesn't give good guidance on query implementations. The RFC mentions allowing other non-.local.queries to be sent via multicast. My plan would be this:This will make multicast only a last resort for non-
.local.names, of course this logic could always be triggered by not adding any default nameservers. One negative issue with the continuous mDNS record maintenance is that queries are intended to be actively requested for names that are queried. This would require a background processing thread to maintain a consistent schedule (I don't think we should spin up additional threads in theResolver, so this seems like a non-starter). The other option would be to only perform this maintenance on the primary thread on a turn of theResolvers event loop (this will be the initial implementation) by utilizing the fact that multiple queries can be safely associated to a single DNS packet, this option seems reasonable. This does mean that records could go stale over longer periods, but why put traffic on the network when nothing is actually requesting names. It might be worthwhile to give an API into the maintenance method such that in cases where theResolveris embedded in other software, that software could spin up an additional thread and call the query maintenance method on a fixed schedule.For a multicast dns responder my current plan is to modify the
Serverto add a special authority for registering.local.names and service all multicast requests that are received. TheServercan be managed either through dynamic dns, or if it's embedded, a direct API should be added for managing the.local.Authority. Query forwarding will not be implemented as part of the initial mDNS support in the server. This can be added at the same point that general purpose forwarding is built in.@bluejekyll commented on GitHub (Feb 13, 2018):
I've run into a complexity on implementing mDNS support. I can easily create one-shot DNS queries. It's also possible to create a server that receives multicast packets. But on existing operating systems that already support mDNS, we can not create another "continuous", fully compliant, mDNS responder. This is due to the fact that we can no reuse the address that is owned by the host OS, specifically
0.0.0.0:5353and/or[::0]:5353. If the operating system has some means of creating network namespaces, like LXC or Docker, or somehow getting a separate IP, then this wouldn't necessarily be a blocker, but would require running in a container.This is a bit of a bummer, as there is not good reason why the spec doesn't allow this. What is possibly is to bind a listening address directly to the mDNS well-known multicast address and port
5353, as is required by the multicast spec for UDP, but this is only one half of the equation.One option for the server is to create dual sockets, one for receiving bound to the UDP multicast addresses, and then one for replies bound to a random port and address. It's not clear at this point whether standard mDNS clients out there would accept responses that don't come from some address specifically from port 5353 (they might accept any response). For the client/respolver, it's more egregious in that mDNS responders will assume that the client is not fully mDNS compliant if it does not send packets from port 5353, not doing so is outside the RFC:
For now I will move forward with supporting one-shot mDNS requests and routing. We should probably feature flag off continuous mDNS queries. This is disappointing.