mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 02:31:18 -08:00
A conn25 app grant reaches the connector as a peer capability keyed tailscale.com/cap/conn25/<app>, and peercap.Conn25Prefix already documents that each value under such a key is a tailcfg.ProtoPortRange whose union is what the peer may reach. Nothing implemented that: both consumers only called PeerCapMap.HasCapability, so once a client had registered a transit IP, the connector accepted any protocol on any port to any address in the transit pool. Decode the values when the client registers a transit IP, store them with the mapping, and check every inbound packet against them in the connector's ingress filter hook. A packet from WireGuard addressed to a transit IP always falls through to IngressAllowHooks, since a transit IP is never in localNets, so the check sees every packet rather than just TCP SYNs, and a denial gets the usual RejectedDueToACLs TSMP reply. Split packetFilterAllow in two along the way. linkLocalAllow keeps the old pool-membership behaviour, which exists only to lift the filter's blanket drop of link-local unicast destinations; ingressAllow makes the access decision. A transit IP with no registered mapping still passes ingressAllow, so that the datapath can drop it and answer with the TSMP that prompts the client to re-register. Nothing is forwarded on its behalf. ICMP carries no port, so any grant at all permits it, mirroring how the packet filter treats ICMP for ordinary ACL rules. A capability present with no values permits no traffic, while still resolving and registering so the misconfiguration is diagnosable. Updates tailscale/corp#49815 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>