summaryrefslogtreecommitdiff
path: root/python/vyos/firewall.py
diff options
context:
space:
mode:
authorNicolas Fort <nicolasfort1988@gmail.com>2023-11-21 17:36:20 +0000
committerNicolas Fort <nicolasfort1988@gmail.com>2023-11-21 17:36:20 +0000
commit4e8839b6d78c7629cd2c1daee0438472c96365a4 (patch)
tree1d70d79a5f3d1c2b31f962afdb7e908af5548d27 /python/vyos/firewall.py
parent916adfaf0774df0731522bf3cbd886d794735c50 (diff)
downloadvyos-1x-4e8839b6d78c7629cd2c1daee0438472c96365a4.tar.gz
vyos-1x-4e8839b6d78c7629cd2c1daee0438472c96365a4.zip
T5419: firewall: backport firewall flowtable to Sagitta.
Diffstat (limited to 'python/vyos/firewall.py')
-rw-r--r--python/vyos/firewall.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py
index 8ae269fed..4fc1abb15 100644
--- a/python/vyos/firewall.py
+++ b/python/vyos/firewall.py
@@ -421,19 +421,24 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name):
if 'action' in rule_conf:
# Change action=return to action=action
# #output.append(nft_action(rule_conf['action']))
- output.append(f'{rule_conf["action"]}')
- if 'jump' in rule_conf['action']:
- target = rule_conf['jump_target']
- output.append(f'NAME{def_suffix}_{target}')
-
- if 'queue' in rule_conf['action']:
- if 'queue' in rule_conf:
- target = rule_conf['queue']
- output.append(f'num {target}')
-
- if 'queue_options' in rule_conf:
- queue_opts = ','.join(rule_conf['queue_options'])
- output.append(f'{queue_opts}')
+ if rule_conf['action'] == 'offload':
+ offload_target = rule_conf['offload_target']
+ output.append(f'flow add @VYOS_FLOWTABLE_{offload_target}')
+ else:
+ output.append(f'{rule_conf["action"]}')
+
+ if 'jump' in rule_conf['action']:
+ target = rule_conf['jump_target']
+ output.append(f'NAME{def_suffix}_{target}')
+
+ if 'queue' in rule_conf['action']:
+ if 'queue' in rule_conf:
+ target = rule_conf['queue']
+ output.append(f'num {target}')
+
+ if 'queue_options' in rule_conf:
+ queue_opts = ','.join(rule_conf['queue_options'])
+ output.append(f'{queue_opts}')
else:
output.append('return')