diff options
author | Nicolas Fort <nicolasfort1988@gmail.com> | 2024-08-26 18:10:01 +0000 |
---|---|---|
committer | Nicolas Fort <nicolasfort1988@gmail.com> | 2024-08-28 12:19:19 +0000 |
commit | 8e0e1a99e5510c7575ab8a09145d6b4354692d55 (patch) | |
tree | 12c4d27314384f84b67a5e370e9d8f181ea15742 /python/vyos | |
parent | 003209eeab231675e82abb8cf6eab7ca0384bc3f (diff) | |
download | vyos-1x-8e0e1a99e5510c7575ab8a09145d6b4354692d55.tar.gz vyos-1x-8e0e1a99e5510c7575ab8a09145d6b4354692d55.zip |
T6647: firewall. Introduce patch for accepting ARP and DHCP replies on stateful bridge firewall. This patch is needed because ARP and DHCP are marked as invalid connections. Also, add ehternet-type matcher in bridge firewall.
Diffstat (limited to 'python/vyos')
-rwxr-xr-x | python/vyos/firewall.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py index f0cf3c924..b1978c1fa 100755 --- a/python/vyos/firewall.py +++ b/python/vyos/firewall.py @@ -151,6 +151,20 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name): proto = '{tcp, udp}' output.append(f'meta l4proto {operator} {proto}') + if 'ethernet_type' in rule_conf: + ether_type_mapping = { + '802.1q': '8021q', + '802.1ad': '8021ad', + 'ipv6': 'ip6', + 'ipv4': 'ip', + 'arp': 'arp' + } + ether_type = rule_conf['ethernet_type'] + operator = '!=' if ether_type.startswith('!') else '' + ether_type = ether_type.lstrip('!') + ether_type = ether_type_mapping.get(ether_type, ether_type) + output.append(f'ether type {operator} {ether_type}') + for side in ['destination', 'source']: if side in rule_conf: prefix = side[0] |