Skip to content

fix(dns_dev): emit one addr= TXT entry per address#152

Merged
zachsmith1 merged 1 commit intomainfrom
fix/dns-dev-one-addr-per-txt
May 1, 2026
Merged

fix(dns_dev): emit one addr= TXT entry per address#152
zachsmith1 merged 1 commit intomainfrom
fix/dns-dev-one-addr-per-txt

Conversation

@zachsmith1
Copy link
Copy Markdown
Contributor

@zachsmith1 zachsmith1 commented May 1, 2026

Summary

The dev DNS responder in `cli/src/dns_dev.rs` was joining all direct addresses into a single `addr=A B C` TXT line. iroh's parser does not split on whitespace — it runs `SocketAddr::from_str` on each `IrohAttr::Addr` value as-is and silently drops failures. So endpoints served via this dev DNS would parse to zero direct addresses on the dialer side; only the `relay=` entry survived.

iroh's serializer at `iroh-relay/src/endpoint_info.rs:511-520`:

TransportAddr::Ip(addr) => attrs.push((IrohAttr::Addr, addr.to_string())),

…pushes one `(Addr, ...)` attribute per IP. The canonical wire form is multiple `addr=` TXT entries.

Change

Replace the join with a loop emitting one `addr=${addr}` TXT entry per address. Same approach as the corresponding fix in `network-services-operator` (datum-cloud/network-services-operator#147), discovered when staging iroh-gateway logs showed an `EndpointInfo` with only `Relay(...)` despite the DNS containing `addr=` records.

iroh's DNS parser at iroh-relay/src/endpoint_info.rs runs
SocketAddr::from_str on each IrohAttr::Addr value as-is — it does
not split on whitespace. SocketAddr::from_str("A B C") fails, and
.ok() drops the entry silently. The dev DNS server was emitting one
"addr=A B C" line, which iroh would parse to zero direct addresses
and only see relay=.

iroh's own serializer (iroh-relay/src/endpoint_info.rs:511-520) pushes
one (Addr, addr.to_string()) attribute per IP, so the canonical wire
form is multiple "addr=<single-sockaddr>" TXT entries. Match that
shape here so endpoints registered via this dev server actually
resolve their direct addresses when iroh dials them.
@zachsmith1 zachsmith1 requested a review from scotwells May 1, 2026 21:15
@zachsmith1 zachsmith1 merged commit ad2485f into main May 1, 2026
10 checks passed
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.

2 participants