libc resolver compatibility

TAK-OS DNS returns authoritative NOERROR/NODATA when it knows an owner name but has no record of the requested type. This allows ordinary dual-family getaddrinfo lookups to use an IPv4-only or IPv6-only name. A Zone CR or SOA is not required for this answer; an SOA is included when available.

Unknown owner names receive REFUSED with AA=0, including names beneath a configured SOA. An unknown name does not establish that the name does not exist elsewhere. Positive cached answers remain authoritative, and the server never performs recursion or forwards unknown queries.

The Docker harness runs actual C getaddrinfo against two DNS fixtures. This tests the resolver library's behaviour separately from the production listener tests in internal/dnsserver, which verify response flags and RCODEs over UDP and TCP.

Run the harness

From the repository root:

scripts/resolver-compat.sh

Docker with a local engine and permission to build images, create networks and start containers is required. The first build downloads Go, Debian, Alpine and compiler dependencies; subsequent runs reuse Docker's build cache. No host C compiler or Go installation is required. The fixture uses the repository's pinned DNS library and module dependencies.

The script creates an internal Docker network, two DNS fixture containers, and short-lived Debian/glibc and Alpine/musl probe containers. It mounts a private resolv.conf into each probe so queries reach the fixture addresses directly, bypassing Docker's embedded DNS proxy. It publishes no ports and does not change the host's resolver configuration. Exit cleanup removes the containers, network, image tags and temporary files created by that run; build cache can remain.

Each line reports libc, queried name, address family, result, error code, elapsed time and returned addresses. Fixture traces show which servers and transports were used. Save output if an acceptance record is needed:

scripts/resolver-compat.sh > /tmp/tak-dns-resolver-compat.log 2>&1

The probes use timeout:1 attempts:1, a ten-second process alarm, and no local DNS caching daemon. Names are absolute and under the reserved .test suffix.

Scenarios and observed results

The following results were reproduced on 9 November 2026 with glibc 2.41 (Debian trixie) and musl 1.2.5 (Alpine 3.22). Image tags receive updates, so retain the build output and rerun for the versions used by application containers.

Scenario glibc musl
Primary returns a positive A record Primary address Primary address
Primary UDP REFUSED; alternate has a positive A Alternate address Alternate address
Primary UDP SERVFAIL; alternate has a positive A Alternate address Alternate address
Fast primary NXDOMAIN; alternate has a delayed positive A Name lookup fails Name lookup fails
Fast primary authoritative NOERROR with no address data; alternate has a delayed positive A Name lookup fails Name lookup fails
Primary answers A but refuses AAAA; alternate has both; AF_UNSPEC query Primary A only Primary A and alternate AAAA
Primary has A only; both servers refuse AAAA; default AF_UNSPEC query Primary A (about 0.5 ms) Lookup fails after about 1 s (EAI_AGAIN), despite the positive A
Primary has AAAA only; both servers refuse A; default AF_UNSPEC query Primary AAAA (about 0.7 ms) Lookup fails after about 1 s (EAI_AGAIN), despite the positive AAAA
Primary has A only; missing AAAA returns authoritative NOERROR/NODATA without SOA; AF_UNSPEC query Primary A only (about 0.7 ms) Primary A only (about 0.6 ms)
Primary has AAAA only; missing A returns authoritative NOERROR/NODATA without SOA; AF_UNSPEC query Primary AAAA only (about 0.6 ms) Primary AAAA only (about 0.6 ms)
Family-specific query for a missing family at a known owner returns NOERROR/NODATA Lookup fails for that family Lookup fails for that family
Primary UDP TC=1; TCP has positive A/AAAA TCP addresses TCP addresses
Primary UDP TC=1; TCP REFUSED; alternate has positive A Lookup fails (EAI_NONAME) Lookup fails (EAI_AGAIN)
Primary UDP TC=1; TCP SERVFAIL; alternate has positive A Lookup fails (EAI_NONAME) Lookup fails (EAI_AGAIN)
Primary UDP TC=1; TCP NXDOMAIN; alternate has positive A Lookup fails (EAI_NONAME) Lookup fails (EAI_NONAME)
Primary positive delayed 200 ms; alternate immediately returns NXDOMAIN Primary address Name lookup fails

The harness asserts ordinary positive answers, UDP refusal/failure fallback, negative-answer termination, the mixed-family lookup, successful TCP fallback, and the last race scenario. It verifies the expected primary or alternate address and checks fixture traces for TCP usage.

The a-only-nodata and aaaa-only-nodata scenarios assert AF_UNSPEC success and exactly the available address family on both libcs. Their primary and alternate fixtures have equivalent single-family data. For the missing family, they return authoritative NOERROR with no answers and no SOA, exercising zone-free cached owners. Family-specific queries for the missing type must fail. Query traces must show the primary's missing-family NODATA response, so a positive-only shortcut cannot satisfy the test.

The older a-only and aaaa-only scenarios deliberately retain the strict REFUSED response for missing types as comparison observations. Their alternate server refuses every query and cannot supply the missing family. TCP error cases are also observations, allowing future libc versions to improve their fallback without failing the test. These fixtures measure resolver behaviour independently of production listener policy.

Deployment implications

REFUSED supports useful UDP fallback, but no response code guarantees reliable resolution when independent private and public servers share a resolver list. Musl sends queries to multiple configured servers in parallel: a fast public negative can finish the lookup before a private positive arrives. The tested TCP error paths also terminate without using a healthy alternate server.

Use resolver-side domain routing or a recursive resolver with appropriate conditional forwarding when applications need both mesh and public names. TAK-OS DNS remains nonrecursive. Configuring multiple equivalent TAK-OS nodes for availability is a different use case from mixing servers with different knowledge.

Known-owner NODATA preserves single-family lookups. The tested glibc and musl versions both return the available IPv4 or IPv6 address for an ordinary AF_UNSPEC lookup when the other family receives authoritative NOERROR/NODATA. Under the former strict-REFUSED response, musl 1.2.5 discarded the positive family and failed with EAI_AGAIN after the resolver timeout; glibc 2.41 retained it. The harness retains those REFUSED cases to make the behavioural difference visible.

NODATA terminates lookup of that type. A configured alternate server may contain an additional address family that the first responding server lacks, but the client is not guaranteed to consult it after a NODATA response. Prefer equivalent mesh resolvers with converged caches. Unknown-name refusal still does not solve competing negatives from unrelated public/private resolvers or the observed TCP error-path limitations.

These local tests do not prove the behaviour of every libc version, resolver option, application-specific DNS implementation, node-local cache, CNI or production network. Target-cluster acceptance should run representative client images and inspect the actual resolver configuration and routing.

The production listener also returns REFUSED for an RD=true query that would otherwise receive an unanswered, non-authoritative NS referral; it strips the referral authority/glue and leaves RA false. RD=false iterative queries retain referrals. Dedicated UDP/TCP listener tests verify that policy; the libc fixture harness above measures resolver responses independently. Positive CNAME/DNAME alias-only replies are retained without recursion, so external target completion still depends on a suitable recursive resolver at the client.