headscale/hscontrol/policy
Kristoffer Dalby d5b2837231 policy/v2: match default proto set for tests with no proto
The policy `tests` block lets entries omit `proto`. Tailscale's client
maps that to the default protocol set {TCP, UDP, ICMP, ICMPv6} — the
captured packet_filter_matches show all four IANA numbers explicitly
when no proto is set — and a rule restricted to any one of them
satisfies an empty-proto reachability test.

srcReachesDst was passing the empty Protocol through unchanged, which
landed an empty []int in ruleMatchesProto. The matcher then short-
circuited to "no match" for every rule with a non-empty IPProto
restriction, including TCP-only grants compiled from `ip: ["tcp:80"]`.
The bug surfaced in the captured allpass-acls-and-grants-mixed
scenario: the grant `tag:client → webserver:80` was reachable in the
compiled filter but the empty-proto test could not see it.

Expand the empty Protocol to the default set at the call site so
ruleMatchesProto's intersection check sees the right requested
protocols. Drop the now-dead empty-requestedProtos branch from the
matcher. The last divergence drops out of knownPolicyTesterDivergences
as a result.

Updates #1803
2026-05-12 11:54:54 +01:00
..
matcher policy/matcher: include CapGrant.Dsts in match destinations 2026-05-11 14:55:06 +01:00
policyutil policy: surface exit nodes via autogroup:internet (#3212) 2026-04-29 11:24:33 +01:00
v2 policy/v2: match default proto set for tests with no proto 2026-05-12 11:54:54 +01:00
pm.go policy/v2,state,mapper: implement per-viewer via route steering 2026-04-01 14:10:42 +01:00
policy.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
policy_autoapprove_test.go policy/v2: refactor alias resolution to use ResolvedAddresses 2026-04-01 14:10:42 +01:00
policy_route_approval_test.go all: apply golangci-lint 2.9.0 fixes 2026-02-19 08:21:23 +01:00
policy_test.go policy: surface exit nodes via autogroup:internet (#3212) 2026-04-29 11:24:33 +01:00
route_approval_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00