Skip to content

Commit

Permalink
<fix>(np) fix mulit np rule and gateway bug
Browse files Browse the repository at this point in the history
  • Loading branch information
feixiang committed Dec 23, 2020
1 parent f299aa7 commit 03ff96e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions pkg/controller/network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ func (c *Controller) handleUpdateNp(key string) error {
if len(npr.From) == 0 {
allows = []string{"0.0.0.0/0"}
excepts = []string{}
break
} else {
for _, npp := range npr.From {
allow, except, err := c.fetchPolicySelectedAddresses(np.Namespace, npp)
Expand Down Expand Up @@ -302,7 +301,6 @@ func (c *Controller) handleUpdateNp(key string) error {
if len(npr.To) == 0 {
allows = []string{"0.0.0.0/0"}
excepts = []string{}
break
} else {
for _, npp := range npr.To {
allow, except, err := c.fetchPolicySelectedAddresses(np.Namespace, npp)
Expand Down
4 changes: 2 additions & 2 deletions pkg/ovs/ovn-nbctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,8 @@ func (c Client) CreateGatewayACL(pgName, gateway, protocol string) error {
if protocol == kubeovnv1.ProtocolIPv6 {
ipSuffix = "ip6"
}
ingressArgs := []string{MayExist, "--type=port-group", "acl-add", pgName, "to-lport", util.IngressAllowPriority, fmt.Sprintf("%s.src == $%s && icmp", ipSuffix, gateway), "allow-related"}
egressArgs := []string{"--", MayExist, "--type=port-group", "acl-add", pgName, "from-lport", util.EgressAllowPriority, fmt.Sprintf("%s.dst == $%s && icmp", ipSuffix, gateway), "allow-related"}
ingressArgs := []string{MayExist, "--type=port-group", "acl-add", pgName, "to-lport", util.IngressAllowPriority, fmt.Sprintf("%s.src == %s && icmp", ipSuffix, gateway), "allow-related"}
egressArgs := []string{"--", MayExist, "--type=port-group", "acl-add", pgName, "from-lport", util.EgressAllowPriority, fmt.Sprintf("%s.dst == %s && icmp", ipSuffix, gateway), "allow-related"}
ovnArgs := append(ingressArgs, egressArgs...)
_, err := c.ovnNbCommand(ovnArgs...)
return err
Expand Down

0 comments on commit 03ff96e

Please sign in to comment.