From b4b368db50c0adaca1801227afd4e73b9fc412aa Mon Sep 17 00:00:00 2001 From: Zhaohui Sun Date: Sun, 4 Sep 2022 04:38:51 +0000 Subject: [PATCH] Add warning log if destination port is not defined Signed-off-by: Zhaohui Sun --- scripts/caclmgrd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/caclmgrd b/scripts/caclmgrd index 8a9f99829636..e7f393190bb1 100755 --- a/scripts/caclmgrd +++ b/scripts/caclmgrd @@ -551,6 +551,8 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): ip_protocols = self.ACL_SERVICES[acl_service]["ip_protocols"] if "dst_ports" in self.ACL_SERVICES[acl_service]: dst_ports = self.ACL_SERVICES[acl_service]["dst_ports"] + else: + dst_ports = [] acl_rules = {} @@ -604,6 +606,12 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): self.log_warning("Unable to determine if ACL table '{}' contains IPv4 or IPv6 rules. Skipping table..." .format(table_name)) continue + # If no destination port found for this ACL table, + # log a message and skip processing this table. + if len(dst_ports) == 0: + self.log_warning("Required destination port not found for ACL table '{}'. Skipping table..." + .format(table_name)) + continue ipv4_src_ip_set = set() ipv6_src_ip_set = set() # For each ACL rule in this table (in descending order of priority)