When control deletes a node and the machine re-registers with its
persisted node key, the next netmap has the key on a new nodeID and the
old nodeID absent. magicsock upserted the new peer before removing the
old peer's endpoint, saw a conflict and called devPanicf, crashing
unstable builds (corp services) and leaving the new peer without an
endpoint on stable builds. Remove stale endpoints before upserting, and
treat UpsertPeer of a moved key as an implicit removal of the old
nodeID. Two live peers with one key is a control bug, so controlclient
now drops all but the highest nodeID and logs loudly, and magicsock only
logs if some other caller passes duplicates.
Updates tailscale/corp#52092
Updates tailscale/corp#38410
Updates tailscale/corp#27300
Change-Id: Iedfd312aacd0fb8dcc4dcd459ba26f735269147f
Signed-off-by: Brad Fitzpatrick <[email protected]>