summaryrefslogtreecommitdiff
path: root/python/vyos/firewall.py
diff options
context:
space:
mode:
authorNicolas Fort <nicolasfort1988@gmail.com>2023-10-23 16:40:18 +0000
committerNicolas Fort <nicolasfort1988@gmail.com>2023-10-23 16:40:18 +0000
commita9e93ef54bd38fd86268ce9e1c581a3852692280 (patch)
treeb84073c9ca60f2501ea64eb1f20051778f6c0100 /python/vyos/firewall.py
parent2007a883125c7c6e1a0a1b06b0e0d32f9b1dc693 (diff)
downloadvyos-1x-a9e93ef54bd38fd86268ce9e1c581a3852692280.tar.gz
vyos-1x-a9e93ef54bd38fd86268ce9e1c581a3852692280.zip
T5637: Firewall: add new rule at the end of base chains for default-actions. This enables logs capabilities for default-action in base chains.
Diffstat (limited to 'python/vyos/firewall.py')
-rw-r--r--python/vyos/firewall.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py
index 7de268a00..59e02a2f1 100644
--- a/python/vyos/firewall.py
+++ b/python/vyos/firewall.py
@@ -87,7 +87,13 @@ 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 ''
+ #def_suffix = '6' if ip_name == 'ip6' else ''
+ if ip_name == 'ip6':
+ def_suffix = '6'
+ family = 'ipv6'
+ else:
+ def_suffix = ''
+ 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'])
@@ -258,7 +264,8 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name):
if 'log' in rule_conf and rule_conf['log'] == 'enable':
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 "[{fw_name[:19]}-{rule_id}-{action[:1].upper()}]"')
+ output.append(f'log prefix "[{family}-{hook}-{fw_name}-{rule_id}-{action[:1].upper()}]"')
if 'log_options' in rule_conf: