client,cmd/tailscale,ipn/{ipnlocal,localapi}: add debug CLI command to clear netmap caches (#19213)
This is a follow-up to #19117, adding a debug CLI command allowing the operator to explicitly discard cached netmap data, as a safety and recovery measure. Updates #12639 Change-Id: I5c3c47c0204754b9c8e526a4ff8f69d6974db6d0 Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build !ios && !ts_omit_cachenetmap
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/peterbourgon/ff/v3/ffcli"
|
||||
)
|
||||
|
||||
func init() {
|
||||
debugClearNetmapCacheCmd = func() *ffcli.Command {
|
||||
return &ffcli.Command{
|
||||
Name: "clear-netmap-cache",
|
||||
ShortUsage: "tailscale debug clear-netmap-cache",
|
||||
ShortHelp: "Remove and discard cached network maps (if any)",
|
||||
Exec: runDebugClearNetmapCache,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func runDebugClearNetmapCache(ctx context.Context, args []string) error {
|
||||
if len(args) != 0 {
|
||||
return errors.New("unexpected arguments")
|
||||
}
|
||||
return localClient.DebugAction(ctx, "clear-netmap-cache")
|
||||
}
|
||||
@@ -51,9 +51,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
debugCaptureCmd func() *ffcli.Command // or nil
|
||||
debugPortmapCmd func() *ffcli.Command // or nil
|
||||
debugPeerRelayCmd func() *ffcli.Command // or nil
|
||||
debugCaptureCmd func() *ffcli.Command // or nil
|
||||
debugPortmapCmd func() *ffcli.Command // or nil
|
||||
debugPeerRelayCmd func() *ffcli.Command // or nil
|
||||
debugClearNetmapCacheCmd func() *ffcli.Command // or nil
|
||||
)
|
||||
|
||||
func debugCmd() *ffcli.Command {
|
||||
@@ -394,6 +395,7 @@ func debugCmd() *ffcli.Command {
|
||||
Exec: runPrintStateDir,
|
||||
},
|
||||
ccall(debugPeerRelayCmd),
|
||||
ccall(debugClearNetmapCacheCmd),
|
||||
}...),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user