Skip to content

Commit

Permalink
Fix missing call of removing groupDb cache when deleting OVS group
Browse files Browse the repository at this point in the history
The old group will be reused unexpectedly if groupDb cache managed
by OFBridge is not cleared for that group, which causes a new group
claims to have a different group type acquiring the old group type.

Fixes #4575

Signed-off-by: ceclinux <src655@gmail.com>
  • Loading branch information
ceclinux committed Feb 1, 2023
1 parent b74f9fe commit 15fd036
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 8 additions & 2 deletions pkg/agent/openflow/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,10 @@ func (c *client) UninstallServiceGroup(groupID binding.GroupIDType) error {
gCache, ok := c.featureService.groupCache.Load(groupID)
if ok {
if err := c.ofEntryOperations.DeleteOFEntries([]binding.OFEntry{gCache.(binding.Group)}); err != nil {
return fmt.Errorf("error when deleting Service Endpoints Group %d: %w", groupID, err)
return fmt.Errorf("error when deleting Openflow entries for Service Endpoints Group %d: %w", groupID, err)
}
if err := c.featureService.bridge.DeleteGroup(groupID); err != nil {
return fmt.Errorf("error when deleting OFSwitch groupDb Cache for Service Endpoints Group %d: %w", groupID, err)
}
c.featureService.groupCache.Delete(groupID)
}
Expand Down Expand Up @@ -1345,7 +1348,10 @@ func (c *client) UninstallMulticastGroup(groupID binding.GroupIDType) error {
gCache, ok := c.featureMulticast.groupCache.Load(groupID)
if ok {
if err := c.ofEntryOperations.DeleteOFEntries([]binding.OFEntry{gCache.(binding.Group)}); err != nil {
return fmt.Errorf("error when deleting Multicast receiver Group %d: %w", groupID, err)
return fmt.Errorf("error when deleting Openflow entries for Multicast receiver Group %d: %w", groupID, err)
}
if err := c.featureMulticast.bridge.DeleteGroup(groupID); err != nil {
return fmt.Errorf("error when deleting OFSwitch groupDb Cache for Multicast receiver Group %d: %w", groupID, err)
}
c.featureMulticast.groupCache.Delete(groupID)
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/ovs/openflow/ofctrl_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ func (b *OFBridge) DeleteGroup(id GroupIDType) error {
if ofctrlGroup == nil {
return nil
}
g := &ofGroup{bridge: b, ofctrl: ofctrlGroup}
if err := g.Delete(); err != nil {
return fmt.Errorf("failed to delete the group: %w", err)
}
return b.ofSwitch.DeleteGroup(uint32(id))
}

Expand Down

0 comments on commit 15fd036

Please sign in to comment.