Skip to content

Commit 81b60ac

Browse files
袁又袁yuanliu
authored andcommittedApr 26, 2023
fix_base_sg_rule (#2401)
Co-authored-by: yuanliu <yuanliu@cmss.chinamobile.com>
1 parent e80879c commit 81b60ac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
 

‎pkg/ovs/ovn-nbctl-legacy.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -2382,25 +2382,25 @@ func (c LegacyClient) CreateSgBaseEgressACL(sgName string) error {
23822382
klog.Infof("add base egress acl, sg: %s", portGroupName)
23832383
// allow arp
23842384
if _, err := c.ovnNbCommand(MayExist, "--type=port-group", "acl-add", portGroupName, string(SgAclEgressDirection), util.SecurityGroupBasePriority,
2385-
fmt.Sprintf("outport==@%s && arp", portGroupName), "allow-related"); err != nil {
2385+
fmt.Sprintf("inport==@%s && arp", portGroupName), "allow-related"); err != nil {
23862386
return err
23872387
}
23882388

23892389
// icmpv6
23902390
if _, err := c.ovnNbCommand(MayExist, "--type=port-group", "acl-add", portGroupName, string(SgAclEgressDirection), util.SecurityGroupBasePriority,
2391-
fmt.Sprintf("outport==@%s && icmp6.type=={130, 133, 135, 136} && icmp6.code == 0 && ip.ttl == 255", portGroupName), "allow-related"); err != nil {
2391+
fmt.Sprintf("inport==@%s && icmp6.type=={130, 133, 135, 136} && icmp6.code == 0 && ip.ttl == 255", portGroupName), "allow-related"); err != nil {
23922392
return err
23932393
}
23942394

23952395
// dhcpv4 res
23962396
if _, err := c.ovnNbCommand(MayExist, "--type=port-group", "acl-add", portGroupName, string(SgAclEgressDirection), util.SecurityGroupBasePriority,
2397-
fmt.Sprintf("outport==@%s && udp.src==68 && udp.dst==67 && ip4", portGroupName), "allow-related"); err != nil {
2397+
fmt.Sprintf("inport==@%s && udp.src==68 && udp.dst==67 && ip4", portGroupName), "allow-related"); err != nil {
23982398
return err
23992399
}
24002400

24012401
// dhcpv6 res
24022402
if _, err := c.ovnNbCommand(MayExist, "--type=port-group", "acl-add", portGroupName, string(SgAclEgressDirection), util.SecurityGroupBasePriority,
2403-
fmt.Sprintf("outport==@%s && udp.src==546 && udp.dst==547 && ip6", portGroupName), "allow-related"); err != nil {
2403+
fmt.Sprintf("inport==@%s && udp.src==546 && udp.dst==547 && ip6", portGroupName), "allow-related"); err != nil {
24042404
return err
24052405
}
24062406
return nil
@@ -2411,25 +2411,25 @@ func (c LegacyClient) CreateSgBaseIngressACL(sgName string) error {
24112411
klog.Infof("add base ingress acl, sg: %s", portGroupName)
24122412
// allow arp
24132413
if _, err := c.ovnNbCommand(MayExist, "--type=port-group", "acl-add", portGroupName, string(SgAclIngressDirection), util.SecurityGroupBasePriority,
2414-
fmt.Sprintf("inport==@%s && arp", portGroupName), "allow-related"); err != nil {
2414+
fmt.Sprintf("outport==@%s && arp", portGroupName), "allow-related"); err != nil {
24152415
return err
24162416
}
24172417

24182418
// icmpv6
24192419
if _, err := c.ovnNbCommand(MayExist, "--type=port-group", "acl-add", portGroupName, string(SgAclIngressDirection), util.SecurityGroupBasePriority,
2420-
fmt.Sprintf("inport==@%s && icmp6.type=={130, 134, 135, 136} && icmp6.code == 0 && ip.ttl == 255", portGroupName), "allow-related"); err != nil {
2420+
fmt.Sprintf("outport==@%s && icmp6.type=={130, 134, 135, 136} && icmp6.code == 0 && ip.ttl == 255", portGroupName), "allow-related"); err != nil {
24212421
return err
24222422
}
24232423

24242424
// dhcpv4 offer
24252425
if _, err := c.ovnNbCommand(MayExist, "--type=port-group", "acl-add", portGroupName, string(SgAclIngressDirection), util.SecurityGroupBasePriority,
2426-
fmt.Sprintf("inport==@%s && udp.src==67 && udp.dst==68 && ip4", portGroupName), "allow-related"); err != nil {
2426+
fmt.Sprintf("outport==@%s && udp.src==67 && udp.dst==68 && ip4", portGroupName), "allow-related"); err != nil {
24272427
return err
24282428
}
24292429

24302430
// dhcpv6 offer
24312431
if _, err := c.ovnNbCommand(MayExist, "--type=port-group", "acl-add", portGroupName, string(SgAclIngressDirection), util.SecurityGroupBasePriority,
2432-
fmt.Sprintf("inport==@%s && udp.src==547 && udp.dst==546 && ip6", portGroupName), "allow-related"); err != nil {
2432+
fmt.Sprintf("outport==@%s && udp.src==547 && udp.dst==546 && ip6", portGroupName), "allow-related"); err != nil {
24332433
return err
24342434
}
24352435

0 commit comments

Comments
 (0)
Please sign in to comment.