summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRuben Herold <ruben@puettmann.net>2026-09-11 16:28:09 +0200
committerGitHub <noreply@github.com>2026-09-11 15:28:09 +0100
commit8fec254b2d17d5aec30589f0b3c5444ad1dfd1f5 (patch)
tree36d23d74daba786b9e67d2b31e706e021306172d /python
parent148dd2b2f5ac5f0cd3671650aa11100fc293b588 (diff)
downloadvyos-1x-8fec254b2d17d5aec30589f0b3c5444ad1dfd1f5.tar.gz
vyos-1x-8fec254b2d17d5aec30589f0b3c5444ad1dfd1f5.zip
Merge pull request #5372 from ruben-herold/T9157-fib-type-match
firewall: T9157: add fib-type match for destination/source
Diffstat (limited to 'python')
-rwxr-xr-xpython/vyos/firewall.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py
index 68ef3cac4..f68c317f9 100755
--- a/python/vyos/firewall.py
+++ b/python/vyos/firewall.py
@@ -165,6 +165,30 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name):
ether_type = ether_type_mapping.get(ether_type, ether_type)
output.append(f'ether type {operator} {ether_type}')
+ if 'fib' in rule_conf:
+ lookup = rule_conf['fib']['lookup']
+ lookup_list = []
+
+ if 'source-address' in lookup:
+ lookup_list.append('saddr')
+ if 'destination-address' in lookup:
+ lookup_list.append('daddr')
+
+ lookup_output = ' . '.join(lookup_list)
+
+ match_conf = rule_conf['fib']['match']
+ match_output = ''
+
+ if 'route_type' in match_conf:
+ route_type = match_conf['route_type']
+ operator = ''
+ if route_type[0] == '!':
+ operator = '!= '
+ route_type = route_type[1:]
+ match_output = f'type {operator}{route_type}'
+
+ output.append(f'fib {lookup_output} {match_output}')
+
for side in ['destination', 'source']:
if side in rule_conf:
prefix = side[0]