Clear cryptographic state when interface down
Attempts to clear the cryptographic state for every peer when the device goes down.
This commit is contained in:
parent
029410b118
commit
4f97b52ea6
5 changed files with 58 additions and 41 deletions
|
|
@ -88,28 +88,6 @@ func unsafeRemovePeer(device *Device, peer *Peer, key NoisePublicKey) {
|
|||
device.routing.table.RemovePeer(peer)
|
||||
peer.Stop()
|
||||
|
||||
// clean index table
|
||||
|
||||
kp := &peer.keyPairs
|
||||
kp.mutex.Lock()
|
||||
|
||||
if kp.previous != nil {
|
||||
device.indices.Delete(kp.previous.localIndex)
|
||||
}
|
||||
|
||||
if kp.current != nil {
|
||||
device.indices.Delete(kp.current.localIndex)
|
||||
}
|
||||
|
||||
if kp.next != nil {
|
||||
device.indices.Delete(kp.next.localIndex)
|
||||
}
|
||||
|
||||
kp.previous = nil
|
||||
kp.current = nil
|
||||
kp.next = nil
|
||||
kp.mutex.Unlock()
|
||||
|
||||
// remove from peer map
|
||||
|
||||
delete(device.peers.keyMap, key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue