For the technical audience

Decisions ADR-191 to ADR-200

Every architecture decision record (ADR) behind TelltaleDNS: what we knew, what we chose, and what it costs. This page is built from the specification on every change, so it's always the current record.

ADR-191 A change made through the API is checked against the merge the node applies; on a promoted primary the version it builds on stands for the filesProposedAGTAPICLUGitHub issue #113 (gael1980).

Context

GitHub issue #113 (gael1980). ADR-040 says "API writes are validated against the full resulting config before they're stored" and that the files win. ADR-051 makes a primary promoted from replica build on the last cluster version it applied (cluster/applied.json), which sits in the files' place in the merge (replication::unpinned). The write checks merged onto something else: a device change onto the running configuration (and, when a stored row had the name, without the base's device of that name), every other kind onto the node's own files. On a promoted primary, renaming a device that version also has (Newt, made in the UI on that node earlier) kept its address on two devices: the check passed, the reload's merge failed, and the node used its base alone, so every stored entry (devices, client IDs, groups, quick rules, upstream overrides) stopped applying on every node while the reload reported success. One node with a [[client]] named like a stored device could do the same. The rows stayed, and the API could not remove them (404 for a stored device not in effect). The spec didn't say how the API treats the version a promoted primary builds on, or how a stored entry that isn't in effect is removed.

Decision

  • One merge for the check and the reload. A write through the API (devices; local names, forwarded domains and quick rules, ADR-042; the kinds of ADR-069; the one-of sections) is checked against the merge a reload applies: every stored entry as the write leaves it, merged (managed::merge) onto the base. The base is the config files, or, on a primary promoted from replica that isn't a Git source or under a Git authority, the files with that version's shared sections (replication::managed_base, kept in Sources::managed_base at start-up and by every reload, beside file_config). A write whose merge doesn't validate is refused before anything is stored (422 with the merge's reasons), and the configuration version doesn't move. For a device whose match key a device of the base already holds, the fuller hint names that device and where it is defined; the node that answers gives it only to whoever may read every device (people, and agents that may simulate: AGT-004, as for a quick rule's device hint), and the plain hint names none. A dry run's simulation, for a device change as for every other kind, compares the change with what the stored entries make on that base now (the base alone while they don't apply, which is what is in effect then).
  • The base stands for the files. Its devices, local names, forwarded domains and quick rules are read-only through the API (409), as the files' are; on a promoted primary the 409 says the entry is in the version the node builds on, and that version's quick rules are listed with source file, so they aren't offered for editing and the expiry sweep leaves them alone. A stored device of a name the base has isn't in effect (the base's is): it can be deleted, or renamed to another name (the merge then decides), as before, but not changed in place. The kinds of ADR-069 override or hide the base's entry, as they do the files'.
  • The node's own files still decide what they decided. Which plugin upstreams the files define (ADR-180), where a credential file may be and who may set a list's local file or an alert destination's credential file (ADR-179, ADR-180), and a router's key files (ADR-181) are read from the node's own files and stored entries, as before. Only the validation merge, and what the check takes for the configuration in effect, move to the base. So, by decision, the check that refuses a group naming a plugin upstream the merge leaves out (left_out_guard) reads the node's own files while the merge reads the base: on a promoted primary it can refuse such a group when only the version the node builds on defines that upstream, and what it lets through is still merged without the plugin.
  • A stored device that isn't in effect can be deleted. DELETE /api/v1/clients/{name} of a stored device the configuration in effect doesn't use (the base has its name, or the stored entries don't apply) removes the row (200). While the stored entries don't apply, deleting a stored device is accepted even when they still don't apply after it, and the answer's warnings say why: it takes away nothing in effect, and two such rows must be removable one at a time. Every other write must leave a merge that applies.
  • While the files couldn't be read at start-up (ADR-179), a device change is checked against the running configuration, as before.
  • Amendment (2026-11-28, Proposed): a write reads its base when it is planned. The base is read as the next reload reads it (replication::managed_base over the config files, which reads the node's role and the version it last applied from disk), on the blocking thread that plans the write, not taken from the copy the last reload kept in Sources::managed_base: that copy lags a promotion until the reload that follows it, and a write in that moment would be checked on the node's own files. The copy now serves what the API lists (a quick rule's source), and a dry run's simulation compares with what the stored entries make on the base its plan read. The cost is a read of the node's cluster files for each write, off the DNS path. The fallback's log line, and a refused device change's fuller hint, name the stored devices whose places (client[3]) the reasons give; while the stored entries didn't apply before a device change, or when a delete is refused because something else stored names the device, the plain hint says so; and where another stored device holds a name or match key the change uses, the plain hint says to give the device a name and match keys no other device uses (people see it in the fuller hint too, with that device's name). Deleting a stored device that a device of the base hides answers (and audits) the stored row as before. Deleting a stored device that isn't in effect counts no recent queries (nothing in effect is relabelled). A caller that may not read every device (the rule of the fuller hints) is shown such a row by its name and source only (the device in effect of that name, looked up before the write, is shown whole), while the audit entry keeps it whole. For a device refusal whose reasons can name devices it can't read, such a caller gets a detail that says what is true without them: that the stored entries don't apply now, before the change (an operator sees why when making the change in the UI), with a hint that doesn't point at the reasons; or that the change conflicts with another device, which the answer doesn't name (the hint says what to do; a hint that points at the reasons comes without that pointer). A delete's warning that the stored entries still don't apply comes to it without the reasons, and the delete's impact then doesn't point at the warnings. A 409 cluster_pinned carries its diff (the shared configuration the pin holds back) only to a caller that may read every device; the detail and the hint's sentences go to every caller. An agent token's Idempotency-Keys are its own.

Not done (later designs): rolling back a write whose reload sets the stored entries aside for a reason the check can't see (the files changed on disk since the last reload); marking the entries made through the API in the shared version, so a promoted primary can still change the devices of the version it builds on. Amended 2026-11-28 (Proposed): a promotion can also set the stored entries aside without any write, when they don't validate on the version the node is promoted onto. And on a promoted primary the devices, local names, forwarded domains and quick rules of the version it builds on can't be changed: not through the API (409), and not through the node's own files, whose shared sections that version replaces (CLU-006). That change is the one issue #113 asked for, so marking the entries made through the API in the shared version is proposed as the first of these designs.

Consequences

  • On a standalone node and on a primary that was never a replica the base is the files, and every write accepted before and applied by its reload gets the same answer (a device change's configuration to simulate lists the devices in the store's order, and keeps a file's device that a stored row of the same name hid). What changes there, only for writes whose reload didn't apply them: a change in place to a stored device that a file's device of the same name hides is refused (409; it used to be stored with no effect), and while the stored entries don't apply, a write that doesn't make them apply is refused instead of being stored to no effect. A refusal for a match key a file's device holds names that device in the fuller hint, for those who may read every device. A dry run's simulation that repairs the stored entries is run instead of answering 500.
  • On a promoted primary, a write that names what only the version it builds on has (a device, an upstream, a group) is accepted, and one that names what only the node's own files have, which the reload replaces there (CLU-006), is refused.
  • No wire, schema or configuration change, and nothing on the DNS path: the merge runs once more for each write.

Verification

api_010_rename_onto_an_address_the_base_still_holds_is_refused, api_010_rename_shadowed_by_a_file_device_is_refused, api_002_an_accepted_plan_never_falls_back (every kind the API writes), clu_003_promoted_primary_checks_writes_on_its_inherited_base, api_010_a_device_write_on_a_node_without_an_inherited_version_is_planned_as_before, api_010_delete_removes_a_stored_device_not_in_effect, api_010_renaming_a_hidden_stored_device_to_a_free_name_applies_as_before, agt_004_a_group_agent_is_not_told_which_device_holds_a_key, clu_003_an_inherited_quick_rule_is_not_offered_as_api_and_is_not_swept, api_002_a_dry_run_compares_with_what_the_stored_entries_make_now; for the amendment, api_010_delete_of_a_hidden_stored_device_reports_the_row, clu_003_a_write_right_after_promotion_is_checked_on_the_inherited_base, clu_003_the_write_base_is_what_unpinned_merges_onto_for_every_role, api_010_a_fallback_names_the_stored_rows_to_delete, api_010_a_node_logs_the_stored_devices_its_fallback_sets_aside, api_010_a_hidden_row_delete_counts_no_recent_queries, agt_004_a_group_agent_is_shown_a_hidden_stored_row_by_its_name_only, agt_004_a_caller_that_may_read_every_device_is_shown_the_hidden_row, agt_004_a_group_agent_deleting_a_device_in_effect_is_shown_it_whole, agt_004_an_agent_without_querylog_read_is_shown_a_hidden_row_by_its_name_only, agt_003_an_agent_token_gets_its_own_stored_answer, agt_004_a_restricted_caller_is_not_given_the_reasons_of_rows_it_cant_read, agt_004_a_restricted_agent_is_told_what_is_true_in_place_of_the_reasons, agt_004_a_refusal_about_the_callers_own_input_keeps_its_reasons, agt_004_an_agent_without_querylog_read_deleting_a_device_in_effect_is_shown_it_whole, agt_003_an_agent_tokens_retry_replays_its_own_answer_only, agt_003_an_idempotency_key_is_stored_per_caller, agt_004_a_pinned_refusal_carries_its_diff_only_to_whoever_may_read_every_device, api_010_a_conflict_with_another_stored_device_says_to_use_free_keys, agt_004_a_restricted_caller_is_not_pointed_at_reasons_it_does_not_get.

REQ: API-002, API-010, CLU-003, CLU-013, AGT-003, AGT-004.

Requirements AGT-003 AGT-004 API-002 API-010 CLU-003 CLU-006 CLU-013

Builds on ADR-040 ADR-042 ADR-051 ADR-069 ADR-179 ADR-180 ADR-181

ADR-192 The loop-detection option can be left out per upstream: loop_tag = false, on by default and not written while onProposedOBSUPSGitHub issue #111 (cheebun): every query TelltaleDNS forwards carries its loop-detection EDNS option (code 65429 with the node's random 8-byte tag, spec/04 §7).

Context

GitHub issue #111 (cheebun): every query TelltaleDNS forwards carries its loop-detection EDNS option (code 65429 with the node's random 8-byte tag, spec/04 §7). Some public resolvers drop any query with an EDNS option they don't know (RFC 6891 §6.1.2 asks them to ignore it), so every query to such an upstream times out and its breaker stays open. spec/04 §7 tags every outbound query and offers no way out; the only exception for a forwarded query is a self-probe (OBS-020, T11.3), and a recursive:// upstream asks authoritative servers without it. The tag catches a query that comes back to the node that sent it with its options intact: an upstream that is this node's own listener, or a forwarder that passes EDNS options on to it. It doesn't catch a loop between two TelltaleDNS nodes, since a node never forwards a client's options, so tagging only private addresses or only other TelltaleDNS nodes (the reporter's second suggestion) would keep no detection that matters and lose some.

Decision

  • A per-upstream boolean [[upstream]] loop_tag, default true. With false, nothing sent to that upstream carries the option: its queries, its health checks, the draft check (POST /checks/upstream builds from the same fields), and the lookups of its host name through its own bootstrap servers. The system resolvers from /etc/resolv.conf are shared by every hostname upstream without its own bootstrap, and keep it. A self-probe never carries it, as before.
  • At the default nothing changes: the same bytes leave as before (the option first, then an ECS subnet when one is set).
  • The upstream decides once, when it is built: one flag (loop_tag && !self_probe), read where the exchange encodes its query. No allocation, lock or I/O per query; the bootstrap is off the query path (its answers are cached for their TTL).
  • The key is shared with the rest of [[upstream]] and, like [special] resolver_arpa (ADR-187), not written while it is on: a node one version behind refuses an [[upstream]] key it doesn't know (a shared version that has it is refused, and the node keeps serving the one it has), so a cluster that never sets it shares exactly what such a node reads. A node that can't read a shared version carrying the key refuses it, keeps serving the one it has, and refuses every later version while the key is in it: it stops converging until it is upgraded or the key is removed. So the key should be set only once every node runs a version that knows it (the release that ships this decision); an earlier build also refuses it in its own file. The user docs keep this rule in one place, docs/running.md "Setting loop_tag in a cluster", which the site and spec/04 point to.
  • Turning the option off doesn't fix a loop, it hides one: a query that comes back is no longer dropped, and goes round. So false is refused where the configuration can tell the upstream is this node: when the URL's host, or a bootstrap server, is a loopback address (127.0.0.0/8, ::1, or one mapped into IPv6), an unspecified address, the name localhost (or a name under it), or an address a [[listen]] entry uses, on any port. Validation reads only the configuration, and doesn't check everything in it. Still accepted: a DNS stamp whose address is this node (only the router decodes stamps), and this node's [api], [metrics] and [cluster] addresses (only [[listen]] is used). Not known there at all: the machine's other addresses, another name for it, and a resolver that forwards back. The draft check (POST /checks/upstream) builds without validating, so it can report "Works" for a body that saving refuses. The docs say all of this. Refusing on any port also refuses a forwarder on another port of this host. Each node checks the merged configuration against its own listeners, so the primary accepts an upstream at a replica's listener, and that replica refuses the version as above and stops converging while the upstream stays.
  • false is also refused on a recursive:// upstream (stub zones included), where it would do nothing. It stays valid on every kind that sends the query's bytes on: udp, tcp, tls, https, h3, quic, DNS stamps, and plugins (unix://, exec://).
  • No new requirement ID: UPS-009 holds loop detection (spec/04 §7).

Not done

  • A health hint for an upstream that times out on tagged queries but answers untagged ones (the reporter's third suggestion): it needs its own design (when to probe, and what to say).
  • Tagging only some upstreams by address or kind: see Context.
  • Any change to the cluster's wire protocol.

Consequences

  • A resolver that drops unknown options can be used, at the cost of loop detection through that upstream. The docs say that turning the option off hides a loop rather than fixing it, to keep it on for any upstream that can reach this node, and not to turn it off to quiet forwarding loop detected.
  • The UI's upstream form doesn't offer the key; the configuration files, the API (the body has the same fields as the TOML section) and Git do. A domain forwarded in the UI or the API keeps the option; an [[upstream]] with the key and a [[route]] forward a domain without it.

Verification

ups_009_loop_tag_false_leaves_the_option_out (a query and a health check carry no option; with an ECS subnet, only the subnet; an upstream at the default beside it keeps the tag); ups_009_loop_tag_is_on_by_default (from the configuration and built in code); ups_009_default_query_bytes_are_unchanged (golden bytes from the base, for encode_query and for the exchange, also with DO and CD and with an ECS subnet); ups_009_loop_tag_default_is_not_shared (the shared part, a replica's merge, and back); ups_009_bootstrap_follows_the_upstreams_loop_tag (the router gives the upstream's own bootstrap the switch, the system bootstrap keeps the tag, and what the lookups send); ups_009_loop_tag_off_is_refused_toward_this_node (each refused form in the URL and in bootstrap; a public address, a LAN address no listener uses, host names with public or system bootstrap servers, and loopback with the option on are accepted); ups_009_loop_tag_off_is_refused_where_it_does_nothing (recursive:// and a stub zone refused; a DNS stamp and both plugin kinds accepted); unchanged and green: obs_020_self_probes_carry_no_loop_tag, loop_tagged_queries_are_dropped. No benchmark: the exchange reads one stored flag where it negated another.

Requirements OBS-020 UPS-009

Builds on ADR-187

Referenced by ADR-197

ADR-194 DoH behind a reverse proxy: the client's address only from listed proxies, plain HTTP only on loopback or a Unix socket, and no request answered without a client addressProposedDNSGitHub issue #91.

Context

GitHub issue #91. cheebun runs Caddy in front of TelltaleDNS. Caddy terminates TLS for DoH and has to re-encrypt to a loopback doh listener, because a doh listener without tls is refused (validate.rs, needs_tls). He would prefer a Unix socket. He showed that Caddy sends a PROXY v2 header over a Unix socket as TCP4 or TCP6 with the client's address, source port 0 and an all-zero destination. gael1980 runs a proxy on other machines of a private network in front of a three-node cluster. Every request appears to come from the connector's address, so access lists, rate limits and device statistics see one client. He asks for trusted X-Forwarded-For (or X-Real-IP) from listed private-network proxies, and for client IDs in device analytics.

The decisions this builds on:

  • ADR-039 reads PROXY v2 before TLS and keeps the socket's address for LOCAL, with no source allowlist. The parser also returns no address for AF_UNSPEC and AF_UNIX.
  • ADR-039's amendment of 2026-11-27: a header without an address keeps the socket address, and the settings for that address apply.
  • ADR-034 reads the API's client from the rightmost X-Forwarded-For entry that isn't a listed proxy, and never trusts loopback for that header by itself (amendment of 2026-11-18).
  • ADR-099 counts per-address connection limits on the client's address.
  • ADR-149 prefers no service to plain HTTP where TLS is expected.

A plain listener behind a proxy would see only loopback, so a request without a client address must never be answered as the socket's peer. The design note is docs/design/doh-behind-a-proxy.md; the owner accepted its recommendations on 2026-11-27 (listed peers on other machines, the walk from the right, a forwarded loopback address refused; no X-Real-IP, no h2c).

Decision

  • Two problems, decided separately. (A) A doh listener may take the client's address from a proxy the operator lists, over TLS as today. (B) A doh listener may serve plain HTTP, only for a TLS-terminating proxy on the same host. Client IDs in device analytics are not part of this decision (an issue of its own).
  • New keys on [[listen]], proto = "doh" only, all node-local (listen is never replicated). Each is written only when set (skip_serializing_if, the ADR-187 pattern), so the serialized form of every existing listener is unchanged.
    • trusted_proxies = [networks], default none. The only peers this listener accepts: a connection from any other address is closed at accept, before a byte is read. The same networks are the hops skipped in X-Forwarded-For. Valid only with proxy_protocol or x_forwarded_for. Required with x_forwarded_for on an address. A network of prefix length 0 is refused. A network wider than one host is a warning ("list only your proxies"), and so is a network a loopback listener can never see.
    • x_forwarded_for = true, default false. The client is the rightmost X-Forwarded-For entry that isn't inside trusted_proxies.
      • All field lines are joined in order, and at most 16 entries are read from the right.
      • The selected entry must be a bare IPv4 or IPv6 literal of at most 45 bytes. If it isn't, the request is refused. The walk never skips it to an entry further left. An IPv4-mapped IPv6 literal is the IPv4 client: only the form of RequestMeta.peer changes, since the rate limiter, the access list and client matching already map such addresses.
      • Entries are read as the API's walk reads them (ADR-034, amendment of 2026-11-27): per entry, trimmed of ASCII whitespace; a port, brackets, a zone id, a token, an empty entry or an entry that isn't text is unusable, and bytes left of the entry that decides never matter. The outcome differs by design: the API answers the connection's peer, a doh listener refuses; and the DoH walk also refuses only listed proxies, more than 16 entries, and an unspecified or loopback client.
      • Exclusive with proxy_protocol. Forwarded and X-Real-IP are never read, and no other DNS listener reads X-Forwarded-For.
      • config check warns when max_connections_per_address is left at its default.
    • plain_http = true, default false. No TLS. Refused together with tls.
      • Allowed only on a loopback address (127.0.0.0/8, ::1) or a Unix socket.
      • Requires proxy_protocol = true or x_forwarded_for = true.
      • A doh listener with neither tls nor plain_http is still refused with today's message.
    • addr also accepts unix:/absolute/path (a plain listener only). An ip:port keeps its form. unix_mode (default "0660") is the socket file's mode, set after bind and before listen. An existing path is replaced only if it is a socket nothing answers on: a symlink, a file or a live socket is a bind error. The file is removed when the listener closes. A world-writable mode is a warning.
  • No fallback to the socket's peer. On a listener with any of these keys, these never reach the pipeline:
    • a connection whose PROXY header is LOCAL, AF_UNSPEC or AF_UNIX, or names an unspecified address (0.0.0.0, ::) or a loopback one (127.0.0.0/8, ::1, their IPv4-mapped forms), is closed;
    • a request without a usable X-Forwarded-For client (missing, unusable at the selected entry, only listed proxies, over 16 entries, an unspecified or loopback address) is answered 403. On HTTP/1.1 its connection is closed (Connection: close), so nothing behind it on the stream is read. HTTP/2 frames each request on its own: its connection, which carries the proxy's other clients, stays (the design note's R13 planned a close on both).

Both are counted by reason (telltale_doh_forwarded_refused_total{reason="unlisted_peer"|"no_client_address"}), with at most one log line per listener and reason per minute, never with a header's value; the line names a refused PROXY header's kind (read_source). 2026-11-28: the line carries reason as the counter labels it and, for a missing client address, a kind (xff_missing, xff_unusable, xff_only_proxies, xff_too_many_entries, xff_not_a_client, proxy_local, proxy_unspec, proxy_unix, proxy_not_a_client): the kind of the first refusal in its minute, while the counter counts them all. A refused header is counted there only, never in telltale_proxy_protocol_no_address_total (ADR-039's amendment of 2026-11-27), which counts the connections that keep the socket's address. These lines and that amendment's no-address lines go through one limiter, each on a minute of its own. TCP4 and TCP6 headers with source port 0 and an all-zero destination are accepted. Without the new keys, ADR-039's rules are unchanged (LOCAL keeps the socket's address).

  • The forwarded client is the client for [access] allowed_networks, the rate limit, identification, the query log, analytics and dnstap: the listener sets RequestMeta.peer to it (port 0 for an X-Forwarded-For client). The per-address connection limit counts the PROXY client after the header (ADR-099). With x_forwarded_for it counts the socket's peer, the proxy.
  • Conflicting framing. An HTTP/1.1 request that states its length with both Content-Length and Transfer-Encoding is framed by Transfer-Encoding and its connection is closed after the answer (RFC 9112 §6.3), so nothing behind it on the connection is read. hyper's HTTP/1 server does this itself (it removes Content-Length before the request reaches the listener), so the listener adds no check of its own; a test pins the behaviour. (The design note planned a 400 here; the effect sought, no second request read from such a connection, is the same.)
  • A plain listener speaks HTTP/1.1 only (no h2c, no upgrade). With PROXY v2 it serves one request per connection, so a pooled connection can't carry another client's request.
  • Plain and x_forwarded_for listeners send no Alt-Svc, take client IDs from the path only (the SNI there is the proxy's), and are skipped by the listener probes with a reason that points to [probe] targets. The plain listener has its own arm in bind_stream: it is HTTP, never the DNS-over-TCP catch-all.
  • Declined:
    • plain HTTP on any address another machine can reach (LAN, Docker bridge, pod network, wildcard);
    • believing a forwarded address from an unlisted peer;
    • X-Real-IP and Forwarded.
  • Order: A first (trusted_proxies, then x_forwarded_for), then B (loopback and the Unix socket together). No new requirement ID: DNS-003, DNS-020 and DNS-014 cover it.

Implementation

part A is built (T31.1, 2026-11-27): trusted_proxies and x_forwarded_for on TLS doh listeners, in crates/telltale-net/src/forwarded.rs and doh.rs. Part B (plain_http, unix: addresses, unix_mode, one request per connection under PROXY v2) is not built yet; until it is, a doh listener always needs tls.

Not done

  • h2c;
  • keep-alive on plain listeners with PROXY v2 (a later ADR, after a measurement);
  • trusted_proxies on tcp and dot listeners;
  • a per-listener access list (a public DoH endpoint behind a proxy needs allowed_networks widened for every listener);
  • client IDs from the Host header;
  • peer-credential checks on the Unix socket;
  • detecting a proxy that passes a client's X-Forwarded-For through unchanged;
  • device analytics keyed by client ID (its own issue);
  • a fuzz target for the PROXY header parser (proxy_header). 2026-11-28: done in fuzz/fuzz_targets/proxy_header.rs, nightly with a seed in Caddy's shape.

Consequences

  • A proxy on other machines gives each client its own address while the hop stays encrypted. A layer-4 balancer can be the only peer a listener accepts. With part B, a proxy on the same host needs no second TLS hop.
  • Once a listener sees real clients, allowed_networks and the rate limit apply to them: clients outside your allowed networks are refused (EDE 18), where before they shared the proxy's address.
  • A client on the proxy's own host is refused through the proxy and uses the local listeners. A proxy health check that sends LOCAL or asks the DoH path is refused: a TCP check or the web UI's /livez is the documented alternative.
  • Everything on trusted_proxies is trusted to name any client: it can choose a client's policy, spend its rate budget on every transport, and write its address into the log. On a loopback plain listener that is every process on the host, which a Unix socket with mode 0660 narrows to the proxy's group.
  • Listener settings never leave a node, so mixed-version clusters are unaffected: the shared configuration is the same bytes with or without the keys. An older binary refuses its own file if it contains the new keys (at start it doesn't run; on a reload it keeps the running configuration), so they must be removed before a downgrade.
  • Per-query cost:
    • existing DoH listeners: one predictable branch at accept and one per request;
    • x_forwarded_for listeners: an allocation-free walk of at most 16 short entries per request;
    • plain listeners with PROXY v2: one loopback or Unix connection per query instead of a TLS session.

UDP, TCP, DoT, DoQ, DoH3 and the pipeline are unchanged.

  • Updated: docs/running.md ("Behind a reverse proxy", under Encrypted DNS for your devices), docs/configuration.md, site/guide-encrypted.html, site/guide-monitoring.html, docs/config-schema.json, spec/08 (DoH through an ingress), the support package's classification table (listen[].trusted_proxies[]; listen[].unix_mode with part B). No API operation, MCP tool or UI change.

Verification (part A):

  • Configuration: dns_003_x_forwarded_for_needs_trusted_proxies, dns_003_proxy_protocol_and_x_forwarded_for_are_exclusive, dns_003_trusted_proxies_only_with_a_forwarded_source, dns_003_trusted_proxies_refuses_everyone_and_warns_on_networks, dns_003_forwarding_keys_keep_the_tls_requirement, dns_003_new_listener_keys_not_written_at_default, clu_003_listener_keys_never_shared, ops_011_support_package_classifies_the_new_listener_fields.
  • The walk: dns_003_xff_rightmost_untrusted_entry, dns_003_xff_unparsable_entry_is_not_skipped, dns_003_xff_reads_entries_as_the_api_does (the API's api_004_xff_* cases), dns_003_xff_walk_is_bounded, dns_020_forwarded_unspecified_or_loopback_is_not_a_client, dns_003_trusted_networks_match_by_prefix, dns_003_refusal_lines_at_most_once_a_minute, dns_003_xff_selector_allocates_nothing; the nightly fuzz target forwarded_for.
  • Listener: dns_003_xff_only_from_listed_peers, dns_020_proxy_v2_only_from_listed_peers, dns_020_local_refused_once_trusted_proxies_is_set, dns_020_refused_headers_are_counted_as_refusals_only, dns_020_a_refused_header_is_named_by_kind, dns_020_each_listener_line_has_its_own_minute, dns_020_local_keeps_socket_address_without_new_keys, dns_020_forwarded_unspecified_or_loopback_refused, dns_020_proxy_v2_port_zero_and_empty_destination_accepted, dns_003_xff_missing_or_unusable_refused, dns_003_xff_ignored_without_the_key, dns_003_forwarded_listener_closes_after_a_refused_request, dns_003_xff_listener_closes_after_conflicting_framing, dns_003_plain_and_xff_listeners_send_no_alt_svc, dns_003_xff_listener_ignores_sni_client_ids, dns_003_client_id_from_path_survives_forwarding, dns_003_per_address_limit_counts_the_proxy_with_xff.
  • Server and pipeline: dns_014_rate_limit_counts_the_forwarded_client, dns_014_access_list_applies_to_the_forwarded_client, obs_001_query_log_records_the_forwarded_client, obs_020_probes_skip_listeners_that_need_a_forwarded_address.
  • Kept unchanged: dns_003_doh_get_post_client_ids_and_errors, dns_003_doh_http1_and_proxy_protocol, dns_004_doh_advertises_http3, dns_020_parses_v4_v6_and_local, dns_020_rejects_bad_headers.
  • Part B, when built: dns_003_plain_doh_needs_opt_in, dns_003_plain_doh_loopback_or_unix_only, dns_003_plain_doh_requires_a_client_address_source, dns_003_plain_doh_not_with_tls, dns_003_plain_doh_http1_only, dns_020_plain_doh_local_or_unix_family_refused, dns_020_plain_doh_proxy_v2_one_request_per_connection, dns_003_plain_doh_listener_speaks_http, dns_003_unix_socket_mode_set_before_listen, dns_003_unix_socket_never_replaces_a_file_or_a_live_socket, dns_003_unix_socket_removed_on_close, dns_020_proxy_v2_over_unix_socket_tcp4_family_accepted.
  • Benchmarks: make bench-smoke and the DoH row of make bench-transports against a same-binary control on the benchmark machine (not run for part A; see the design note, §11).

Requirements DNS-003 DNS-014 DNS-020

Builds on ADR-034 ADR-039 ADR-099 ADR-149 ADR-187

Referenced by ADR-034

ADR-195 An answer is secure only when it reaches its question: the asked type at the name or at the end of its CNAME chain, or that name's own proof that it has noneAcceptedDNSDNS-011.

Context

DNS-011. What answers a question is the record set of the asked type at the question name or, after CNAMEs (RFC 1034 §3.6.2), at the chain's last name; or the denial of it there, proven by that name's own records (RFC 4035 §5.4, RFC 5155 §8, RFC 6604). A verdict made only from the proofs of the records an answer holds would also be secure for a signed answer that holds neither, such as a CNAME without its target. One such answer is ordinary: a signed CNAME into an unsigned zone whose target has no record of the type (a content network's name without AAAA, say), whose authority section holds at most that zone's unsigned SOA.

Decision

on cache misses, in validate and permissive mode alike (the validator doesn't know the mode, ADR-188), for a validated answer with a secure verdict to a question of class IN whose answer section isn't empty:

  • An answer with an empty answer section is left as it is (a denial, judged by its own proof). A question that doesn't follow a CNAME needs its answer at the question name: for CNAME, a CNAME there; for DS, a DS or a CNAME there; for ANY, a record there other than a signature; for NSEC or RRSIG, a record of that type there.
  • For any other type, the CNAME chain is followed through the answer section from the question name (the name itself when it has no CNAME), one step per answer record at most; a loop ends it without reaching the question. A CNAME made from a DNAME is followed like any other (such an answer is bogus before this rule is reached: that CNAME has no signature of its own, ADR-188).
  • The answer reaches the question when the chain's last name has a record of the asked type in the answer section; or, in a NOERROR answer, when the authority section has that name's own proof that it has none: a verified NSEC owned by it, or a verified NSEC3 owned by its hash under a zone the name is in (at most 100 iterations, as in ADR-184), whose types include neither the asked type nor CNAME, and that isn't a delegation's or a DNAME's (NS without SOA, or DNAME; RFC 4035 §5.4, RFC 5155 §8.5, RFC 6840 §4.1).
  • An answer that doesn't reach the question is indeterminate: served as it came (DNSSEC records only for clients that set DO, records in resolution order), without AD, in both modes; counted as indeterminate. No lookup is made for it.
  • Such an answer is kept 300 s at most: each record of its answer section with a longer TTL gets 300 s; a shorter TTL, and the other sections, are left as they are. The cache keeps an answer for its shortest TTL over the answer and authority sections, so it is cached, and served, for 300 s at most, and clients see those TTLs. [cache] min_ttl above 300 s, or serving stale answers, can keep it longer, as for any answer. Every other answer keeps its TTLs.
  • Link-by-link validation (ADR-188) holds its last answer to the same rule, for the name it answers: a last answer with records that doesn't reach the question ends the walk, and the answer stays bogus (SERVFAIL with EDE 6 in validate).
  • An answer with a record of another name than the question's made from a wildcard (a secure signature covering fewer labels than its owner has) is handled as bogus, and so validated link by link, each name for its own question: in zones signed with NSEC3 as in those signed with NSEC (ADR-188's condition for a wildcard CNAME, applied to every answer).
  • In a zone signed with NSEC3, a record set at the question name made from a wildcard needs, beside it, a verified NSEC3 record of its signer's zone whose range covers the next closer name for that record set's own signature (the name cut to one label more than the signature's label count; RFC 5155 §7.2.6, §8.8), whatever else the answer holds. Without it the answer is handled as bogus, as above. An NSEC3 record of that zone with more than 100 iterations leaves the record set as it is; zones signed with NSEC keep ADR-188's rule.
  • Why indeterminate. Bogus would answer SERVFAIL in validate where such answers are served now, and would hand them to ADR-098's proof and to link-by-link validation (ADR-188), which serves them only while one of its 4 slots is free, doesn't try a question again for a minute after a link failed, and can't succeed when the upstream doesn't answer the target (an authoritative server that answers only for its own zones): the ordinary answer above would then fail under load. Insecure would say that a zone was proven unsigned, which nothing here proves. Indeterminate is the verdict of an answer whose proof couldn't be finished: not secure, never refused (ADR-098).

What it doesn't change: cache hits; every verdict but secure, and the TTLs of every answer but those made indeterminate here; empty answer sections; answers that reach their question; answers found bogus before this rule (ADR-098's proof and link-by-link validation, ADR-184, ADR-188, unchanged but for the last-answer rule above); a UDP answer cut at its size, which the upstream layer asks again over TCP before validation sees it.

Consequences

  • An answer that doesn't reach its question is served without AD and counted as indeterminate, not secure. Nothing that was served before is refused, except a link-by-link last answer that doesn't reach its question, an answer whose wildcard record set at the name in a zone signed with NSEC3 comes without the cover of its own next closer name, and, while link-by-link validation has no free slot, the wildcard CNAME below.
  • The ordinary answer above (a signed CNAME into an unsigned zone whose target lacks the type, or doesn't exist) is indeterminate. Its exact verdict is insecure; proving that takes ADR-098's proof of the target's zone, with lookups this check doesn't make.
  • An answer made indeterminate here is asked again upstream once its 300 s are over, where it was kept for its own TTL. A name whose records last an hour is validated again up to 11 more times an hour while it is in use, each time with the lookups its validation needs (1 to 4 upstream questions for the test zones' answers of this kind).
  • A wildcard CNAME in a zone signed with NSEC3 whose target has no record of the type stays secure when the answer carries the target's own NSEC3 record. A chain that ends in an NXDOMAIN or a wildcard's NODATA in an answer validated in one lookup is indeterminate: only a denial by the last name's own record is read here.
  • A wildcard CNAME in a zone signed with NSEC3 to a name another wildcard serves is validated link by link: secure, at the cost of ADR-098's proof's lookups and the walk's; bogus while its 4 slots are busy, and for a minute after a link failed (as for zones signed with NSEC, ADR-188).
  • Cost: nothing on cache hits or with validation off; on a miss, for a secure answer with records, one walk over the answer section, and for one that doesn't reach its question, one pass over the authority section with at most one NSEC3 hash per record; for each wildcard record set at the name in a zone signed with NSEC3, one NSEC3 hash per NSEC3 record of its zone. No lookup.
  • Tested offline only: answers built by hand for each condition, and the signed test root's s.t. (signed with NSEC: chains of one and two links, a DNAME, wildcard CNAMEs, a CNAME into z3.s.t.), z3.s.t. (signed with NSEC3: a wildcard address, wildcard CNAMEs below empty non-terminals, a name below one that exists), t. (NSEC3) and the unsigned v.t., served by a fake upstream with each answer whole, with parts of it left out, with records in another order, and with the zone's SOA in the answer section.

Verification

dns_011_cname_answer_reaches_the_question, dns_011_only_a_secure_verdict_of_a_chain_that_stops_short_changes; offline: dns_011_offline_cname_answer_needs_its_chain_to_reach_the_question, dns_011_offline_cname_answers_that_reach_the_question_keep_their_verdicts, dns_011_offline_answer_needs_the_asked_type_or_its_own_denial, dns_011_offline_nsec3_wildcard_cname_to_another_wildcard_record_needs_each_proof, dns_011_offline_nsec3_wildcard_record_needs_the_cover_of_its_own_next_closer_name, dns_011_offline_answer_that_does_not_reach_its_question_is_kept_300_s_at_most; unit dns_011_an_answer_that_does_not_reach_its_question_is_kept_300_s_at_most; ADR-188's tests, unchanged.

Requirements DNS-011

Builds on ADR-098 ADR-184 ADR-188

ADR-196 The validation library's cache is bounded: 8,192 record-set proofs per upstream groupProposed

Context

  • hickory-net's validating handle keeps one cache of record-set proofs (an LRU) and sizes it at 1,048,576 entries unless told otherwise (DEFAULT_VALIDATION_CACHE_SIZE; validation_cache_size sets another size, in 0.26.3 and 0.26.4 alike). TelltaleDNS never sized it, and builds one handle per upstream group.
  • An expired entry is skipped on lookup but not removed, so entries leave only when the cache is full: memory grows with every distinct record set validated, up to that capacity.
  • hickory-net 0.26.4 (pull request #106) also keys each entry with a copy of its record set and signatures (the fix for GHSA-qgw4-m8xx-p695).
  • Measured on 2026-11-27, an entry costs 1.6-1.7 KiB of RSS on 0.26.4, against 0.22-0.44 KiB on 0.26.3. Unbounded, that is about 1.7 GiB per upstream group at capacity (0.2-0.45 GiB on 0.26.3), far outside spec/00 §5 (64 MiB loaded, a 128 MiB pod limit, a Pi Zero 2 W).

Decision

  • Each group's handle is built with validation_cache_size(8_192) (VALIDATION_CACHE_ENTRIES in telltale-upstream's dnssec.rs). The least recently used entries go first.
  • It is a constant, not a configuration key: the bound is about memory per group, which the measurements below fix, and a key would need writing only when it differs from its default, plus an upgrade-order note. A key can follow if live numbers show a need.
  • A test-only builder sets other sizes for the offline tests.

Measurements (the offline harness on the build machine, debug build; RSS growth over the warmed validator, each case in its own process; filled to 1.25 times its size, the RSS stops growing once the cache is full):

entrieshickory 0.26.4hickory 0.26.3
4,0966.4-6.8 MiB0.9-1.7 MiB
8,19212.7-13.5 MiB1.8-3.5 MiB
16,38425.4-27.1 MiB3.4-7.0 MiB
65,536100.6-108.1 MiB13.8-28.0 MiB

Each range spans three kinds: signed NXDOMAIN (NSEC), signed wildcard answers, unsigned NODATA. A signed answer takes about two entries (its record set and its proof), an unsigned denial one.

What a bound costs (0.26.4; signed names asked twice in turn, upstream questions per name in the second round):

  • A record set validated again while its proof is kept costs only its own question.
  • Once more distinct record sets are validated in turn than the cache holds, each re-validation costs what the first validation did: its zone's key lookups again (3 questions instead of 1 for a signed wildcard answer, the name and two DNSKEY lookups).
  • With 8,192 entries, 2,048 names cost 1.00 each and 16,384 names 3.00. With 16,384 entries, 4,096 names cost 1.00 and 8,192 names already 3.00. The library's own size gives 1.00 for 32,768 names.
  • Re-validation while a proof is still kept happens mainly on prefetch of popular names and after the answer cache evicts an entry; the answer cache serves repeats meanwhile.

Consequences

  • Worst case per upstream group: about 13 MiB on 0.26.4, against about 1.7 GiB unbounded.
  • Below roughly 30,000-60,000 distinct record sets validated, a node uses up to about 10 MiB more than 0.26.3 unbounded did; past that it uses less.
  • Validating handles are kept for up to 65 groups (the map is cleared beyond 64), so the total worst case scales with the groups that validate.
  • A node whose re-validated working set exceeds about 4,000 signed names pays the first-validation cost (two DNSKEY lookups each) for those re-validations.
  • No configuration or wire change, no upgrade order.
  • Revisit if the library frees expired entries or shrinks its keys, or if a live trial shows the bound costs lookups.

Verification

dns_011_offline_validation_cache_is_bounded.

Referenced by ADR-201

ADR-197 A query waiting on another's upstream request takes its outcome; the request is tried once more for the waiting queries, within their timeProposedDNSDNS-006, spec/03 §4: identical concurrent misses share one upstream request (a singleflight map keyed like the cache); the first query leads it and the others wait on it.

Context

DNS-006, spec/03 §4: identical concurrent misses share one upstream request (a singleflight map keyed like the cache); the first query leads it and the others wait on it. When the leader got no answer, each waiting query resolved again on its own, with a new budget. A question an upstream sends back to this node as a query of its own (a forwarder in front of the node that builds its own query, so the option of spec/04 §7 doesn't come along; or an upstream set to leave the option out, ADR-192) waits on the request that sent it.

Decision

a waiting query takes its leader's outcome; the leader's own failed try is tried once more within the time left; a request makes at most two tries.

  • A query waiting on a request takes the leader's outcome: its answer, or its failure (a stale answer where one may be served, otherwise SERVFAIL, as the leader's own client gets).
  • Each query that joins a request carries its deadline: the query budget plus the 100 ms its client waits beyond it, from when it started waiting. A leader whose own try gets no answer tries once more, within the time left until the latest of its followers' deadlines, when at least 100 ms is left. That second try is still the shared request: a query that joins it meanwhile takes its outcome; if it answers while the leader's own client still waits, that client gets the answer too. There is no third try, and a leader that no query joined doesn't try again.
  • A leader that goes away without an outcome (its caller is cancelled, as a DNS64 lookup is when its DoH client disconnects) leaves its followers to resolve on their own, each within the time left until its own deadline, and only with at least 100 ms left.
  • A shortened try (the second one, or that of a follower whose leader went away) runs with the configured budget and is cut from outside when its time is up. Nothing shared with other queries learns the shorter time: the DNSSEC validator keeps the budget of a group's first lookup for every later lookup of that group, an attempt's timeout feeds its upstream's latency average and breaker, and a failed unsigned-zone proof is remembered for a minute.
  • A failed request leaves the map before its failure is published, so a query that arrives after it leads a request of its own.

Alternatives considered

  • The follower takes the leader's outcome, and nothing is tried again. One upstream query per miss in the case above, and the smallest change. Rejected: with one upstream, the leader's only try may wait the whole budget (ADR-165); when that one query or its answer is lost, every query that joined it would get SERVFAIL, where each used to ask again and be answered.
  • The follower resolves again on its own, within its own remaining time instead of a new budget. No bound in the case above: the question that comes back starts as a new client query with a whole budget of its own.
  • Caching resolution failures for a short time (RFC 9520 §3.2): a possible later step. It changes what new queries get after a failure and needs its own design (a cached failure must not hide a stale answer, DNS-007).

What it doesn't change: cache hits; a leader that gets an answer, and the queries waiting on it (they take it, as before); a miss no other query joined (it fails as before, without a second try); no configuration key, no wire or API change.

Consequences

  • A request makes at most two upstream tries, however many queries join it. A question an upstream sends back to this node ends with the request it waits on, and every resolution is done by the latest deadline of the queries waiting on it.
  • Queries whose leader failed share one second try instead of making one each.
  • A query that joins a request during its second try takes that try's outcome, even when its own deadline is later: if that try fails too, it gets SERVFAIL (or a stale answer) then, where it used to make a request of its own.
  • A follower that joined within a few milliseconds of its leader has about 100 ms left when the leader's try ends at the budget, so whether the second try is made for it turns on those milliseconds.
  • The leader's own client gets the second try's answer when it lands within its wait (it used to get SERVFAIL). When the second try fails too, that client is answered up to 100 ms later than before, at the end of its wait, and only when a follower's time made the leader try again.
  • A shortened try that runs out of time emits no upstream event, and its queries still out are dropped rather than left to finish; the leader's first try has already been counted in the upstream's health.
  • Cost: on the follower path, one deadline compared under the lock join already takes; on the leader's failure path, one more map lookup under that lock and a timer for the second try. Nothing on cache hits or on the leader's path when it gets an answer.

Verification

dns_006_singleflight_coalesces_identical_misses (a follower takes the answer; a dropped leader leaves it to resolve), dns_006_a_failed_request_gives_every_waiting_query_its_outcome (100 followers, one failure; a later query leads its own), dns_006_a_second_try_runs_within_the_waiting_queries_time (no follower, no second try; the latest deadline, never a new budget), dns_006_no_second_try_with_less_than_the_least_time_left; through the pipeline: dns_006_an_upstream_that_sends_questions_back_ends_with_the_miss, dns_006_many_queries_for_one_name_share_one_request (20 clients), dns_006_a_follower_whose_leader_ran_out_of_time_gets_the_second_try, dns_006_no_second_try_with_less_than_100_ms_left, dns_006_a_follower_takes_its_leaders_answer, dns_006_a_follower_of_an_abandoned_leader_resolves_within_its_own_time, dns_006_a_second_try_leaves_the_validation_budget_as_configured and dns_006_an_abandoned_follower_leaves_the_validation_budget_as_configured (DNSSEC on: a shortened try as a fresh validator's first lookup, then a name that takes longer than that try had is answered).

REQ: DNS-006, DNS-011.

Requirements DNS-006 DNS-007 DNS-011

Builds on ADR-165 ADR-192

Referenced by ADR-201 ADR-202

ADR-198 An active check is the half-open probe once the backoff has run outProposedDNSUPSGitHub issue #116 and pull request #117 (Greg Pakes): spec/04 §5 opens an upstream's breaker for 10 s (doubling to 5 minutes) and then lets one probe through.

Context

GitHub issue #116 and pull request #117 (Greg Pakes): spec/04 §5 opens an upstream's breaker for 10 s (doubling to 5 minutes) and then lets one probe through. Only a query's attempt order (Group::attempt_order → Health::admit) moved an open breaker to half-open. The active checks keep querying an idle upstream, and lib.rs says this is so that "a recovered or idle upstream's health stays current", but Health::observe ignores every outcome while the breaker is open. So an upstream that no query reached stayed benched for good after it had recovered, while every check succeeded. Seen on 0.8.1: a three-node cluster whose gateway rebooted. All three nodes benched their one upstream (NextDNS over DoH, the only member of default). The two replicas, which serve the LAN, closed it within two minutes. The controller pod, which forwarded no client queries, stayed open for 22 hours, with about 60 successful checks an hour, and reported SEVERE upstream_group_down ("no upstream in group default is answering") the whole time. The first query to reach it closed it at once.

Decision

Upstream::health_check asks Health::admit first. Once the backoff has run out, that moves the breaker to half-open with the check as its probe, so the check's outcome closes the breaker, or opens it again with the backoff doubled, exactly as a query's probe does. While the breaker is closed, admit changes nothing. Before the backoff has run out, the check's outcome still counts in the upstream's statistics (its requests and failures, the rolling window and the latency average), as before, but doesn't move the breaker. While a query's probe is out, the check takes no second probe, and its outcome counts as it always has: whichever of the two is recorded first settles the breaker.

Consequences

an idle upstream that recovered is back in use within about a minute of its backoff ending (a check's own outcome counts as use, so an idle upstream is checked on every other 30 s tick), not at the next query, which on a node without clients may never come. Health findings and telltale_upstream_breaker_state reflect the upstream rather than the node's traffic. A check that fails as the probe doubles the backoff, up to 5 minutes, as a query's failed probe does. The check proves that the upstream answers . NS, often from its cache, not that it resolves other names: a router whose own uplink is down can pass it, and the queries that then fail can open it again. An upstream that doesn't answer . NS with NOERROR stays benched for longer on a lightly used node, since each of its checks opens the breaker again with the backoff doubled: a server that refuses it, such as an authoritative-only server, belongs in a stub zone (DNS-022: stub_zone in the file, "stub": true through the API), and a plugin upstream should answer it. Nothing changes on the query path: a check takes one lock more, about once a minute per idle upstream, and sends nothing that wasn't sent before.

Verification

ups_006_active_check_closes_a_recovered_idle_upstream, ups_006_the_check_loop_closes_an_idle_benched_upstream (the check loop by itself, with no query: the case of issue #116), ups_006_failed_active_check_doubles_the_backoff, ups_006_the_check_takes_the_one_probe_and_a_query_is_still_answered (a query meanwhile is not admitted, and a group of one still answers it); green with and without this decision, as they pin behaviour it keeps: ups_006_active_check_waits_for_the_backoff, ups_006_a_check_settles_the_breaker_while_a_querys_probe_is_out, ups_006_a_check_leaves_a_closed_breaker_alone, ups_006_failed_probes_double_the_backoff_up_to_five_minutes (20 s to the 300 s cap, then 10 s again after a success). The tests' helper records each failure with the 400 ms timeout, so a check in them has a 400 ms timeout. No benchmark: the change is off the query path.

REQ: UPS-006.

Requirements DNS-022 UPS-006

ADR-199 A reverse lookup of a private address is forwarded only by an explicit [[route]]; a client group's own upstreams don't forward itProposedAPIDNSFLTUPSGitHub issue #114 (airart320).

Context

GitHub issue #114 (airart320). ADR-014 (Accepted) answers reverse lookups for the private ranges with NXDOMAIN "unless a local record or an explicit [[route]] covers them" (RFC 6303), so the network's layout doesn't leave it. ADR-096 (Accepted) later turned [[group]] upstreams into a route for the group's devices that matches every name, placed after the explicit routes, and didn't say what that does to these names. The pipeline forwarded a private reverse lookup whenever any route chose the upstream group (Selection::routed), the one made from a group's own upstreams included. So a group pointed at a family or privacy resolver sent its devices' private reverse lookups there, while every other device got NXDOMAIN; with [dnssec] mode = "validate" the reporter got SERVFAIL with EDE 6 for them (the resolver answers these names from its own data, which can't validate: the pattern of ADR-187). Explain said "by [[route]]" for the group's own upstreams and the web UI "matched a route". docs/running.md had been changed to describe the code ("… or the device's group's own upstreams covers it"), while the schema's comment and the 0.8 docs said "a local record or route". ADR-187 left this rule for its own decision, because a change changes answers for some configurations. The owner ruled on 2026-11-28: only an explicit [[route]] forwards these lookups, a group's own upstreams don't; in 0.9.0, with a release note naming the route that keeps the old behaviour, a config check hint, and the Explain label fixed. This settles ADR-014 against ADR-096 in ADR-014's favour; the precedence of ADR-096 is unchanged. Pull request #122 (rough-ton) reached the same rule independently.

Decision

  • A reverse lookup of a private address (the RFC 6303 ranges of [special] private_ptr_nxdomain, ADR-014) is forwarded only when the route that chose its upstream group is an explicit [[route]], with or without a suffix: a route for a reverse zone (168.192.in-addr.arpa), for arpa or for ., a match_group or a match_qtype = ["PTR"] route. The route made from a client group's own upstreams and the default group leave it answered here: NXDOMAIN, not forwarded. Local records and zones still answer first, and a rewrite whose target is such a name is still decided as its target is.
  • Precedence is ADR-096's, unchanged: explicit routes come first, and a later route wins only with a longer suffix, so a group's own route chooses only when no explicit route matches. The router marks the routes it makes from [[group]] upstreams (Route::from_group) and says in the selection whether such a route chose (Selection::by_group_upstreams, beside routed, which stays true for both kinds, so a group's own upstreams still send the device's other names, and its public reverse lookups, to its upstream group). One function, pipeline::private_ptr_answered_here, decides for the pipeline, the explanation and the change simulation, as resolver_arpa_answered_here does for ADR-187.
  • [special] private_ptr_nxdomain = false still forwards every reverse lookup by its route, a group's own upstreams included.
  • Explain names what chose the upstream group. The text of telltale explain says "the client group's own upstreams", "by [[route]]" or "default". ExplainRoute in the API (and the explanation's JSON) gains source: route, group_upstreams or default (additive; routed keeps its value). The web UI's Explain view reads it ("the group's own upstream servers"). A private reverse lookup that the group's own upstreams would otherwise have taken says so in its summary.
  • config check hint. A warning for a client group whose own upstream group has only members at private addresses: an IP literal in a udp, tcp, tls, https, h3 or quic URL, in 10/8, 172.16/12, 192.168/16, 100.64/10, 169.254/16, fc00::/7 or fe80::/10 (an IPv4 address also in its mapped form). It is given while private_ptr_nxdomain is on and no [[route]] forwards any of that group's private reverse lookups (a route whose match_group is empty or names the group, whose match_qtype is empty or has PTR, and whose match_suffix is empty or has ., arpa, in-addr.arpa, ip6.arpa or a name below the last two). It names the route that keeps the old behaviour: match_group = ["<group>"], match_qtype = ["PTR"], upstream_group = "<the group's upstream group>", with both names written as TOML strings (quotation marks and backslashes escaped, control characters as \uXXXX), and the web UI's way: Send a domain to another server with the reverse zone, which forwards it for every device. With [dnssec] mode = "validate" it adds that a route for the reverse zone with dnssec_nta = true, or the zone under [dnssec] negative_trust_anchors, is the one to use there (below). Loopback is left out (a resolver on the same host is usually a recursive one, which keeps these names local itself), and so are host names, DNS stamps, plugins and recursive://: validation can't tell where they answer from. Like every validation warning, it is also logged when the configuration is loaded and listed with a change made through the API.
  • No configuration key, no change to the wire, the configuration schema or the shared configuration. No new requirement ID: DNS-019 and DNS-017 cover it.

What changes on upgrade

  • A device in a group with its own upstreams and no explicit route for its reverse lookups gets NXDOMAIN here for the names of private addresses, where it got its group's resolver's answer. For a family or privacy resolver (the docs' examples) this only stops a leak, and a SERVFAIL in validate mode. For a group pointed at a resolver that knows the network (an office resolver, the router), those names stop resolving for that group until a route is added.
  • The old behaviour for a group: [[route]] match_group = ["<group>"], match_qtype = ["PTR"], upstream_group = "<the group's upstream group>" sends every PTR question of the group's devices there, as before. A route for the reverse zone instead (match_suffix = ["168.192.in-addr.arpa"] with the same match_group) sends only that zone, of every type. A non-PTR question for a private reverse name (a reverse zone's SOA, asked by some clients before a dynamic update) isn't covered by the match_qtype route and is answered here: one case where that route doesn't restore the old answer exactly. The other: the route is exact for a device in that group only; a device that is also in a higher-priority group with its own upstreams follows this route for its PTR questions, where before they went to that group's upstreams (an explicit route comes before every group's own, ADR-096).
  • With [dnssec] mode = "validate", use the reverse-zone route instead and add dnssec_nta = true (or list the zone under [dnssec] negative_trust_anchors): negative trust anchors are taken only from that list and from the match_suffix of routes with dnssec_nta (Pipeline::set_dnssec), so a route without match_suffix can't carry one, and the answers of the group's own resolver for these names are validated. When that resolver answers them from its own data, they can be SERVFAIL with EDE 6 again (the reporter's case); whether they are depends on the resolver (not tested against a real router). In the web UI, Send a domain to another server with the reverse zone makes such a route, for every device, with dnssec_nta = true.
  • Rolling upgrade. The rule is in each node's pipeline, and nothing about it is shared. While a cluster is upgraded, nodes on an earlier version keep forwarding these lookups to the group's upstreams and upgraded nodes answer them here, so the same device can get different answers from different nodes until every node runs this version. An explicit route added for the old behaviour forwards on every version, so adding it first keeps the answers the same throughout.

Consequences

  • Per query: one more bool in the Copy selection that select builds for every query that reaches routing (before the cache lookup), and one per route; no allocation, lock or I/O. The rule itself is read only for a private reverse lookup.
  • A device's private reverse lookups now get the same answer whichever group's upstreams it uses, unless a route says otherwise. That includes a group with upstreams = "default", whose own route also forwarded them before.
  • A device in such a group that asks its neighbours' reverse names (a TV, a NAS) now gets NXDOMAIN for them, so it can raise reverse_sweep findings (ADR-186) after the upgrade, and the query log records those questions as special instead of forwarded or cached.
  • The web UI's Explain view says when a group's own upstream servers chose the upstream group, on the Route card and in the flow diagram (the upstreams path, not a route), from the API's source; without source (an older server) it shows a route as before.
  • ADR-096's "routes are consulted only on a cache miss" was already inaccurate (select runs before every cache lookup, to pick the cache view); it is left as written there and noted here.

Verification

dns_019_private_ptr_stays_local_for_a_groups_own_upstreams (a counting upstream for each group: the tablet's private reverse lookups, IPv4 and IPv6, aren't sent to its group's upstreams; its other names and public reverse lookups are; other devices unchanged; with private_ptr_nxdomain = false they're forwarded to the group's upstreams), dns_019_private_ptr_follows_a_reverse_route_for_the_group (a reverse-zone route with match_group to the group's own upstreams, and one for every device to the router, beside the group's own upstreams), dns_019_private_ptr_follows_a_match_qtype_ptr_route (the hint's route: every PTR question of the group there, the zone's SOA answered here; a match_qtype = ["PTR"] route for every device wins over a group's own upstreams), dns_019_private_ptr_pipeline_explain_and_simulation_agree (no route, a group's own upstreams, with a reverse route or a PTR route for the group, match_qtype, match_group, arpa and . routes, for three devices and three names), ups_007_a_selection_says_when_a_groups_own_upstreams_chose_it (the router), api_011_explain_names_a_groups_own_upstreams (the text, the field and the summary), dns_019_config_check_hints_at_a_groups_private_upstreams (the warning, the routes that quiet it and those that don't, and the configurations without one), dns_019_config_check_hint_names_the_trust_anchor_in_validate_mode (the web UI's way in every mode; the trust anchor only with validate), dns_019_config_check_hint_quotes_names_as_toml (a quote, a backslash and a combining mark read back from the sample), api_011 explain says when a group sends its questions to its own upstream servers (Playwright: the flow's sentence and the Route card, with and without source); kept green: dns_017_reverse_zone_goes_to_its_route, flt_013_explain_agrees_with_the_pipeline (with a private reverse name added), and ADR-187's tests. make bench-smoke against the base.

REQ: DNS-019, DNS-017, UPS-007, FLT-013, API-011.

Requirements API-011 DNS-017 DNS-019 FLT-013 UPS-007

Builds on ADR-014 ADR-096 ADR-186 ADR-187

Referenced by ADR-014 ADR-096 ADR-187

ADR-200 A listener that can't bind on a reload stops nothing else, and its protocol keeps every listener the reload would have closed; a replaced listener whose new settings fail keeps or gets back its previous onesProposedOPSOPS-009 and spec/08 §5: a reload binds new listeners before it closes removed ones, so a moved address never leaves a gap.

Context

OPS-009 and spec/08 §5: a reload binds new listeners before it closes removed ones, so a moved address never leaves a gap. Listeners::apply returned at the first listener that failed to bind. The entries after it were never tried, and no removal was made. A stream listener (tcp, dot, doh, doq, doh3) whose settings changed on the same address was closed just before its successor bound, so a successor that failed (a certificate file not there yet, a port another program took) left that address with nothing serving it. The log still said "listeners unchanged where binding failed".

Decision

the owner's option (a) of 2026-11-28, read conservatively where "apply the removals" meets "DNS keeps answering" (the owner's decision, AGENTS.md rule 3).

  • Every entry is tried. A listener that fails is recorded with its reason (the start-up text, with its hint: OPS-004), and the next entry is tried.
  • A protocol with a listener that could not be bound in a reload keeps all of its listeners that the reload would have closed. Each ListenProto (udp, tcp, dot, doh, doq, doh3) is its own kind: a client of one can't use another, and apply keys them apart (UDP by address, the others by their whole entry). So a failed move keeps its old address answering: a typo in an address (one the machine doesn't have), a port another program holds, an address family the machine can't bind (0.0.0.0:53 replaced by [::]:53 without IPv6). This also holds when the protocol has other listeners, as in the documented setup with one address per family or per network (docs/running.md: "list every address that should answer"). A protocol with no failure has its removals made.
  • A running listener that holds the port of an addition that failed on it is kept (a move between the wildcard address and one address on the same port, or a change of protocol on one port such as tcp to dot). When the failure is a port in use, a restart applies the change. For any other failure (a typo in the address, a certificate file that can't be read), the change needs fixing first, and the error says so.
  • Each kept listener is named in a warning and, unless it holds a port in use, on the error of the failure it is kept for: "... is kept: a Udp listener could not be bound in this reload (fix the cause and reload)", or "... is kept: it holds the port Udp ... needs (fix the cause and reload)".
  • A replaced listener's new certificate files are read first. For a stream listener whose settings changed on the same address, the new certificate and key are read and checked (the TLS server configuration the bind builds from them) before the old listener is closed. If they can't be, the error says so and the old listener keeps serving with its previous settings, untouched: no gap and no drain, and a later reload with the same files only reads them again. The other settings of a listener (limits, path, the proxy flags) can't fail at bind.
  • A replaced listener whose successor fails at the socket is put back. Two sockets can't share one address (TCP and QUIC listeners don't set SO_REUSEPORT), so the old listener stops accepting and lets its open connections finish, and only then are the new settings bound. If they can't bind, the previous settings are bound again at once and kept through the removals. If even that fails, the error says that nothing serves the address. A QUIC listener (doq, doh3) whose port is still held by the endpoint just closed is bound again after 50 ms, up to 20 times. quinn lets the UDP socket go only once the old endpoint's driver task has ended, and that waits for every connection to drain (three probe timeouts each). That is usually within a second, but a client still connected during the close can hold the port longer. Such a failure gets no hint about another program. A TCP socket is free at once.
  • One error for all of them: each failed listener with its reason, in [[listen]] order, joined by | after "N listeners could not bind:". A single failure with nothing kept reads exactly as before. On a reload it is logged with "the other listener changes were applied, except where this line or a line above says a listener was kept". An info line then lists every listener that serves ("DNS listeners after the reload"), also after a reload that changed [[listen]] without a failure. At start-up the node still doesn't start, and the error names every listener that failed.

The gap that remains

a same-address replacement whose new files can be read. While the old listener's open connections finish, new connections to the address wait in the kernel's queue and are reset when its socket closes. That is up to the idle timeout (10 s by default), or about 30 s for a client that stalls in a PROXY header, a TLS handshake or a write; it is usually milliseconds. Only between the close and the bind (well under a millisecond) are they refused. A drain longer than 1 s is logged at info. A doq or doh3 listener refuses new connections as soon as it stops (for up to 2 s while its connections go idle), and its successor binds once the old endpoint lets the port go (above). A new address, a new protocol, and plain UDP (which has no settings besides its address, so it is never replaced) have no gap. Queries keep being answered on every other listener throughout.

Alternatives considered

  • Close the old listener when its move fails (option (a) read literally): a reload could leave a protocol, or the whole node, with nothing serving, while /readyz stays ready. Not chosen.
  • Keep a protocol's removed listeners only when it would otherwise have none (the first version of this decision): the documented setup with an address per family lost the failed address's old listener, so IPv4 DNS stopped while IPv6 answered. Not chosen.
  • (b) Close before bind for every move on the same port (the wildcard address to one address and back): it applies such moves on a reload, with a short gap like a same-address replacement. Not chosen: the gap would come to a change that serves today with none, and the restart that applies it is already documented.
  • SO_REUSEPORT on TCP and QUIC listeners, so a successor binds before the old one closes: no gap at all, but it lets another process with the same user share the port, and it is a change to telltale-net that needs its own review.
  • For QUIC, await the accept task instead of aborting it, and yield before binding: it leaves the endpoint's driver task, which holds the socket, to the runtime's timing. The bounded retry doesn't depend on it.

Consequences

  • A reload with one bad listener applies everything else. The log says which listener failed, why, what was kept, and what serves. DNS keeps answering at every address it answered at before a failed move.
  • The cost: when two listeners of one protocol move in one reload and only one move fails, the other's old address is kept too (its port stays held) until a reload where everything binds. Likewise, a listener the operator meant to close (narrowing a wildcard listener to one address, say) keeps serving while its replacement can't bind. The warning names it; removing the failing entry or a restart closes it.
  • A kept or put-back listener keeps its old address or previous settings until a reload whose settings bind. Until then the running configuration (and sources.config) lists the wanted listeners, not the bound ones; the info line has the bound ones.
  • A put-back after a socket error means the next reload with the same settings tries again, with the same short gap.
  • Nothing changes on the query path: this is start-up and reload code.

Verification

  • Real sockets on loopback, red before this decision: ops_009_a_failed_listener_does_not_stop_the_next, ops_009_removals_happen_after_a_failed_addition (of another protocol), ops_009_the_error_names_every_failed_listener, ops_009_a_listener_holding_a_failed_ones_port_keeps_serving.
  • Red on the first version of this decision:
    • ops_009_a_failed_move_keeps_the_last_listener_of_its_kind (UDP and TCP, both answer);
    • ops_009_a_move_that_cannot_bind_keeps_dns_answering (a typo, a busy port, the other family);
    • ops_009_a_replacement_with_missing_files_never_closes_the_old (a connection opened before two reloads still answers);
    • ops_009_a_doq_replacement_on_the_same_address_serves (DoQ and DoH3; red before the retry, with "Address already in use" for the successor and the put-back).
  • Red on its second version:
    • ops_009_a_failed_move_of_one_of_two_keeps_its_old_address;
    • ops_009_a_dual_stack_typo_keeps_the_old_ipv4_address (one address per family for UDP and TCP; ::1 where the host has it, else a second loopback address);
    • ops_009_a_typo_on_the_same_port_keeps_the_old_and_says_fix_it;
    • ops_009_a_moved_dot_listener_with_missing_files_keeps_the_old.
  • The put-back:
    • ops_009_a_failed_successor_is_put_back_by_apply: a test-only switch makes the successor's bind fail right after the close, as a socket error a test can't time would;
    • ops_009_a_failed_replacement_puts_the_old_listener_back and ops_009_a_replacement_that_cannot_be_put_back_says_so drive bind_previous from a closed listener.
  • Also ops_009_bound_lists_what_serves. The OPS-004 tests keep their text (ops_004_busy_port_held_by_this_server_has_no_hint pins the holder of a port in use).
  • Not tested: the two log lines of reload() itself, start-up with a failing listener, and a QUIC client still connected during the close.

REQ: OPS-009, OPS-004.

Requirements OPS-004 OPS-009