From a81476f4894cc96baa2b124f1a9f6572374fed44 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 20 Oct 2019 20:00:55 -0500 Subject: [PATCH] fix incorrectly held mutex in ckr getPublicKeyForAddress --- src/tuntap/ckr.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tuntap/ckr.go b/src/tuntap/ckr.go index 9af3564a..fdb2bbdc 100644 --- a/src/tuntap/ckr.go +++ b/src/tuntap/ckr.go @@ -263,7 +263,6 @@ func (c *cryptokey) addRemoteSubnet(cidr string, dest string) error { // length specified in bytes) from the crypto-key routing table. An error is // returned if the address is not suitable or no route was found. func (c *cryptokey) getPublicKeyForAddress(addr address.Address, addrlen int) (crypto.BoxPubKey, error) { - c.mutexcaches.RLock() // Check if the address is a valid Yggdrasil address - if so it // is exempt from all CKR checking @@ -285,11 +284,11 @@ func (c *cryptokey) getPublicKeyForAddress(addr address.Address, addrlen int) (c } // Check if there's a cache entry for this addr + c.mutexcaches.RLock() if route, ok := (*routingcache)[addr]; ok { c.mutexcaches.RUnlock() return route.destination, nil } - c.mutexcaches.RUnlock() c.mutexremotes.RLock()