Clear lighthouse cache for a vpn ip on a dead connection when its the final hostinfo (#857)

This commit is contained in:
Nate Brown 2023-05-04 15:42:12 -05:00 committed by GitHub
parent 03e4a7f988
commit 5fe8f45d05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -178,7 +178,10 @@ func (n *connectionManager) doTrafficCheck(localIndex uint32, p, nb, out []byte,
switch decision { switch decision {
case deleteTunnel: case deleteTunnel:
n.hostMap.DeleteHostInfo(hostinfo) if n.hostMap.DeleteHostInfo(hostinfo) {
// Only clearing the lighthouse cache if this is the last hostinfo for this vpn ip in the hostmap
n.intf.lightHouse.DeleteVpnIp(hostinfo.vpnIp)
}
case closeTunnel: case closeTunnel:
n.intf.sendCloseTunnel(hostinfo) n.intf.sendCloseTunnel(hostinfo)
@ -391,7 +394,6 @@ func (n *connectionManager) makeTrafficDecision(localIndex uint32, p, nb, out []
} }
func (n *connectionManager) shouldSwapPrimary(current, primary *HostInfo) bool { func (n *connectionManager) shouldSwapPrimary(current, primary *HostInfo) bool {
// The primary tunnel is the most recent handshake to complete locally and should work entirely fine. // The primary tunnel is the most recent handshake to complete locally and should work entirely fine.
// If we are here then we have multiple tunnels for a host pair and neither side believes the same tunnel is primary. // If we are here then we have multiple tunnels for a host pair and neither side believes the same tunnel is primary.
// Let's sort this out. // Let's sort this out.