A known-clients-only scope offers addresses only to clients with a reservation in the scope or an entry in the client registry #168

Open
opened 2026-10-31 12:42:19 -04:00 by claude · 0 comments
Owner
  • Draft: PN-24
  • Priority: medium
  • Agent: coder
  • Depends on: #166, #144
  • Decisions: Q-PN-10, R2-PN24

Why

A scope that serves only known devices keeps strangers off a network; the owner defined "known" as a reservation or a registry entry.

What changes

  • New IDhcpKnownClientPolicy in src/dotnet/src/Ninlil.Dhcp.Server.Core/Allocation/. A client is known when either holds:
    • it has a DhcpReservationEntity in this scope, or
    • its identifier is in the client registry: IDnsClientAddressRepository.GetByIdentifierAsync (src/dotnet/src/Ninlil.Dns.Data.Abstractions/Repository/IDnsClientAddressRepository.cs:26-30), keyed the way DhcpClientRegistryAutoPopulationService keys it (the MAC for DHCPv4; the DUID or a DhcpClientIdentifierLinkKeys key for DHCPv6, DhcpClientRegistryAutoPopulationService.cs:29-39). Ninlil.Dhcp.Server.Core already references Ninlil.Dns.Data.Abstractions (Ninlil.Dhcp.Server.Core.csproj:64).
    • A registry row with Origin = Discovered and IsAcknowledged = false (#144) does not count (owner decision R2-PN24). Otherwise passive discovery (on by default, Q-PN-1) would make every device seen on the LAN known and the switch would do nothing. Acknowledging a discovered device is how an operator makes it known. Rows created by DHCP auto-population (Origin = Dhcp) count.
  • Dhcpv4LeaseAllocationService (entry near line 110) and Dhcpv6LeaseAllocationService: when KnownClientsOnly is set and the policy says unknown, allocate nothing.
    • DHCPv4: send no OFFER (silence; RFC 2131 §4.3.1 leaves the choice to the server).
    • DHCPv6: answer with status NoAddrsAvail (RFC 9915 §18.3.1).
    • Log at debug once per client per window.
  • DhcpScopesController accepts the flag. README.md DHCP section explains what "known" means, including the acknowledge step.

Acceptance

  • This test fails first: Allocate_InAKnownOnlyScopeForAnUnknownClient_ReturnsNoLease in src/dotnet/tests/Ninlil.Dhcp.Server.Core.Tests.
  • Tests: a reservation makes a client known; a manual registry entry makes it known; an unacknowledged discovered entry does not; an acknowledged one does; a DHCPv6 DUID-LL linked to a registered MAC is known; the v6 NoAddrsAvail status.
  • Gate: dotnet test src/dotnet/tests/Ninlil.Dhcp.Server.Core.Tests, dotnet test src/dotnet/tests/Ninlil.Web.Tests.

Source

audit-feature-parity.md §2A #14.
Owner decision 2026-10-31: "known client: either a reservation in the scope OR in the client registry" (Q-PN-10).
Owner decision 2026-10-31, round 2 (R2-PN24): "unacknowledged discovered devices are not known".

- **Draft:** PN-24 - **Priority:** medium - **Agent:** coder - **Depends on:** #166, #144 - **Decisions:** Q-PN-10, R2-PN24 ### Why A scope that serves only known devices keeps strangers off a network; the owner defined "known" as a reservation or a registry entry. ### What changes - New `IDhcpKnownClientPolicy` in `src/dotnet/src/Ninlil.Dhcp.Server.Core/Allocation/`. A client is known when either holds: - it has a `DhcpReservationEntity` in this scope, or - its identifier is in the client registry: `IDnsClientAddressRepository.GetByIdentifierAsync` (`src/dotnet/src/Ninlil.Dns.Data.Abstractions/Repository/IDnsClientAddressRepository.cs:26-30`), keyed the way `DhcpClientRegistryAutoPopulationService` keys it (the MAC for DHCPv4; the DUID or a `DhcpClientIdentifierLinkKeys` key for DHCPv6, `DhcpClientRegistryAutoPopulationService.cs:29-39`). `Ninlil.Dhcp.Server.Core` already references `Ninlil.Dns.Data.Abstractions` (`Ninlil.Dhcp.Server.Core.csproj:64`). - A registry row with `Origin = Discovered` and `IsAcknowledged = false` (#144) does not count (owner decision R2-PN24). Otherwise passive discovery (on by default, Q-PN-1) would make every device seen on the LAN known and the switch would do nothing. Acknowledging a discovered device is how an operator makes it known. Rows created by DHCP auto-population (`Origin = Dhcp`) count. - `Dhcpv4LeaseAllocationService` (entry near line 110) and `Dhcpv6LeaseAllocationService`: when `KnownClientsOnly` is set and the policy says unknown, allocate nothing. - DHCPv4: send no OFFER (silence; RFC 2131 §4.3.1 leaves the choice to the server). - DHCPv6: answer with status NoAddrsAvail (RFC 9915 §18.3.1). - Log at debug once per client per window. - `DhcpScopesController` accepts the flag. README.md DHCP section explains what "known" means, including the acknowledge step. ### Acceptance - [ ] This test fails first: `Allocate_InAKnownOnlyScopeForAnUnknownClient_ReturnsNoLease` in `src/dotnet/tests/Ninlil.Dhcp.Server.Core.Tests`. - [ ] Tests: a reservation makes a client known; a manual registry entry makes it known; an unacknowledged discovered entry does not; an acknowledged one does; a DHCPv6 DUID-LL linked to a registered MAC is known; the v6 NoAddrsAvail status. - [ ] Gate: `dotnet test src/dotnet/tests/Ninlil.Dhcp.Server.Core.Tests`, `dotnet test src/dotnet/tests/Ninlil.Web.Tests`. ### Source `audit-feature-parity.md` §2A #14. Owner decision 2026-10-31: "known client: either a reservation in the scope OR in the client registry" (Q-PN-10). Owner decision 2026-10-31, round 2 (R2-PN24): "unacknowledged discovered devices are not known".
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#168
No description provided.