tailcfg: add a new TailscaleFunnelUsageDetected method

In capver 113 we added new Hostinfo.IngressEnabled field to send to control
info if a node has any active funnel endpoint.
This is on top of the existing Hostinfo.WireIngress field that sends
whether the user intends to use funnel (but it's not neccessarily active).
We are now in a state where control will be parsing Hostinfos
that can use the new (IngressEnabled) field to more correctly
determine if funnel is really enabled as well as Hostinfos
that must use the the old Hostinfo.WireIngress field.

This PR adds a new TailscaleFunnelUsageDetected method
that can be used by control to determine if funnel is enabled
for Hostinfos for clients of capver <= 112.
Once this merges and changes are made control-side to use this method
for <= capver 112 Hostinfos, we can change the
currently used TailscaleFunnelEnabled field to use the new Hostinfo.IngressEnabled field.

Updates tailscale/tailscale#11572
Updates tailscale/corp#25931

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
Irbe Krumina 2025-01-22 11:13:25 +02:00
parent 042ed6bf69
commit a2f0809afe

View File

@ -927,13 +927,24 @@ func (hi *Hostinfo) TailscaleSSHEnabled() bool {
func (v HostinfoView) TailscaleSSHEnabled() bool { return v.ж.TailscaleSSHEnabled() }
// TailscaleFunnelEnabled reports whether or not this node has explicitly
// enabled Funnel.
// TailscaleFunnelEnabled reports whether or not this node has explicitly enabled Funnel.
func (hi *Hostinfo) TailscaleFunnelEnabled() bool {
// TODO(irbekrm): once control uses TailscaleFunnelUsageDetected to determine whether funnel is enabled for
// clients with capver <= 112, use hi.IngressEnabled here.
return hi != nil && hi.WireIngress
}
func (v HostinfoView) TailscaleFunnelEnabled() bool { return v.ж.TailscaleFunnelEnabled() }
// TailscaleFunnelUsageDetected reports whether the node has any funnel config applied to it, including one which
// contains only disabled endpoints.
func (hi *Hostinfo) TailscaleFunnelUsageDetected() bool {
// TODO(irbekrm): I am adding the hi.IngressEnabled check here so that this method keeps working once we change
// the logic to not send Hostinfo.WireIngress when Hostinfo.IngressEnabled is already true. Update this comment
// once we make that change.
return hi != nil && (hi.WireIngress || hi.IngressEnabled)
}
func (v HostinfoView) TailscaleFunnelEnabled() bool { return v.ж.TailscaleFunnelEnabled() }
func (v HostinfoView) TailscaleFunnelUsageDetected() bool { return v.ж.TailscaleFunnelUsageDetected() }
// NetInfo contains information about the host's network state.
type NetInfo struct {