Repository navigation
feat(remote-access): reach targets by their mDNS .local name - #15
Merged
Merged
Conversation
A remote-access endpoint can name its target as "<host>.local". The client resolves it on every session, so the endpoint keeps working when the host's DHCP lease moves it. Open and close events name the host and the address it resolved to. Zephyr 4.4.2's resolver can't do this on our boards. With DNS from DHCP it has no mDNS server (the SNMP trap manager's -11), and when the application runs the mDNS responder it never reads the answers. The client therefore sends its own one-shot legacy-unicast query (RFC 6762 6.7) and reads the reply itself; other names still use Zephyr's resolver. Both bugs are written up for upstream in tedge-zephyr/docs/zephyr-mdns-resolver-bugs.md. - CONFIG_TEDGE_REMOTE_ACCESS_MDNS (default y) turns it on; off, a .local target fails with "mDNS is not built in". - A lookup that times out or hits a transient error is retried: RESOLVE_ATTEMPTS (3), RESOLVE_TIMEOUT_MS (5000) and RESOLVE_RETRY_DELAY_MS (500). The worst case is checked at build time to stay under 30 s. - A .local answer must be on the device's own subnets under every target policy, because any host on the link can answer an mDNS query. - The event text grows to 200 bytes so the longest host, address and byte counts fit. Costs about 1.3 KB of flash and no static RAM for mDNS. The nine full builds' size baselines are updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
A remote-access endpoint can now name its target as
<host>.local(for examplerpi5-d83add9f145a.local:22). The client resolves it on every session, so the endpoint keeps working when the host's DHCP lease moves it. Two endpoints on our own boards still point at 192.168.68.72, which is the Pi's old address. The open and close events name both the host and the address it resolved to:tunnel to rpi5-d83add9f145a.local (192.168.68.84):22 opened.Why the client sends its own mDNS query. Zephyr 4.4.2's resolver cannot look up
.localnames on our boards, for two reasons (details intedge-zephyr/docs/zephyr-mdns-resolver-bugs.md, written for an upstream report):-11error. SettingDNS_SERVER_IP_ADDRESSES=yadds one, but it puts mDNS in front and every ordinary lookup then goes to it, so the device can't connect.So
.localtargets use a one-shot legacy-unicast query (RFC 6762 §6.7) that the client sends and reads itself. Every other name still goes through Zephyr's resolver.Changes
CONFIG_TEDGE_REMOTE_ACCESS_MDNS(defaulty). With it off, a.localtarget fails with "mDNS is not built in".RESOLVE_ATTEMPTS(3),RESOLVE_TIMEOUT_MS(5000) andRESOLVE_RETRY_DELAY_MS(500)..localanswer must be on the device's own subnets under every target policy.tedge-remote-accessspec is updated. There is a new README section, "Remote-access targets".Size. mDNS costs about 1.3 KB of flash and no static RAM. A lookup holds one UDP socket and a 512 B stack buffer while it runs. The whole change against the old baseline:
full: +2.4 KB and +176 B RAM.full: about +220 B and +168 B RAM. Their images hide most of the code growth in flash alignment.release/size-baseline.jsonis rebuilt for the ninefullbuilds; only those entries changed. Other builds don't compile any of the changed code.Testing
.localdetection, retry decisions, the policy and subnet rule, the query builder and answer parser (including malformed and looping input), and a check that the longest close event fits.check-independence.pyandcheck-secrets.py.full, through Cumulocity eu-latest), against the rpi5 (systemd-resolved):rpi5-d83add9f145a.local:22works in 3–4 s. Both events show the name and the address.full, flashed from the rpi5): SSH to the Pi by.localname works in 3 s.🤖 Generated with Claude Code