Skip to content

Commit

Permalink
drop both IPv4 and IPv6 traffic in networkpolicy drop acl
Browse files Browse the repository at this point in the history
Signed-off-by: 马洪贞 <[email protected]>
  • Loading branch information
hongzhen-ma committed Apr 19, 2024
1 parent 7ffb791 commit c7d48c2
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions pkg/ovs/ovn-nb-acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,10 @@ func (c *OVNNbClient) UpdateIngressACLOps(pgName, asIngressName, asExceptName, p

if strings.HasSuffix(asIngressName, ".0") || strings.HasSuffix(asIngressName, ".all") {
// create the default drop rule for only once
ipSuffix := "ip4"
if protocol == kubeovnv1.ProtocolIPv6 {
ipSuffix = "ip6"
}

/* default drop acl */
// both IPv4 and IPv6 traffic should be forbade in dual-stack situation
allIPMatch := NewAndACLMatch(
NewACLMatch("outport", "==", "@"+pgName, ""),
NewACLMatch(ipSuffix, "", "", ""),
NewACLMatch("ip", "", "", ""),
)
options := func(acl *ovnnb.ACL) {
if logEnable {
Expand Down Expand Up @@ -75,15 +70,10 @@ func (c *OVNNbClient) UpdateEgressACLOps(pgName, asEgressName, asExceptName, pro

if strings.HasSuffix(asEgressName, ".0") || strings.HasSuffix(asEgressName, ".all") {
// create the default drop rule for only once
ipSuffix := "ip4"
if protocol == kubeovnv1.ProtocolIPv6 {
ipSuffix = "ip6"
}

/* default drop acl */
// both IPv4 and IPv6 traffic should be forbade in dual-stack situation
allIPMatch := NewAndACLMatch(
NewACLMatch("inport", "==", "@"+pgName, ""),
NewACLMatch(ipSuffix, "", "", ""),
NewACLMatch("ip", "", "", ""),
)
options := func(acl *ovnnb.ACL) {
if logEnable {
Expand Down

0 comments on commit c7d48c2

Please sign in to comment.