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":