diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-04-06 16:38:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 16:38:08 +0200 |
commit | a101f6d66a055e3cc45371cac3943d1ab9cb0232 (patch) | |
tree | d0d9b133d60e950d047c3f602395d90cf7349dfc /src/conf_mode | |
parent | 15f48b521780a9a1116be85e848721f488e67a13 (diff) | |
parent | c514cea0ad94a00838530cd07f87723be372ea8f (diff) | |
download | vyos-1x-a101f6d66a055e3cc45371cac3943d1ab9cb0232.tar.gz vyos-1x-a101f6d66a055e3cc45371cac3943d1ab9cb0232.zip |
Merge pull request #1275 from sarthurdev/firewall_limit
firewall: T4345: Fix incorrect firewall rule limit rate format
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/firewall.py | 6 |
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"') |