code wiki / (root) / nx_dns_authoritative.nx

nx_dns_authoritative.nx

buildroot/runtime/nx_dns_authoritative.nx

14812 B400 linesdepth 3pulls 4 transitivereach 3 importersview sourcekind librarytopic dns
docsdependenciesstructsconstsfunctions

about

nx_dns_authoritative.nx -- UDP/53 authoritative DNS serve. Composes the shipped DNS substrate (nx_dns.nx endian + label encode/decode + parse) + UDP socket syscalls to serve A records from a caller-provided zone table. Per cardinal feedback-no-third-party-trust-native-or-nothing: substrate's own authoritative DNS. No bind, no powerdns, no nsd, no Cloudflare API. Per cardinal user-owns-every-bit: - Caller provides the zone-table buffer + the listen address. - Substrate doesn't auto-bind to 0.0.0.0:53. Default helper uses 127.0.0.1; public binding is an explicit caller choice. - No upstream resolution. This is AUTHORITATIVE only (RFC 1035 ยง6). Out-of-zone queries get REFUSED, not forwarded. What this primitive does: 1. Parse incoming DNS query packet 2. Extract QNAME + QTYPE 3. Look up QNAME in caller's zone table 4. Build response: header + question echo + answer or NXDOMAIN What this primitive does NOT do (queued): - DNSSEC signing (RFC 4035): nx_dns_dnssec_sign.nx queued - TCP DNS (RFC 7766): use UDP-truncated TC bit to force retry - Zone transfer (AXFR/IXFR): only single-server today - Recursive resolution: out-of-zone -> REFUSED - EDNS(0) OPT pseudo-record: ignored on input, omitted on output Sealed enums: NxDnsAuthVerdict (7 states): OK / SOCKET_ERR / BIND_ERR / RECV_ERR / PARSE_ERR / SEND_ERR / BAD_ARG NxDnsResponseClass (4 states for canonical response codes): NOERROR (0) -- answer matched zone NXDOMAIN (3) -- name not in zone REFUSED (5) -- name not in this server's zone (out-of-scope)

dependencies 2 imports · 3 importers

nx_syscalls_x86_64.nx nx_dns.nx nx_dns_authoritative.nx nx_dns_adversarial_test.nx nx_dns_authoritative_test.nx nx_dns_server_daemon.nx

imports: nx_syscalls_x86_64.nxnx_dns.nx

imported by: nx_dns_adversarial_test.nxnx_dns_authoritative_test.nxnx_dns_server_daemon.nx

structs

98struct NxDnsZone

consts

59const NXDA_OK: i64 = 0
60const NXDA_SOCKET_ERR: i64 = 1
61const NXDA_BIND_ERR: i64 = 2
62const NXDA_RECV_ERR: i64 = 3
63const NXDA_PARSE_ERR: i64 = 4
64const NXDA_SEND_ERR: i64 = 5
65const NXDA_BAD_ARG: i64 = 6
66const NXDA_VERDICT_N: i64 = 7
87const NXDA_RCODE_NOERROR: i64 = 0
88const NXDA_RCODE_SERVFAIL: i64 = 2
89const NXDA_RCODE_NXDOMAIN: i64 = 3
90const NXDA_RCODE_REFUSED: i64 = 5
107const NX_DNS_ZONE_BYTES: i64 = 48

functions

68func nxda_verdict_is_valid(v: i64) -> i64
called by 1: main
74func nxda_verdict_name(v: i64) -> *u8
called by 1: main
109func nx_dns_zone_init(z: *NxDnsZone, cap: i64,
called by 2: mainmain
126func nx_dns_zone_add_a(z: *NxDnsZone,
called by 2: mainmain
167func nx_dns_decode_name_ascii(buf: *u8, n: i64, start: i64,
209func nx_dns_zone_lookup_a(z: *NxDnsZone,
243func nx_dns_build_response(
339func nx_dns_serve_query(z: *NxDnsZone,