TUN inbound's autoSystemWfpBlockLeak: Add "allexceptlan"

"allexceptlan" is "all" but for the local network: traffic to and from
private (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7), link-local
(169.254.0.0/16, fe80::/10), multicast (224.0.0.0/4, ff00::/8) and broadcast
(255.255.255.255) addresses stays allowed, so that printers, the router's
settings page, or casting to a TV keep working while nothing else leaves
outside the TUN.

It includes "dns": a resolver on the local network, like the router's,
would forward the queries outside the TUN, so DNS stays blocked there. The
LAN permit sits below the other values, like the permit through the TUN, so
they still apply on the local network, e.g. "tcp/445" blocks Windows file
sharing with it. The DNS Client service keeps mDNS and LLMNR, to the local
network's addresses only. "all" overrides it.

The addresses are matched with FWP_V4_ADDR_MASK and FWP_V6_ADDR_MASK
conditions on the remote address, which match when any of them does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patterniha
2026-11-02 11:50:18 +03:30
co-authored by Claude Opus 5.5
parent 468f745fc2
commit bb4cd4b6d3
8 changed files with 150 additions and 20 deletions
+4 -3
View File
@@ -249,9 +249,10 @@ startOver:
// With autoSystemWfpBlockLeak, once the system routes lead to the TUN,
// keep the protocols and ports given ("dns" stands for those of DNS),
// Windows' DNS Client service, an IP version no route of which leads to
// the TUN ("misconfigtun"), or everything ("all"), from leaving through
// the other interfaces. Addresses do not matter: without one of a version
// in gateway, Windows gives the TUN a link-local one.
// the TUN ("misconfigtun"), or everything ("all", or "allexceptlan" but
// for the local network), from leaving through the other interfaces.
// Addresses do not matter: without one of a version in gateway, Windows
// gives the TUN a link-local one.
leaks, err := ExpandWfpBlockLeak(t.options.AutoSystemWfpBlockLeak)
if err != nil {
return err