summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2025-06-19 15:44:46 +0100
committerGitHub <noreply@github.com>2025-06-19 15:44:46 +0100
commit79dec52ed4c3a6c035204fad28b9229f709c87c4 (patch)
treee1e2391390674c1b679c476488d17c9a0b48fc5b /python
parent1c72ef9a39245b76bd79b8c7d46e806f84a148c9 (diff)
parent8dbc3c5e67cc1fd043a78dd3446a1a733ebd814f (diff)
downloadvyos-1x-79dec52ed4c3a6c035204fad28b9229f709c87c4.tar.gz
vyos-1x-79dec52ed4c3a6c035204fad28b9229f709c87c4.zip
Merge pull request #4558 from natali-rs1985/T6951
firewall: T6951: Add a configuration command for ethertypes that bridge firewalls should always accept
Diffstat (limited to 'python')
-rwxr-xr-xpython/vyos/template.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py
index bf7928914..bf2f13183 100755
--- a/python/vyos/template.py
+++ b/python/vyos/template.py
@@ -674,6 +674,29 @@ def nft_nested_group(out_list, includes, groups, key):
add_includes(name)
return out_list
+@register_filter('nft_accept_invalid')
+def nft_accept_invalid(ether_type):
+ ether_type_mapping = {
+ 'dhcp': 'udp sport 67 udp dport 68',
+ 'arp': 'arp',
+ 'pppoe-discovery': '0x8863',
+ 'pppoe': '0x8864',
+ '802.1q': '8021q',
+ '802.1ad': '8021ad',
+ 'wol': '0x0842',
+ }
+ if ether_type not in ether_type_mapping:
+ raise RuntimeError(f'Ethernet type "{ether_type}" not found in ' \
+ 'available ethernet types!')
+ out = 'ct state invalid '
+
+ if ether_type != 'dhcp':
+ out += 'ether type '
+
+ out += f'{ether_type_mapping[ether_type]} counter accept'
+
+ return out
+
@register_filter('nat_rule')
def nat_rule(rule_conf, rule_id, nat_type, ipv6=False):
from vyos.nat import parse_nat_rule