summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2022-04-05 20:40:45 +0200
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2022-04-06 15:03:40 +0200
commitc514cea0ad94a00838530cd07f87723be372ea8f (patch)
treeb8e8c206aa876395f36d34165d335f31a0c302d0 /src/conf_mode
parentbe57ae38bb7c5a12e783e8be9de9142a6bd4e02b (diff)
downloadvyos-1x-c514cea0ad94a00838530cd07f87723be372ea8f.tar.gz
vyos-1x-c514cea0ad94a00838530cd07f87723be372ea8f.zip
firewall: T4345: Fix incorrect rule limit rate syntax
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/firewall.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/conf_mode/firewall.py b/src/conf_mode/firewall.py
index 41df1b84a..f33198a49 100755
--- a/src/conf_mode/firewall.py
+++ b/src/conf_mode/firewall.py
@@ -171,6 +171,12 @@ def verify_rule(firewall, rule_conf, ipv6):
if {'match_frag', 'match_non_frag'} <= set(rule_conf['fragment']):
raise ConfigError('Cannot specify both "match-frag" and "match-non-frag"')
+ if 'limit' in rule_conf:
+ if 'rate' in rule_conf['limit']:
+ rate_int = re.sub(r'\D', '', rule_conf['limit']['rate'])
+ if int(rate_int) < 1:
+ raise ConfigError('Limit rate integer cannot be less than 1')
+
if 'ipsec' in rule_conf:
if {'match_ipsec', 'match_non_ipsec'} <= set(rule_conf['ipsec']):
raise ConfigError('Cannot specify both "match-ipsec" and "match-non-ipsec"')