summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-02-22 14:15:26 +0100
committerGitHub <noreply@github.com>2025-02-22 14:15:26 +0100
commit5d9d232fd93ad5bf89ba44a2d0ec3b196599fa74 (patch)
treeca9a86e3aca88f990f3c139ee355d216b2925990 /python
parentb7ce1c1448f0f52976468fd579104f1e805fa8d8 (diff)
parentac890f5e3ff7d0bb4853199204e4db7c4f1dcc3e (diff)
downloadvyos-1x-5d9d232fd93ad5bf89ba44a2d0ec3b196599fa74.tar.gz
vyos-1x-5d9d232fd93ad5bf89ba44a2d0ec3b196599fa74.zip
Merge pull request #4357 from sarthurdev/T7148
firewall: T7148: Bridge state-policy uses drop in place of reject
Diffstat (limited to 'python')
-rwxr-xr-xpython/vyos/template.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py
index 7ba608b32..e75db1a8d 100755
--- a/python/vyos/template.py
+++ b/python/vyos/template.py
@@ -612,12 +612,17 @@ def nft_default_rule(fw_conf, fw_name, family):
return " ".join(output)
@register_filter('nft_state_policy')
-def nft_state_policy(conf, state):
+def nft_state_policy(conf, state, bridge=False):
out = [f'ct state {state}']
+ action = conf['action'] if 'action' in conf else None
+
+ if bridge and action == 'reject':
+ action = 'drop' # T7148 - Bridge cannot use reject
+
if 'log' in conf:
log_state = state[:3].upper()
- log_action = (conf['action'] if 'action' in conf else 'accept')[:1].upper()
+ log_action = (action if action else 'accept')[:1].upper()
out.append(f'log prefix "[STATE-POLICY-{log_state}-{log_action}]"')
if 'log_level' in conf:
@@ -626,8 +631,8 @@ def nft_state_policy(conf, state):
out.append('counter')
- if 'action' in conf:
- out.append(conf['action'])
+ if action:
+ out.append(action)
return " ".join(out)