On Windows, Ninlil's listening sockets claim their ports exclusively, with a per-address fallback for the DNS transports #426

Merged
claude merged 12 commits from feature/403-windows-exclusive-listener-ports into develop 2026-11-13 14:39:21 -05:00
Owner

Closes #403

On Windows another socket could bind a port Ninlil serves (a specific address beside the wildcard, or with address reuse) and take some clients' traffic. Ninlil's listening sockets now claim their ports exclusively there. Linux and macOS are unchanged.

What changes on Windows

  • ListenSocketSet (DNS over UDP and TCP, DNS-over-TLS, DNSCrypt), DHCPv4, DHCPv6, TFTP and the web listener (which also serves DNS-over-HTTPS) set SO_EXCLUSIVEADDRUSE before the bind. DHCP and TFTP set it in place of SO_REUSEADDR.
  • Fallback (owner decision on the issue): when the exclusive wildcard bind of a DNS transport fails because another program holds the port, Ninlil binds each local address exclusively and logs one warning. Measured on the Windows runner: svchost holds UDP 0.0.0.0:53 with connection sharing, Hyper-V and WSL; the exclusive wildcard bind fails beside it, binds on specific addresses succeed. Without the fallback DNS over UDP would no longer start on such a machine.
  • DHCPv4, DHCPv6 and TFTP have no fallback (DHCP needs its wildcard socket). Beside another program on their port they do not start, and the failure text names the cause and the netstat hint.
  • DNS-over-QUIC is not covered: MsQuic has no documented setting for it.

Evidence

  • Linux: the verifier read every changed production line and found the socket options unchanged; the whole solution passes without the Docker tests, apart from the two SpaFallbackTests that need a built console.
  • Windows runner: Core, Common.Extension, Plain, DoT, DNSCrypt, DHCPv4, DHCPv6, TFTP and DoH test projects pass; all of Ninlil.Web.Tests passed (2349) before the last small round. The exclusive-port tests and the fallback test are red without the production change.
  • Restart: rebinding the same port right after closing an exclusive TCP listener worked in 16 of 16 local cases (clean close, reset, connection still open). Connections from remote hosts were not tried.

Known limits

  • After a fallback, an address added to the machine later is not served until the transport restarts; the warning and the README say so.
  • The last round (deprecated addresses are kept, per-address failures in the fallback log as warnings, README sentences) was checked by reading the diff and by the Core and Plain test projects on both systems, not by a full verifier round.
  • The subject of commit ee2b8fc8 mentions a README change that the commit does not contain; the README change is in e31057d7.

README "Ports" and the troubleshooting entry describe the rule as measured; CHANGELOG has the entry.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

Closes #403 On Windows another socket could bind a port Ninlil serves (a specific address beside the wildcard, or with address reuse) and take some clients' traffic. Ninlil's listening sockets now claim their ports exclusively there. Linux and macOS are unchanged. **What changes on Windows** - `ListenSocketSet` (DNS over UDP and TCP, DNS-over-TLS, DNSCrypt), DHCPv4, DHCPv6, TFTP and the web listener (which also serves DNS-over-HTTPS) set `SO_EXCLUSIVEADDRUSE` before the bind. DHCP and TFTP set it in place of `SO_REUSEADDR`. - **Fallback (owner decision on the issue):** when the exclusive wildcard bind of a DNS transport fails because another program holds the port, Ninlil binds each local address exclusively and logs one warning. Measured on the Windows runner: `svchost` holds UDP `0.0.0.0:53` with connection sharing, Hyper-V and WSL; the exclusive wildcard bind fails beside it, binds on specific addresses succeed. Without the fallback DNS over UDP would no longer start on such a machine. - DHCPv4, DHCPv6 and TFTP have no fallback (DHCP needs its wildcard socket). Beside another program on their port they do not start, and the failure text names the cause and the `netstat` hint. - DNS-over-QUIC is not covered: MsQuic has no documented setting for it. **Evidence** - Linux: the verifier read every changed production line and found the socket options unchanged; the whole solution passes without the Docker tests, apart from the two `SpaFallbackTests` that need a built console. - Windows runner: Core, Common.Extension, Plain, DoT, DNSCrypt, DHCPv4, DHCPv6, TFTP and DoH test projects pass; all of `Ninlil.Web.Tests` passed (2349) before the last small round. The exclusive-port tests and the fallback test are red without the production change. - Restart: rebinding the same port right after closing an exclusive TCP listener worked in 16 of 16 local cases (clean close, reset, connection still open). Connections from remote hosts were not tried. **Known limits** - After a fallback, an address added to the machine later is not served until the transport restarts; the warning and the README say so. - The last round (deprecated addresses are kept, per-address failures in the fallback log as warnings, README sentences) was checked by reading the diff and by the Core and Plain test projects on both systems, not by a full verifier round. - The subject of commit `ee2b8fc8` mentions a README change that the commit does not contain; the README change is in `e31057d7`. README "Ports" and the troubleshooting entry describe the rule as measured; CHANGELOG has the entry. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
DNS over UDP, TCP and TLS, DNSCrypt, DHCPv4, DHCPv6, TFTP, the web server and DNS over HTTPS
set SO_EXCLUSIVEADDRUSE before binding. The DHCP and TFTP sockets use it instead of
SO_REUSEADDR on Windows, because with both Windows lets another socket share the port. Linux
and macOS behaviour is unchanged.

