mirror of
https://github.com/tailscale/tailscale.git
synced 2026-12-01 06:02:32 -08:00
initPrefsFromConfig and setConfigLocked both went conf.Parsed.ToPrefs -> ApplyEdits -> SetPrefs/setPrefsLocked without ever calling checkPrefsLocked, so checkCollectLoadMetrics never ran on the config-file paths while ipn/conf.go plumbed CollectLoadMetrics straight through. A config file could therefore turn on per-route load metrics on an App Connector, which the check exists specifically to prevent: an App Connector advertises one /32 per DNS-resolved address, so 20,000 resolved addresses become 80,000 series at roughly 27MB. The k8s operator writes exactly this config shape. They can't just call checkPrefsLocked: it starts by rejecting any reconfiguration while a config file is in use, which is true by construction on these paths, so it would fail every config load. Adds checkConfigPrefsLocked with the subset of checks that describe prefs combinations no source may produce — checkAdvertiseRoutes and checkCollectLoadMetrics — as opposed to the ones that exist to stop a user changing prefs out from under a config file. An invalid config now fails startup, matching how a config with unmasked AdvertiseRoutes already behaves, rather than silently starting with unbounded cardinality. Also fixes the secondary wedge. checkCollectLoadMetrics validates the whole prefs, so once prefs hold the disallowed combination, every later EditPrefs fails — including unrelated ones like setting a hostname. Prefs written by an older client, or by a config file from before the check existed, can hold it. loadSavedPrefs now clears CollectLoadMetrics in that case, exactly as it already force-clears AutoUpdate.Apply for the same class of problem. The load metrics pref is the one dropped, not AppConnector.Advertise: metrics are the opt-in extra and being an App Connector is the node's job. Updates tailscale/corp#45684 Change-Id: I3a75ad0969af4bfb3b94dd443d8426ebf5e1d535 Signed-off-by: Kabir Sikand <[email protected]>