summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav <v.gletenko@vyos.io>2025-10-10 12:48:57 +0000
committerViacheslav <v.gletenko@vyos.io>2025-10-16 09:29:11 +0000
commita5b92ceff7d2ba0c5f59a653b5dc636462883680 (patch)
tree8f249cbac139f7220d45e3d6fb5c0624c10f5148
parentf35c980de595ee6adc8b5b28b913224564ee2d94 (diff)
downloadvyos-1x-a5b92ceff7d2ba0c5f59a653b5dc636462883680.tar.gz
vyos-1x-a5b92ceff7d2ba0c5f59a653b5dc636462883680.zip
T7890: VPP fix verify_dev_driver
The verify_dev_driver must return bool value, but it a device does not have PCI address (for example veth interface) it returns Traceback Fix this
-rw-r--r--python/vyos/vpp/control_host.py15
-rwxr-xr-xsrc/conf_mode/vpp.py2
2 files changed, 10 insertions, 7 deletions
diff --git a/python/vyos/vpp/control_host.py b/python/vyos/vpp/control_host.py
index 6a6b9d72f..db1a492c9 100644
--- a/python/vyos/vpp/control_host.py
+++ b/python/vyos/vpp/control_host.py
@@ -23,6 +23,7 @@ from time import sleep
from pyroute2 import IPRoute
+from vyos.ethtool import Ethtool
from vyos.vpp.utils import EthtoolGDrvinfo
@@ -266,14 +267,16 @@ def get_eth_driver(iface: str) -> str:
Returns:
str: kernel module name
"""
- iface_driver: str = ''
driver_dir = Path(f'/sys/class/net/{iface}/device/driver/module')
- if not driver_dir.exists():
- # raise error if device was not found
- raise FileNotFoundError(f'PCI device {iface} not found in ethernet interfaces')
+ # Try to detect via sysfs (works for PCI devices)
+ if driver_dir.exists():
+ return driver_dir.resolve().name
- iface_driver: str = driver_dir.resolve().name
- return iface_driver
+ # Fallback: use ethtool (works for veth, tun, etc.)
+ try:
+ return Ethtool(iface).get_driver_name()
+ except Exception as error:
+ raise Exception(f'Could not determine driver for "{iface}": {error}') from error
def unsafe_noiommu_mode(status: bool) -> None:
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py
index 81502c0b4..d3bf86ada 100755
--- a/src/conf_mode/vpp.py
+++ b/src/conf_mode/vpp.py
@@ -604,7 +604,7 @@ def initialize_interface(iface, driver, iface_config) -> None:
try:
if control_host.get_eth_driver(f'defunct_{iface}') == 'mlx5_core':
control_host.rename_iface(f'defunct_{iface}', iface)
- except FileNotFoundError:
+ except Exception:
pass
# Replace a driver with original for VMBus interfaces and rename it