eculocate

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 9be9d167c38fa699c203ce4a9cb0644547d23cdf
parent c393353ecea879978e682bc403805d6379852f73
Author: Daniel Barlow <dan@telent.net>
Date:   Mon, 12 Jan 2026 17:58:08 +0000

mdns implementation notes

Diffstat:
Mecu-esp32/src/mdns.rs | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+), 0 deletions(-)

diff --git a/ecu-esp32/src/mdns.rs b/ecu-esp32/src/mdns.rs @@ -1,3 +1,70 @@ +// MDNS responder, mostly but not entirely standards-compliant + +// ** Probe and Announce at startup + +// at startup it does Probe and Announce for "all those resource +// records that a Multicast DNS responder desires to be unique on the +// local link". "Probe" means send packets as QU (unicast response) +// containing ANY requests for each name: 3 packets with 250ms between +// them; "Announce" means send 2 <= n <= 8 packets one second apart, +// containing all the records we know + +// ** additional data in responses + +// * for SRV, we send all the A and AAAA it names + +// * for PTR "Service Instance Enumeration or Selective Instance +// Enumeration (subtype)": i.e. when the record data names an +// instance of the service, we sent the SRV and TXT records for the +// instance _and_ all the A/AAAA named by the SRV + +// I haven't investigated what happens if the packet gets too +// large. There may be bugs + +// ** don't answer queries if the answers in the query already include what we'd send + +// This is unimplemented for now. mdns is so fricking noisy already I +// don't know if this is worth the extra effort + +// ** set the CACHE_FLUSH bit on unique records + +// "all the records with that name, rrtype, and rrclass are conceptually +// under the control or ownership of a single responder" + +// ** NSEC? + +// not done + +// ** unicast response requested (QU) + +// - top bit in the class field of a DNS question is the unicast-response bit +// - send response unicast, unless the record has not been sent recently +// ("within one quarter of its TTL") +// - also for queries received fom unicast +// - but verify the source is local lan +// - and the port is 5353 (otherwise see "legacy") + +// [ mostly done; we don't check "has been sent recently" and as we +// didn't open a unicast socket then we can't receive queries from +// unicast ] + + +// ** Legacy Unicast Responses + +// if source port != 5353 + +// - respond via unicast to source +// - query id and question +// - don't set cache-flush bit +// - ttl <= 10s + +// This is implemented but has not really been tested + +// ** response compression + +// Unimplemented + + use alloc::vec::Vec; use alloc::string::String; use alloc::collections::BTreeSet;