Closes #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The fake relay agent binds a port of its own and the listener's ServerPort option points at it,
so no port is shared. A new test checks that a Unix-domain-socket endpoint still goes to
Kestrel's default factory.

Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
When the exclusive wildcard bind of a listen-everywhere transport fails (for example UDP 53 held by connection sharing, Hyper-V or WSL), Ninlil binds every usable local address on its own and logs one warning. DHCPv4, DHCPv6 and TFTP failures now name the cause and the netstat command. README.md and CHANGELOG.md describe which listeners fall back, which fail alone and which stop Ninlil.

Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The Windows fallback keeps deprecated addresses and logs a failed address as a warning
All checks were successful
Build / Build Binary (windows-amd64) (push) Successful in -53s
Build / Smoke Test the Windows Binary (push) Successful in 15s
Build / Build Binary (macos-amd64) (push) Successful in -1m20s
Build / Build Binary (macos-arm64) (push) Successful in -1m8s
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Build Arch Linux Packages (push) Successful in -2m21s
Build / Pipeline (pull_request) Successful in 0s
Build / Build and Push Image (push) Successful in -2m21s
Build / Publish Release (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (push) Successful in -20s
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Stage Draft Release (push) Successful in -2m37s
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (common) (push) Successful in -2m29s
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in -2m13s
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in -2m8s
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -2m7s
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (push) Successful in -1m19s
Build / Pipeline (push) Successful in 0s
Build / Build Binary (linux-arm64) (push) Successful in -1m31s
Build / Publish Release (push) Successful in -2m35s
709bf7dfa3
A deprecated address still receives traffic, so the fallback serves it; only tentative, duplicate and invalid addresses are skipped. In the fallback an address that cannot be bound is a Warning, and an Error is logged only when no address could be bound. The README says which addresses are served, that the transport shows as healthy after a complete fallback, and that an explicit :: behaves like a specific address.

Refs #403

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Every admin console table scrolls sideways inside its card on a narrow screen
All checks were successful
Build / Pack and Push NuGet Packages (common) (push) Successful in -2m30s
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in -2m16s
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in -2m12s
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -2m10s
Build / Pack and Push NuGet Packages (common) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (push) Successful in -1m20s
Build / Build Binary (linux-arm64) (push) Successful in -43s
Build / Build Binary (macos-amd64) (push) Successful in -44s
Build / Build Binary (macos-arm64) (push) Successful in -1m5s
Build / Build Binary (windows-amd64) (push) Successful in -51s
Build / Smoke Test the Windows Binary (push) Successful in 15s
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Build Arch Linux Packages (push) Successful in -2m6s
Build / Build and Push Image (push) Successful in -2m33s
Build / Build and Test Deb and RPM Packages (push) Successful in 25s
Build / Publish Release (pull_request) Has been skipped
Build / Pipeline (pull_request) Successful in 0s
Build / Pipeline (push) Successful in 0s
Build / Publish Release (push) Successful in -2m36s
3c6ae3a02e
The bare `responsive` attribute bound an empty string, so CoreUI added no scroll wrapper. All
tables now bind `[responsive]="true"`, and the client list keeps its visually hidden header inside
the wrapper.

Closes #195

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The dashboard Live Activity title and the zone form key headings match the size of their neighbours
All checks were successful
Build / Stage Draft Release (push) Successful in -2m37s
Build / Pack and Push NuGet Packages (common) (push) Successful in -2m30s
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in -2m17s
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in -2m13s
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -2m2s
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (push) Successful in -32s
Build / Build Binary (linux-arm64) (push) Successful in -35s
Build / Build Binary (macos-arm64) (push) Successful in -1m3s
Build / Build Binary (macos-amd64) (push) Successful in -1m3s
Build / Build Binary (windows-amd64) (push) Successful in -1m10s
Build / Smoke Test the Windows Binary (push) Successful in 15s
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Build Arch Linux Packages (push) Successful in -2m10s
Build / Build and Push Image (push) Successful in -2m33s
Build / Build and Test Deb and RPM Packages (push) Successful in 32s
Build / Publish Release (pull_request) Has been skipped
Build / Pipeline (pull_request) Successful in 0s
Build / Publish Release (push) Successful in -2m36s
Build / Pipeline (push) Successful in 0s
88f91dd8f1
The Live Activity heading and the two zone form legends inherit the surrounding text size instead
of Bootstrap's heading sizes. The heading stays an h2.

Closes #196

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
develop comes into the table scroll branch, keeping both release notes
All checks were successful
Build / Build Binary (windows-amd64) (push) Successful in -1m12s
Build / Smoke Test the Windows Binary (push) Successful in 16s
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Build Arch Linux Packages (push) Successful in -1m59s
Build / Build and Push Image (push) Successful in -2m33s
Build / Build and Test Deb and RPM Packages (push) Successful in -17s
Build / Publish Release (pull_request) Has been skipped
Build / Pipeline (pull_request) Successful in 0s
Build / Publish Release (push) Successful in -2m34s
Build / Pipeline (push) Successful in 0s
Build / Pack and Push NuGet Packages (common) (push) Successful in -2m28s
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in -2m15s
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in -2m5s
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -2m4s
Build / Pack and Push NuGet Packages (common) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (push) Successful in -1m26s
Build / Build Binary (macos-amd64) (push) Successful in -42s
Build / Build Binary (macos-arm64) (push) Successful in -1m22s
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (push) Successful in -48s
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
285d4658e6
Refs #195

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
develop and the table scroll branch come into the heading styles branch, keeping every release note
Some checks failed
Build / Build Binary (macos-arm64) (push) Has been skipped
Build / Smoke Test the Windows Binary (push) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build Arch Linux Packages (push) Has been skipped
Build / Build and Test Deb and RPM Packages (push) Has been skipped
Build / Build and Push Image (push) Has been skipped
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Publish Release (push) Has been skipped
Build / Pipeline (push) Failing after 0s
Build / Pipeline (pull_request) Successful in 0s
Build / Publish Release (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (push) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (push) Has been skipped
Build / Stage Draft Release (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (push) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (common) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (push) Has been skipped
Build / Build Binary (macos-amd64) (push) Has been skipped
Build / Build Binary (linux-amd64) (push) Has been skipped
Build / Build Binary (windows-amd64) (push) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
64d6fefcf4
Refs #196

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
develop and the two console branches come into the exclusive ports branch, keeping every release note
All checks were successful
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Windows Test Gate (push) Successful in -2m39s
Build / Stage Draft Release (push) Successful in -2m37s
Build / Pack and Push NuGet Packages (common) (push) Successful in -2m29s
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in -2m13s
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in -2m19s
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -1m47s
Build / Build Binary (linux-amd64) (push) Successful in -57s
Build / Build Binary (linux-arm64) (push) Successful in -54s
Build / Build Binary (macos-amd64) (push) Successful in -46s
Build / Build Binary (macos-arm64) (push) Successful in -1m5s
Build / Build Binary (windows-amd64) (push) Successful in -1m26s
Build / Smoke Test the Windows Binary (push) Successful in 15s
Build / Pipeline (pull_request) Successful in 0s
Build / Publish Release (pull_request) Has been skipped
Build / Build Arch Linux Packages (push) Successful in -1m46s
Build / Build and Test Deb and RPM Packages (push) Successful in -48s
Build / Publish Release (push) Successful in -2m36s
Build / Pipeline (push) Successful in 0s
Build / Build and Push Image (push) Successful in -2m32s
d726cd51ac
Refs #403

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit 3315c1b3de into develop 2026-11-13 14:39:21 -05:00
claude deleted branch feature/403-windows-exclusive-listener-ports 2026-11-13 14:39:21 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil!426
No description provided.