control-channel: Resolver filters the Name2IP and DNS groups separately

QA finding 1. `Resolver.addresses` applied one same-subnet check to the
union of the Name2IP mappings and the DNS results. `StartNewTcpClient`
checks each group on its own: the mapped group's failure is a `return`
that skips `Dns.GetHostEntry` entirely (SocketStuff.cs:934-937, 950), so
nothing is dialled for that name that round; the DNS group's failure
(:1037-1040) drops only the DNS addresses, because the mapped ones have
already been dialled (:941). Port that control flow, and document it in
the feature README's Assumptions and docs/protocol.md §10.3 note 6.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
lucioandClaude Opus 5 committed 2026-09-16 01:40:22 -07:00
1 parent 09ca9906e8
commit 43dc25ac71
3 files changed
+46 -20

No files matched your search

+12
View File
@@ -47,6 +47,18 @@ No packet is interpreted here.
Network.framework exposes them (`SocketStuff.cs:1283-1286`) — it
exposes none, so only `NoDelay` is set and the bounded outbox is what
limits queued bytes.
- **Name resolution filters each address group on its own**
(`SocketStuff.cs:928-944, 950, 989-1044`): `Resolver.addresses` runs the
same control flow `StartNewTcpClient` does, not a filter over the union.
The `Name2IP` mappings are checked against the same-subnet rule alone, and
when that check fails Windows returns from `StartNewTcpClient` **before**
`Dns.GetHostEntry` is called (`:934-937, 950`) — so the name is not dialled
at all that round and we return `[]`. The DNS group is filtered by the
reverse lookup and then gets its own same-subnet check (`:1037-1040`);
failing it drops the DNS addresses only, leaving the mapped ones, which
Windows has already handed to `StartNewTcpClientThread` by then. Reverse-
lookup validation never applies to a user-supplied mapping
(`docs/protocol.md` §10.3 note 6).
- **Keep one client per peer** (`SocketStuff.cs:1980-2004`): when a
second connection to the same peer name reaches `.connected`, the
later *client* connection is closed; inbound (server-side) connections