Decide whether Ninlil listeners claim their port exclusively on Windows, where another socket can share it #403
Labels
No labels
agent
api-regen
agent
architect
agent
coder
agent
console-coder
agent
docs-writer
agent
mechanic
agent
protocol-coder
agent
storage-coder
area/api
area/ci
area/console
area/dhcp
area/dns
area/docs
area/packaging
area/process
area/storage
area/windows
kind
bug
kind
chore
kind
docs
kind
epic
kind
feature
kind
performance
kind
security
kind
test
priority
high
priority
low
priority
medium
resolution
duplicate
resolution
not-a-bug
resolution
wontfix
status
blocked
status
in-progress
status
needs-decision
status
needs-design
status
ready
theme
ad-samba-dns
theme
alternatives-benchmark
theme
console-toolchain
theme
later
theme
parity-devices
theme
parity-query
theme
post-release-fixes
theme
tracker-setup
theme
valkey
theme
windows-installer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lantea-one/ninlil#403
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A design question that came out of #397. No change is made until the owner decides.
What Windows does
[::]:Pand a separate socket on127.0.0.1:Pcan both bind the same port. An IPv4 client that connects to127.0.0.1:Pthen reaches the specific-address socket, not the wildcard listener. Linux refuses the second bind.Socket.ExclusiveAddressUse = trueon the listener, the shared bind fails in either order. Rebinding an exclusive listener right after a close worked on loopback for TCP (with connections established and in TIME_WAIT) and for UDP.The trade-off
FailedAddresses, an error in the log,/status). For an explicit list of listen addresses only that address fails. For the default configuration (one dual-stack wildcard socket) the whole transport is down.svchost(the connection sharing service is running) holds UDP0.0.0.0:53, and the virtual switch has the address 172.17.96.1. Nothing listens on TCP 53 there. Whether Ninlil's default UDP bind on port 53 succeeds beside that socket today, and which of the two then receives queries, has not been tested.To decide
netstat -ano | findstr :53) and what Hyper-V, WSL and connection sharing do with port 53.First step
/statusshows, with and without exclusive use.Measurements from the #397 work, taken on lofnheim (Windows, .NET sockets, TCP unless noted). They describe how a wildcard dual-stack socket and a specific-address socket behave on one port.
Without exclusive use
[::]:Plistener (IPv6Only off) is up, then a plain IPv4 socket binds127.0.0.1:P. The bind is allowed and listens. An IPv4 client connecting to127.0.0.1:Pis queued on the specific socket, not the dual-stack one.127.0.0.1:Plistener is up, then a dual-stack[::]:Pbind. The bind is allowed. Clients of127.0.0.1still go to the specific socket.With
ExclusiveAddressUse = trueon the dual-stack socketIPv6Onlybefore or afterExclusiveAddressUsemakes no difference.127.0.0.1bind: refused ("forbidden by its access permissions").Other observations
127.0.0.1port-0 binds while a dual-stack listener held port P never landed on P, so only explicit-port binds collide.IPGlobalProperties.GetActiveTcpListeners/GetActiveUdpListeners) shows one dual-stack socket as two wildcard entries,0.0.0.0:Pand[::]:P, for TCP and UDP alike. A specific-address socket adds its own entry. Linux lists one[::]entry.0.0.0.0:53(SharedAccess and hns running), vEthernet (Default Switch) is 172.17.96.1, nothing listens on TCP 53. Not yet tested: what Ninlil's default bind on port 53 does beside that socket.Trade-off
Exclusive use turns a silent loss of clients into a failed bind. With the default single dual-stack socket, the whole transport is then lost whenever another program holds the same port on one specific address.
Options to weigh
#397 itself is fixed in the test only and changes no product behaviour.
Owner decision, 2026-11-13: yes. Ninlil's listeners claim their port exclusively on Windows, so that no other socket can share it.
This issue is now the implementation task for that decision. The measurements in the comment above show which socket combinations Windows allows today; the work is to set exclusive address use on every listener socket Ninlil binds on Windows and to prove with a test on the Windows runner that a second bind fails.
Owner decision, 2026-11-13, on what happens when the exclusive wildcard bind fails on Windows: fall back to one exclusive bind per local address.
Why it came up: on a Windows machine where another program already holds UDP 53 on the wildcard address (measured on the Windows runner:
svchostfor connection sharing, Hyper-V and WSL holds0.0.0.0:53), an exclusive wildcard bind of UDP 53 fails, while a shared one succeeds today. Exclusive binds on127.0.0.1:53and::1:53succeed beside that socket. Without a fallback, DNS over UDP would stop starting on such a machine with the default configuration.