mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-05 02:16:27 +00:00
ipn/ipnlocal: fix LocalBackend.WhoIs for self (#9472)
9538e9f970
broke LocalBackend.WhoIs
where you can no longer lookup yourself in WhoIs.
This occurs because the LocalBackend.peers map only contains peers.
If we fail to lookup a peer, double-check whether it is ourself.
Fixes #9470
Signed-off-by: Joe Tsai <joetsai@digital-static.net>
Co-authored-by: Rhea Ghosh <rhea@tailscale.com>
This commit is contained in:
@@ -868,9 +868,16 @@ func (b *LocalBackend) WhoIs(ipp netip.AddrPort) (n tailcfg.NodeView, u tailcfg.
|
||||
return zero, u, false
|
||||
}
|
||||
}
|
||||
if b.netMap == nil {
|
||||
return zero, u, false
|
||||
}
|
||||
n, ok = b.peers[nid]
|
||||
if !ok {
|
||||
return zero, u, false
|
||||
// Check if this the self-node, which would not appear in peers.
|
||||
if !b.netMap.SelfNode.Valid() || nid != b.netMap.SelfNode.ID() {
|
||||
return zero, u, false
|
||||
}
|
||||
n = b.netMap.SelfNode
|
||||
}
|
||||
u, ok = b.netMap.UserProfiles[n.User()]
|
||||
if !ok {
|
||||
|
Reference in New Issue
Block a user