Skip to content

Commit

Permalink
update ipv6 security-group remote group name (#2389)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Mar 1, 2023
1 parent db435dc commit d244551
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/controller/security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ func (c *Controller) syncSgLogicalPort(key string) error {
klog.Errorf("failed to find logical port, %v", err)
return err
}
if len(results) == 0 {
return nil
}

var v4s, v6s []string
var ports []string
Expand Down
8 changes: 6 additions & 2 deletions pkg/ovs/ovn-nbctl-legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2350,10 +2350,14 @@ func (c LegacyClient) createSgRuleACL(sgName string, direction AclDirection, rul
matchArgs = append(matchArgs, fmt.Sprintf("inport==@%s && %s && %s.dst==%s", sgPortGroupName, ipSuffix, ipSuffix, rule.RemoteAddress))
}
} else {
remotePgName := GetSgV4AssociatedName(rule.RemoteSecurityGroup)
if rule.IPVersion == "ipv6" {
remotePgName = GetSgV6AssociatedName(rule.RemoteSecurityGroup)
}
if direction == SgAclIngressDirection {
matchArgs = append(matchArgs, fmt.Sprintf("outport==@%s && %s && %s.src==$%s", sgPortGroupName, ipSuffix, ipSuffix, GetSgV4AssociatedName(rule.RemoteSecurityGroup)))
matchArgs = append(matchArgs, fmt.Sprintf("outport==@%s && %s && %s.src==$%s", sgPortGroupName, ipSuffix, ipSuffix, remotePgName))
} else {
matchArgs = append(matchArgs, fmt.Sprintf("inport==@%s && %s && %s.dst==$%s", sgPortGroupName, ipSuffix, ipSuffix, GetSgV4AssociatedName(rule.RemoteSecurityGroup)))
matchArgs = append(matchArgs, fmt.Sprintf("inport==@%s && %s && %s.dst==$%s", sgPortGroupName, ipSuffix, ipSuffix, remotePgName))
}
}

Expand Down

0 comments on commit d244551

Please sign in to comment.