summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorVijayakumar A <36878324+kumvijaya@users.noreply.github.com>2024-08-11 10:18:24 +0530
committerGitHub <noreply@github.com>2024-08-11 10:18:24 +0530
commit374a315f84365b8fe2ed67585f2127c2a3f02020 (patch)
tree8958d7ee441486d7622d6a0a6048caf29334e105 /python
parent9c442f51569f1cb9de552973ba7cec19248692c4 (diff)
parent64e324d7dd9a696a70c9a956ce8792652c6f4191 (diff)
downloadvyos-1x-374a315f84365b8fe2ed67585f2127c2a3f02020.tar.gz
vyos-1x-374a315f84365b8fe2ed67585f2127c2a3f02020.zip
Merge branch 'current' into current
Diffstat (limited to 'python')
-rwxr-xr-x[-rw-r--r--]python/vyos/firewall.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py
index 3976a5580..f0cf3c924 100644..100755
--- a/python/vyos/firewall.py
+++ b/python/vyos/firewall.py
@@ -167,10 +167,19 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name):
if address_mask:
operator = '!=' if exclude else '=='
operator = f'& {address_mask} {operator} '
- if is_ipv4(suffix):
- output.append(f'ip {prefix}addr {operator}{suffix}')
+
+ if suffix.find('-') != -1:
+ # Range
+ start, end = suffix.split('-')
+ if is_ipv4(start):
+ output.append(f'ip {prefix}addr {operator}{suffix}')
+ else:
+ output.append(f'ip6 {prefix}addr {operator}{suffix}')
else:
- output.append(f'ip6 {prefix}addr {operator}{suffix}')
+ if is_ipv4(suffix):
+ output.append(f'ip {prefix}addr {operator}{suffix}')
+ else:
+ output.append(f'ip6 {prefix}addr {operator}{suffix}')
if 'fqdn' in side_conf:
fqdn = side_conf['fqdn']