Skip to content

Commit 77d6362

Browse files
authored
[caclmgrd] Fix application of IPv6 service ACL rules (#3917)
1 parent 1e05a41 commit 77d6362

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

files/image_config/caclmgrd/caclmgrd

+7-6
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,14 @@ class ControlPlaneAclManager(object):
194194
continue
195195

196196
# If we haven't determined the IP version for this ACL table yet,
197-
# try to do it now. We determine heuristically based on whether the
198-
# src IP is an IPv4 or IPv6 address.
199-
if not table_ip_version and "SRC_IP" in rule_props and rule_props["SRC_IP"]:
200-
ip_addr = ipaddress.IPAddress(rule_props["SRC_IP"].split("/")[0])
201-
if isinstance(ip_addr, ipaddress.IPv6Address):
197+
# try to do it now. We attempt to determine heuristically based on
198+
# whether the src or dst IP of this rule is an IPv4 or IPv6 address.
199+
if not table_ip_version:
200+
if (("SRC_IPV6" in rule_props and rule_props["SRC_IPV6"]) or
201+
("DST_IPV6" in rule_props and rule_props["DST_IPV6"])):
202202
table_ip_version = 6
203-
elif isinstance(ip_addr, ipaddress.IPv4Address):
203+
elif (("SRC_IP" in rule_props and rule_props["SRC_IP"]) or
204+
("DST_IP" in rule_props and rule_props["DST_IP"])):
204205
table_ip_version = 4
205206

206207
# If we were unable to determine whether this ACL table contains

0 commit comments

Comments
 (0)