我想查看哪个驱动程序与列出的某些网络接口相关联ip link
。我的第一个想法是找到其中的网络接口,/dev
并查看设备的主设备号和次设备号,以确定相关的驱动程序。但是,网络接口不会出现在下/dev
。
我有一种误解,是对Linux网络堆栈的一些基本知识(也许是因为netfilter / iptables / tc可能涉及多个内核模块),因此请解决。我天真的问题是:
/dev
?我永远不确定在sysfs中进行爬坡是否是做事的最佳方法(我应该使用udevadm吗?),但至少可以发现
$ DEV=p8p1
$ readlink /sys/class/net/$DEV/device/driver
../../../../bus/pci/drivers/tg3
它不适用于lo
“虚拟”(/sys/devices/virtual/
)之类的设备。它们没有到基础的链接device
(例如,在pci总线上),因此您无法如上所述查询驱动程序。
还有一个特定于linux的工具ethtool
。它使用同义的套接字ioctl而不是读取sysfs。ioctl是特定于linux的;标准的unix API不会告诉您该驱动程序是什么。ethtool
给出相同的结果(这是行不通的lo
,多余的信息毫无意义)。
$ ethtool -i p8p1
driver: tg3
version: 3.137
firmware-version: sb
bus-info: 0000:04:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句