diff options
| author | Oleksandr Kuchmystyi <o.kuchmystyi@vyos.io> | 2026-03-25 12:27:51 +0300 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-03-25 18:30:24 +0100 |
| commit | 3b1cbabbd789c17ef88d2e249bc67b7a746c0f6e (patch) | |
| tree | e7be926550d66d2f98765e451ec9b5c616d03584 /src | |
| parent | b3a5356fb4c217ca9942a1d155f6c1c789dd62f6 (diff) | |
| download | vyos-1x-3b1cbabbd789c17ef88d2e249bc67b7a746c0f6e.tar.gz vyos-1x-3b1cbabbd789c17ef88d2e249bc67b7a746c0f6e.zip | |
vpp: T8422: Resolve inconsistent behavior with `allow-unsupported-nics` configuration option
Prevents attachments of unsupported NICs when the allow-unsupported-nics option is removed.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/vpp.py | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index bd8aad3f7..bcc5b154e 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -39,6 +39,7 @@ from vyos.logger import getLogger from vyos.template import render from vyos.utils.boot import boot_configuration_complete from vyos.utils.cpu import get_available_cpus +from vyos.utils.dict import dict_search from vyos.utils.kernel import check_kmod from vyos.utils.kernel import unload_kmod from vyos.utils.kernel import list_loaded_modules @@ -251,7 +252,7 @@ def _is_device_allowed(config: dict, iface: str): if 'allow_unsupported_nics' in config['settings']: return True - persist_config = config['persist_config'][iface] + persist_config = dict_search('persist_config.iface', config) pci_id = persist_config.get('pci_id') # PCI ID is sufficient by itself, if presented @@ -602,20 +603,12 @@ def verify(config): # ensure DPDK/XDP settings are properly configured for iface, iface_config in config['settings']['interface'].items(): - # check if selected driver is supported, but only for new interfaces - # or if driver was changed - original_driver = config['persist_config'][iface]['original_driver'] - if ( - iface - not in config.get('effective', {}).get('settings', {}).get('interface', {}) - or 'driver_changed' in iface_config - ): - if not _is_device_allowed(config, iface): - raise ConfigError( - f'NIC used by "{iface}" is not validated for VPP on VyOS. ' - 'Using it is unsafe and unsupported and will void support for the entire system. ' - 'To proceed at your own risk, enable: "set vpp settings allow-unsupported-nics".' - ) + if not _is_device_allowed(config, iface): + raise ConfigError( + f'NIC used by "{iface}" is not validated for VPP on VyOS. ' + 'Using it is unsafe and unsupported and will void support for the entire system. ' + 'To proceed at your own risk, enable: "set vpp settings allow-unsupported-nics".' + ) if iface_config['driver'] == 'xdp' and 'xdp_options' in iface_config: if iface_config['xdp_options']['num_rx_queues'] != 'all': |
