Skip to content

Commit

Permalink
Merge pull request #2484 from thaJeztah/18.09_backport_fix_key_spi_panic
Browse files Browse the repository at this point in the history
[18.09 backport] Fix panic in drivers/overlay/encryption.go
  • Loading branch information
selansen authored Nov 16, 2019
2 parents 869f109 + bb1bea6 commit 48722da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ func (c *controller) handleKeyChange(keys []*types.EncryptionKey) error {
err := driver.DiscoverNew(discoverapi.EncryptionKeysUpdate, drvEnc)
if err != nil {
logrus.Warnf("Failed to update datapath keys in driver %s: %v", name, err)
// Attempt to reconfigure keys in case of a update failure
// which can arise due to a mismatch of keys
// if worker nodes get temporarily disconnected
logrus.Warnf("Reconfiguring datapath keys for %s", name)
drvCfgEnc := discoverapi.DriverEncryptionConfig{}
drvCfgEnc.Keys, drvCfgEnc.Tags = c.getKeys(subsysIPSec)
err = driver.DiscoverNew(discoverapi.EncryptionKeysConfig, drvCfgEnc)
if err != nil {
logrus.Warnf("Failed to reset datapath keys in driver %s: %v", name, err)
}
}
return false
})
Expand Down
2 changes: 1 addition & 1 deletion drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{})
}
}
if err := d.updateKeys(newKey, priKey, delKey); err != nil {
logrus.Warn(err)
return err
}
default:
}
Expand Down

0 comments on commit 48722da

Please sign in to comment.