summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2026-07-27 16:35:37 +0300
committerNataliia Solomko <natalirs1985@gmail.com>2026-07-29 13:45:21 +0300
commit4839fbdc5e48aa8a32bf08ca20c4b922aa26cb32 (patch)
tree9ed8a75655e90e5bf40cfbd12a03bd786988e1db /src
parentb81e435210f499b225b5d27fd16c370c0095da3a (diff)
downloadvyos-1x-4839fbdc5e48aa8a32bf08ca20c4b922aa26cb32.tar.gz
vyos-1x-4839fbdc5e48aa8a32bf08ca20c4b922aa26cb32.zip
vpp: T8468: Apply MAC address changes on VPP interfaces
The interface config filter stripped the "mac" node, so a MAC address configured on a VPP interface never reached the dataplane. Allow "mac" through the filter; VPP applies it to the hardware interface via lcp-sync. Some DPDK drivers (e.g. vmxnet3) cannot change the MAC and would fail to bring the interface up. Reject such a change at verify time - both when setting the MAC and when adding an interface that already has one to VPP.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces_ethernet.py6
-rwxr-xr-xsrc/conf_mode/vpp.py13
2 files changed, 19 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces_ethernet.py b/src/conf_mode/interfaces_ethernet.py
index 9063bcd7c..16ff90300 100755
--- a/src/conf_mode/interfaces_ethernet.py
+++ b/src/conf_mode/interfaces_ethernet.py
@@ -50,6 +50,7 @@ from vyos.utils.network import get_vrf_tableid
from vyos.utils.process import is_systemd_service_running
from vyos.vpp.config_deps import deps_bond_dict
from vyos.vpp.config_verify import verify_vpp_remove_interface
+from vyos.vpp.config_verify import verify_vpp_mac_change_supported
from vyos.vpp.control_vpp import VPPControl
from vyos import ConfigError
from vyos import airbag
@@ -402,6 +403,11 @@ def verify(ethernet):
verify_ring_buffer(ethernet, ethtool)
verify_offload(ethernet, ethtool)
verify_mac_change(ethernet, ethtool)
+ if (
+ 'mac' in ethernet
+ and dict_search(f'vpp.settings.interface.{ifname}', ethernet) is not None
+ ):
+ verify_vpp_mac_change_supported(ifname)
verify_coalesce(ethernet, ethtool)
if 'is_bond_member' in ethernet:
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py
index c0e30d1f1..a831ded02 100755
--- a/src/conf_mode/vpp.py
+++ b/src/conf_mode/vpp.py
@@ -62,6 +62,7 @@ from vyos.vpp.config_verify import (
verify_routes_count,
verify_vpp_main_heap_size,
verify_vpp_buffers,
+ verify_vpp_mac_change_supported,
)
from vyos.vpp.config_resource_checks import memory
from vyos.vpp.config_filter import iface_filter_eth
@@ -394,6 +395,12 @@ def get_config(config=None):
EthtoolGDrvinfo(iface).driver
)
+ # Record whether a custom MAC is configured, so verify() can
+ # reject it up front on drivers that cannot apply it.
+ config['settings']['interface'][iface]['mac_configured'] = conf.exists(
+ ['interfaces', 'ethernet', iface, 'mac']
+ )
+
# filter unsupported config nodes
iface_filter_eth(conf, iface)
set_dependents('ethernet', conf, iface)
@@ -582,6 +589,12 @@ def verify(config):
if iface not in ethernet_ifaces:
raise ConfigError(f'Interface {iface} does not exist or is not Ethernet!')
+ # An interface added to VPP with a custom MAC its driver cannot apply would
+ # fail to come up in the dataplane - reject it here instead.
+ for iface, iface_config in config['settings']['interface'].items():
+ if iface_config.get('mac_configured'):
+ verify_vpp_mac_change_supported(iface)
+
# Resource usage checks
cpu_cores = int(config['settings']['resource_allocation']['cpu_cores'])
verify_vpp_minimum_cpus()