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:
parent
c5b2a365de
commit
ae89482f25
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue