diff --git a/cmd/tailscale/cli/set.go b/cmd/tailscale/cli/set.go index 8c8e04927..f908178a4 100644 --- a/cmd/tailscale/cli/set.go +++ b/cmd/tailscale/cli/set.go @@ -135,6 +135,7 @@ func runSet(ctx context.Context, args []string) (retErr error) { } } + warnOnAdvertiseRouts(ctx, &maskedPrefs.Prefs) var advertiseExitNodeSet, advertiseRoutesSet bool setFlagSet.Visit(func(f *flag.Flag) { updateMaskedPrefsFromUpOrSetFlag(maskedPrefs, f.Name) diff --git a/cmd/tailscale/cli/up.go b/cmd/tailscale/cli/up.go index 1706418b3..2fce3599e 100644 --- a/cmd/tailscale/cli/up.go +++ b/cmd/tailscale/cli/up.go @@ -437,18 +437,7 @@ func runUp(ctx context.Context, cmd string, args []string, upArgs upArgsT) (retE fatalf("%s", err) } - if len(prefs.AdvertiseRoutes) > 0 || prefs.AppConnector.Advertise { - // TODO(jwhited): compress CheckIPForwarding and CheckUDPGROForwarding - // into a single HTTP req. - if err := localClient.CheckIPForwarding(ctx); err != nil { - warnf("%v", err) - } - if runtime.GOOS == "linux" { - if err := localClient.CheckUDPGROForwarding(ctx); err != nil { - warnf("%v", err) - } - } - } + warnOnAdvertiseRouts(ctx, prefs) curPrefs, err := localClient.GetPrefs(ctx) if err != nil { @@ -1159,3 +1148,18 @@ func resolveAuthKey(ctx context.Context, v, tags string) (string, error) { } return authkey, nil } + +func warnOnAdvertiseRouts(ctx context.Context, prefs *ipn.Prefs) { + if len(prefs.AdvertiseRoutes) > 0 || prefs.AppConnector.Advertise { + // TODO(jwhited): compress CheckIPForwarding and CheckUDPGROForwarding + // into a single HTTP req. + if err := localClient.CheckIPForwarding(ctx); err != nil { + warnf("%v", err) + } + if runtime.GOOS == "linux" { + if err := localClient.CheckUDPGROForwarding(ctx); err != nil { + warnf("%v", err) + } + } + } +}