From 0d3ac22b95cef90e7c54ef823c00bb59b935c158 Mon Sep 17 00:00:00 2001 From: David Vølker Date: Mon, 1 Jun 2026 08:09:06 +0200 Subject: firewall: T8761: re-introduce VRF interface names in generated firewall config This change re-implements the intended behaviour from T4180 aswell as from T4506, it ensures that both the vrf-member interface aswell as the vrf itself is added as an oifname -> meaning that traffic traversing and originating from withing VyOS is matches outbound. Changes done by c-po: * re-sort dependency list to keep diff low * vyos.configdict.is_vrf_changed() should return early and not carry over the to-be return value * keep common coding style (dict by . separation) in nftables-zone.j2 Co-authored-by: Christian Breunig --- src/conf_mode/interfaces_macsec.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/conf_mode/interfaces_macsec.py') diff --git a/src/conf_mode/interfaces_macsec.py b/src/conf_mode/interfaces_macsec.py index 3c043e11e..5aae52c02 100755 --- a/src/conf_mode/interfaces_macsec.py +++ b/src/conf_mode/interfaces_macsec.py @@ -23,6 +23,7 @@ from vyos.configdep import set_dependents from vyos.configdep import call_dependents from vyos.configdict import get_interface_dict from vyos.configdict import is_node_changed +from vyos.configdict import is_vrf_changed from vyos.configdict import is_source_interface from vyos.configverify import verify_vrf from vyos.configverify import verify_address @@ -84,6 +85,10 @@ def get_config(config=None): if 'static_arp' in macsec: set_dependents('static_arp', conf) + # Check vrf membership, to ensure firewall is updated + if is_vrf_changed(conf, ifname): + set_dependents('firewall', conf) + return macsec @@ -187,6 +192,9 @@ def apply(macsec): if os.path.isfile(wpa_suppl_conf.format(**macsec)): os.unlink(wpa_suppl_conf.format(**macsec)) + # run the dependents + call_dependents() + return None # It is safe to "re-create" the interface always, there is a sanity @@ -199,8 +207,8 @@ def apply(macsec): if not is_systemd_service_running(systemd_service) or 'shutdown_required' in macsec: call(f'systemctl reload-or-restart {systemd_service}') - if 'static_arp' in macsec: - call_dependents() + # run the dependents + call_dependents() return None -- cgit v1.2.3