Skip to content

Commit a099681

Browse files
author
Shuotian Cheng
authored
[acl_loader]: Fix IP match bug for checking IP version (#387)
Add .version to get the version of the IP Signed-off-by: Shu0T1an ChenG <[email protected]>
1 parent 83ec276 commit a099681

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

acl_loader/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,14 @@ def convert_ip(self, table_name, rule_idx, rule):
271271

272272
if rule.ip.config.source_ip_address:
273273
source_ip_address = rule.ip.config.source_ip_address.encode("ascii")
274-
if ipaddr.IPNetwork(source_ip_address) == 4:
274+
if ipaddr.IPNetwork(source_ip_address).version == 4:
275275
rule_props["SRC_IP"] = source_ip_address
276276
else:
277277
rule_props["SRC_IPV6"] = source_ip_address
278278

279279
if rule.ip.config.destination_ip_address:
280280
destination_ip_address = rule.ip.config.destination_ip_address.encode("ascii")
281-
if ipaddr.IPNetwork(destination_ip_address) == 4:
281+
if ipaddr.IPNetwork(destination_ip_address).version == 4:
282282
rule_props["DST_IP"] = destination_ip_address
283283
else:
284284
rule_props["DST_IPV6"] = destination_ip_address

0 commit comments

Comments
 (0)