Skip to content

Commit

Permalink
libovsdb: fix potential duplicate addresses (#2763)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed May 6, 2023
1 parent 5585d44 commit bf1a3d7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/ovs/ovn-nb-address_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ func (c *ovnClient) AddressSetUpdateAddress(asName string, addresses ...string)
return fmt.Errorf("get address set %s: %v", asName, err)
}

// update will failed when slice contains duplicate elements
addresses = util.UniqString(addresses)

// format CIDR to keep addresses the same in both nb and sb
for i, addr := range addresses {
if strings.ContainsRune(addr, '/') {
Expand All @@ -69,6 +66,10 @@ func (c *ovnClient) AddressSetUpdateAddress(asName string, addresses ...string)
addresses[i] = ipNet.String()
}
}

// update will failed when slice contains duplicate elements
addresses = util.UniqString(addresses)

// clear addresses when addresses is empty
as.Addresses = addresses

Expand Down

0 comments on commit bf1a3d7

Please sign in to comment.