summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-01-27 07:29:44 +0100
committerGitHub <noreply@github.com>2023-01-27 07:29:44 +0100
commite3139d4327aac18b9bde5499d124dc3d46864852 (patch)
treeaeeec2dea809fa71f114e7d3ac5084a0498a82f5
parent0f00cb45f01b1fc90aead2f06d6aa5ac7a02364b (diff)
parent2270a115e2bdb58369a4d1e61378dfb38a4de510 (diff)
downloadvyos-1x-e3139d4327aac18b9bde5499d124dc3d46864852.tar.gz
vyos-1x-e3139d4327aac18b9bde5499d124dc3d46864852.zip
Merge pull request #1786 from MartB/patch-1
vyos.ethtool: T4963: improve driver name detection
-rw-r--r--python/vyos/ethtool.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 2b6012a73..abf8de688 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -56,10 +56,10 @@ class Ethtool:
def __init__(self, ifname):
# Get driver used for interface
- sysfs_file = f'/sys/class/net/{ifname}/device/driver/module'
- if os.path.exists(sysfs_file):
- link = os.readlink(sysfs_file)
- self._driver_name = os.path.basename(link)
+ out, err = popen(f'ethtool --driver {ifname}')
+ driver = re.search(r'driver:\s(\w+)', out)
+ if driver:
+ self._driver_name = driver.group(1)
# Build a dictinary of supported link-speed and dupley settings.
out, err = popen(f'ethtool {ifname}')