mDNS device beacon (_waybeam-venc._tcp): zero-config LAN discovery#89
Merged
snokvist merged 2 commits intoJun 23, 2026
Merged
Conversation
…very Add a lightweight mDNS/DNS-SD responder so the encoder is discoverable on the LAN without configuration. - src/mdns_beacon.c: own-thread responder, UDP 5353 multicast, announces PTR/SRV/TXT/A for `_waybeam-venc._tcp`; goodbye on stop; bare `waybeam.local` alias (default on) with RFC 6762 §8.2 conflict resolution (highest-IP tiebreak, suppression sticky until restart). - src/mdns_wire.c: DNS wire codec (adapted from the OpenIPC herald helpers), bounds-checked against malformed/truncated inbound packets (compression- pointer loop cap, per-field length guards). - src/device_id.c: SoC die-ID read → serial-suffix instance naming; full die ID exposed read-only as `device.serial` via GET /api/v1/config; graceful fallback on parts with no readable die ID. - New `discovery` config block (enabled, serviceType, name, bareAlias; default on), wired through defaults/parse/print/serialize. - TXT carries only `proto` + `version`; endpoints/identity are probe-discovered via GET /api/v1/config (keeps TXT minimal). - tests/test_mdns_beacon.c: 296-line unit suite for wire encode/parse + beacon. make test → 1701 passed/0 failed; make verify → Maruko + Star6E clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two RFC 6762 conformance fixes so the beacon matches the OpenIPC herald responder it derives from: - IP multicast TTL 1 -> 255 (§11). Receivers can verify a packet originated on the local link; strict mDNS stacks drop TTL != 255. The 224.0.0.251 group is link-local regardless, so propagation does not widen. - Query responses now jitter 20-119 ms before answering (§6) and coalesce every query drained in one poll cycle into a single response. Proactive announces stay prompt. The wire format was already herald-compatible (record order PTR/SRV/TXT/A, cache-flush classes, name compression, TTL=0 goodbye); these are timing/IP fixes only, no wire-codec change. The deliberate divergences (short record TTL + periodic refresh; serial-suffixed primary name skips §8.1 probing) are documented at the top of mdns_beacon.c. Device-verified on SigmaStar Star6E (ssc338q): multicast TTL observed 255, response latency measured 24-117 ms across repeated PTR queries, service + host + bare alias all resolve. make test: 1701 passed, 0 failed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
Pushed a follow-up commit aligning the beacon more closely with the herald responder it derives from — two RFC 6762 conformance fixes:
No wire-codec change (record order / cache-flush classes / name compression / TTL=0 goodbye were already herald-compatible). Device-verified on SigmaStar Star6E (ssc338q): captured multicast TTL = 255 (was 1), response latency measured 24–117 ms across repeated PTR queries, and service + suffixed host + bare |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a lightweight mDNS/DNS-SD device beacon so the encoder is discoverable on the LAN with no configuration. A client (ground station / viewer) can browse
_waybeam-venc._tcp, resolve the encoder, and read endpoints viaGET /api/v1/config.What's in this PR
src/mdns_beacon.c— own-thread responder on UDP 5353 multicast; announces PTR/SRV/TXT/A for_waybeam-venc._tcp; sends goodbye on stop. Barewaybeam.localalias (default on) with RFC 6762 §8.2 conflict resolution (highest-IP tiebreak; suppression sticky until restart).src/mdns_wire.c— DNS wire codec, adapted from the OpenIPC herald DNS-SD helpers. Bounds-checked against malformed/truncated inbound packets (compression-pointer loop cap, per-field length guards).src/device_id.c— SoC die-ID read → serial-suffix instance naming; full die ID exposed read-only asdevice.serialviaGET /api/v1/config; graceful fallback on parts with no readable die ID.discoveryconfig block (enabled,serviceType,name,bareAlias; default on), wired through defaults/parse/print/serialize.proto+version; endpoints/identity are probe-discovered viaGET /api/v1/config(keeps TXT minimal).tests/test_mdns_beacon.c— unit suite for wire encode/parse + beacon behavior.Verification
make test→ 1701 passed / 0 failedmake verify→ Maruko + Star6E backends cross-build cleanDeliberately NOT included (kept in the Waybeam fork)
This is the encoder-side feature only. The broader Waybeam discovery/trust migration (cross-repo spec doc, and the
S95waybeamapfpv init-script changes that depend on a Waybeam-specificwfbmodeboot env) are intentionally left out of this upstream PR as they're ecosystem/deployment-specific.Opened as a draft for review.
🤖 Generated with Claude Code