diff options
author | Nicolas Fort <nicolasfort1988@gmail.com> | 2023-11-10 19:26:35 +0000 |
---|---|---|
committer | Nicolas Fort <nicolasfort1988@gmail.com> | 2023-11-10 19:26:35 +0000 |
commit | c4409d6a4e11bf2acc7b5b96888e2c471c4559e5 (patch) | |
tree | c23aff0f073c54eb7a6e35a32df2bf27ed248d15 /python | |
parent | 1fcb8637f864e13c5208bed22f3a065b5d78f596 (diff) | |
download | vyos-1x-c4409d6a4e11bf2acc7b5b96888e2c471c4559e5.tar.gz vyos-1x-c4409d6a4e11bf2acc7b5b96888e2c471c4559e5.zip |
T5729: firewall: switch to valueless in order to remove unnecessary <enable|disable> commands; log and state moved to new syntax.
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/firewall.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py index dc5787595..a2622fa00 100644 --- a/python/vyos/firewall.py +++ b/python/vyos/firewall.py @@ -87,7 +87,6 @@ def nft_action(vyos_action): def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name): output = [] - #def_suffix = '6' if ip_name == 'ip6' else '' if ip_name == 'ip6': def_suffix = '6' @@ -97,7 +96,7 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name): family = 'bri' if ip_name == 'bri' else 'ipv4' if 'state' in rule_conf and rule_conf['state']: - states = ",".join([s for s, v in rule_conf['state'].items() if v == 'enable']) + states = ",".join([s for s in rule_conf['state']]) if states: output.append(f'ct state {{{states}}}') @@ -395,7 +394,7 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name): if 'priority' in rule_conf['vlan']: output.append(f'vlan pcp {rule_conf["vlan"]["priority"]}') - if 'log' in rule_conf and rule_conf['log'] == 'enable': + if 'log' in rule_conf: action = rule_conf['action'] if 'action' in rule_conf else 'accept' #output.append(f'log prefix "[{fw_name[:19]}-{rule_id}-{action[:1].upper()}]"') output.append(f'log prefix "[{family}-{hook}-{fw_name}-{rule_id}-{action[:1].upper()}]"') |