Skip to content

atenet/dns: return NODATA for non-A queries on actor zone - #1062

Closed
SURAJ KUMAR (krsnaSuraj) wants to merge 1 commit into
agent-substrate:mainfrom
krsnaSuraj:fix/atenet-dns-nodata
Closed

atenet/dns: return NODATA for non-A queries on actor zone#1062
SURAJ KUMAR (krsnaSuraj) wants to merge 1 commit into
agent-substrate:mainfrom
krsnaSuraj:fix/atenet-dns-nodata

Conversation

@krsnaSuraj

Copy link
Copy Markdown

atenet/dns: return NODATA for non-A queries on actor zone

Fixes #888

Problem

The actor zone only had a template IN A block. CoreDNS's template plugin returns SERVFAIL when the plugin's zone matches a query name but no template block matches the query type. Strict POSIX resolvers query A and AAAA in parallel and treat SERVFAIL as a hard failure — breaking intra-cluster resolution for actor images that only have IPv4 addresses.

Fix

Add a template IN ANY block (with no answer) that matches the same actor names. Per the CoreDNS template plugin docs, specifying no answer results in a response with an empty answer section and default rcode NOERROR — the NODATA response RFC 8020 expects for a name that exists but has no records of the requested type.

Testing

  • go test ./cmd/atenet/internal/dns/ -count=1 — passes
  • go build ./cmd/atenet/internal/dns/ — clean
  • gofmt -l cmd/atenet/internal/dns/ — clean
  • Generated Corefile verified to contain both blocks:
    template IN A actors.resources.substrate.ate.dev {
      match "^[a-z0-9]([-a-z0-9]*[a-z0-9])?\.[a-z0-9]([-a-z0-9]*[a-z0-9])?\.actors\.resources\.substrate\.ate\.dev\.$"
      answer "{{ .Name }} 60 IN A 10.240.0.10"
    }
    template IN ANY actors.resources.substrate.ate.dev {
      match "^[a-z0-9]([-a-z0-9]*[a-z0-9])?\.[a-z0-9]([-a-z0-9]*[a-z0-9])?\.actors\.resources\.substrate\.ate\.dev\.$"
    }
    

Notes

The actor zone only had a template IN A block. CoreDNS's template plugin
returns SERVFAIL when the zone matches a query name but no template block
matches the query type (e.g. AAAA queries issued in parallel with A by
strict POSIX resolvers). SERVFAIL is treated as a hard failure, breaking
intra-cluster resolution for actor images.

Add a template IN ANY block with no answer, which returns NOERROR with an
empty answer section (NODATA) per RFC 8020 for names that exist but have
no records of the requested type.

Fixes agent-substrate#888
@ygao-g

Copy link
Copy Markdown
Collaborator

FYI I already opened a PR for the issue #888
image

@krsnaSuraj

Copy link
Copy Markdown
Author

Thanks for the heads-up Yuan Gao (@ygao-g) — you're right, #874 covers the same ground (Fixes #888) and was opened a week earlier.

I compared both implementations:

#874 is the more complete and correct approach — it landed first and handles the negative-caching and NXDOMAIN cases properly. I'll close #1062 in favor of it. Thanks for the catch.

@krsnaSuraj

Copy link
Copy Markdown
Author

Closing in favor of #874 (same fix, opened earlier, more complete with SOA authority + fallthrough + docs). Thanks Yuan Gao (@ygao-g) for the FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

atenet/dns: actor zone returns SERVFAIL for every query it does not answer

3 participants