A single-label query is tried as <name>.<local domain> in Ninlil's own zones when a local domain is set #138

Open
opened 2026-10-31 12:42:13 -04:00 by claude · 0 comments
Owner
  • Draft: PQ-43
  • Priority: medium
  • Agent: coder
  • Depends on: #136
  • Decisions: R2-BARE

Why

The owner added a third bare-name source in round 2: a chosen "local domain". A query for printer is then tried as printer.<local domain> in a zone Ninlil hosts, so static records an operator keeps in the home zone answer bare names too. It comes after the DHCP names (#137) and the hosts files (#175), before NXDOMAIN.

What changes

  • DnsHygieneOptions.LocalDomain (string; empty, the default, turns the source off). The class is already in OptionsEnvironmentVariableRegistry (#136); add the ENVIRONMENT.md row (NINLIL_DNS_SERVER_HYGIENE_LOCAL_DOMAIN; check the derived name with the map) and recount the totals.
  • src/dotnet/src/Ninlil.Dns.Server.Authoritative/Hygiene/LocalDomainHostNameSource.cs (new), implementing ILocalHostNameSource with Order = LocalHostNameSourceOrder.LocalDomain (third):
    • Reads IOptionsMonitor<DnsHygieneOptions>, so a change applies at once.
    • With LocalDomain set, looks up <name>.<LocalDomain> through AuthoritativeZoneCache.FindZone and CachedZone.GetRecords (src/dotnet/src/Ninlil.Dns.Server.Authoritative/Cache/CachedZone.cs:165-178). Only a zone the authoritative resolver answers counts; a forwarder-type zone (AuthoritativeQueryResolver.cs:75-79) does not.
    • Answers the records of the asked type at that name, static and DHCP-managed alike, as copies owned by the bare name with their stored TTL. A name that exists with no record of that type is NODATA.
    • Technical call: a CNAME at that name is answered as the CNAME alone, owned by the bare name, and not chased. The client follows it, and the source never has to leave the local zone.
    • No hosted zone matches LocalDomain: nothing found (#140 reports this to the operator).
  • Register it in ServiceCollectionAuthoritativeExtension.
  • #101 outcome, when present: AnswerSource = Authoritative.
  • README "Home network defaults": the full bare-name order and the local domain setting, and how it differs from the hosts-file ExpandDomain (#173: that one makes a bare name from a file also answer as a full name).

Acceptance

  • Test fails first in src/dotnet/tests/Ninlil.Dns.Server.Authoritative.Tests: with LocalDomain = "lan" and a static printer.lan A 192.168.1.30, FindAsync("printer", A, client) returns printer A 192.168.1.30.
  • Test: with LocalDomain empty, nothing is found.
  • Test: printer with only an A record, asked for AAAA, gives NODATA.
  • Test: a forwarder zone named lan gives not found.
  • Test: a CNAME at alias.lan returns the CNAME owned by alias and no target records.
  • Test: changing LocalDomain through the options monitor takes effect on the next lookup.
  • Option added: ENVIRONMENT.md row and totals; dotnet test src/dotnet/tests/Ninlil.Web.Tests --filter FullyQualifiedName~EnvironmentVariable passes.

Source

Owner decision 2026-10-31, round 2 (R2-BARE): "ALSO a chosen local zone (new 'local domain' setting: bare name tried as . in Ninlil's own zones)".

- **Draft:** PQ-43 - **Priority:** medium - **Agent:** coder - **Depends on:** #136 - **Decisions:** R2-BARE ### Why The owner added a third bare-name source in round 2: a chosen "local domain". A query for `printer` is then tried as `printer.<local domain>` in a zone Ninlil hosts, so static records an operator keeps in the home zone answer bare names too. It comes after the DHCP names (#137) and the hosts files (#175), before NXDOMAIN. ### What changes - `DnsHygieneOptions.LocalDomain` (string; empty, the default, turns the source off). The class is already in `OptionsEnvironmentVariableRegistry` (#136); add the ENVIRONMENT.md row (`NINLIL_DNS_SERVER_HYGIENE_LOCAL_DOMAIN`; check the derived name with the map) and recount the totals. - `src/dotnet/src/Ninlil.Dns.Server.Authoritative/Hygiene/LocalDomainHostNameSource.cs` (new), implementing `ILocalHostNameSource` with `Order = LocalHostNameSourceOrder.LocalDomain` (third): - Reads `IOptionsMonitor<DnsHygieneOptions>`, so a change applies at once. - With `LocalDomain` set, looks up `<name>.<LocalDomain>` through `AuthoritativeZoneCache.FindZone` and `CachedZone.GetRecords` (`src/dotnet/src/Ninlil.Dns.Server.Authoritative/Cache/CachedZone.cs:165-178`). Only a zone the authoritative resolver answers counts; a forwarder-type zone (`AuthoritativeQueryResolver.cs:75-79`) does not. - Answers the records of the asked type at that name, static and DHCP-managed alike, as copies owned by the bare name with their stored TTL. A name that exists with no record of that type is NODATA. - **Technical call:** a CNAME at that name is answered as the CNAME alone, owned by the bare name, and not chased. The client follows it, and the source never has to leave the local zone. - No hosted zone matches `LocalDomain`: nothing found (#140 reports this to the operator). - Register it in `ServiceCollectionAuthoritativeExtension`. - #101 outcome, when present: `AnswerSource = Authoritative`. - README "Home network defaults": the full bare-name order and the local domain setting, and how it differs from the hosts-file `ExpandDomain` (#173: that one makes a bare name from a file also answer as a full name). ### Acceptance - [ ] Test fails first in `src/dotnet/tests/Ninlil.Dns.Server.Authoritative.Tests`: with `LocalDomain = "lan"` and a static `printer.lan A 192.168.1.30`, `FindAsync("printer", A, client)` returns `printer A 192.168.1.30`. - [ ] Test: with `LocalDomain` empty, nothing is found. - [ ] Test: `printer` with only an A record, asked for AAAA, gives NODATA. - [ ] Test: a forwarder zone named `lan` gives not found. - [ ] Test: a CNAME at `alias.lan` returns the CNAME owned by `alias` and no target records. - [ ] Test: changing `LocalDomain` through the options monitor takes effect on the next lookup. - [ ] Option added: ENVIRONMENT.md row and totals; `dotnet test src/dotnet/tests/Ninlil.Web.Tests --filter FullyQualifiedName~EnvironmentVariable` passes. ### Source Owner decision 2026-10-31, round 2 (R2-BARE): "ALSO a chosen local zone (new 'local domain' setting: bare name tried as <name>.<local zone> in Ninlil's own zones)".
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#138
No description provided.