From f0422dbd8b99f0a9f6fbfce2b64475095716b6da Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 30 May 2019 17:33:59 +0100 Subject: [PATCH] Fix panic when determining if CKR is enabled --- src/tuntap/ckr.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tuntap/ckr.go b/src/tuntap/ckr.go index c996c397..c9233e64 100644 --- a/src/tuntap/ckr.go +++ b/src/tuntap/ckr.go @@ -115,12 +115,13 @@ func (c *cryptokey) configure() error { // Enable or disable crypto-key routing. func (c *cryptokey) setEnabled(enabled bool) { - c.enabled.Store(true) + c.enabled.Store(enabled) } // Check if crypto-key routing is enabled. func (c *cryptokey) isEnabled() bool { - return c.enabled.Load().(bool) + enabled, ok := c.enabled.Load().(bool) + return ok && enabled } // Check whether the given address (with the address length specified in bytes)