From 8fec254b2d17d5aec30589f0b3c5444ad1dfd1f5 Mon Sep 17 00:00:00 2001 From: Ruben Herold Date: Fri, 11 Sep 2026 16:28:09 +0200 Subject: Merge pull request #5372 from ruben-herold/T9157-fib-type-match firewall: T9157: add fib-type match for destination/source --- python/vyos/firewall.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'python') 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] -- cgit v1.2.3