From ad33e47270509345469af795aed65177df88904e Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 9 Mar 2024 16:46:45 -0800 Subject: [PATCH] ipn/{ipnlocal,localapi}: add debug verb to force spam IPN bus NetMap To force the problem in its worst case scenario before fixing it. Updates tailscale/corp#17859 Change-Id: I2c8b8e5f15c7801e1ab093feeafac52ec175a763 Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 14 ++++++++++++++ ipn/localapi/localapi.go | 2 ++ 2 files changed, 16 insertions(+) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index efd3eb6ea..818131c16 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -2367,6 +2367,20 @@ func (b *LocalBackend) DebugNotify(n ipn.Notify) { b.send(n) } +// DebugNotifyLastNetMap injects a fake notify message to clients, +// repeating whatever the last netmap was. +// +// It should only be used via the LocalAPI's debug handler. +func (b *LocalBackend) DebugNotifyLastNetMap() { + b.mu.Lock() + nm := b.netMap + b.mu.Unlock() + + if nm != nil { + b.send(ipn.Notify{NetMap: nm}) + } +} + // DebugForceNetmapUpdate forces a full no-op netmap update of the current // netmap in all the various subsystems (wireguard, magicsock, LocalBackend). // diff --git a/ipn/localapi/localapi.go b/ipn/localapi/localapi.go index a361d8030..41bfe2bd0 100644 --- a/ipn/localapi/localapi.go +++ b/ipn/localapi/localapi.go @@ -599,6 +599,8 @@ func (h *Handler) serveDebug(w http.ResponseWriter, r *http.Request) { break } h.b.DebugNotify(n) + case "notify-last-netmap": + h.b.DebugNotifyLastNetMap() case "break-tcp-conns": err = h.b.DebugBreakTCPConns() case "break-derp-conns":