我需要读取网络适配器的永久(烧入)MAC 地址。由于MAC地址很容易被欺骗,我需要读取写在EEPROM上的真实地址。我需要在 Linux 上使用 C++ 来完成它。
我尝试使用ethtool,它非常好并且工作正常。但是,在某些系统上,它无法按预期工作。
ethtool -P eth0
Run Code Online (Sandbox Code Playgroud)
返回这个:
Permanent address: 00:00:00:00:00:00
Run Code Online (Sandbox Code Playgroud)
和
ethtool -e eth0
Run Code Online (Sandbox Code Playgroud)
返回这个:
Cannot get EEPROM data: Operation not supported
Run Code Online (Sandbox Code Playgroud)
网络适配器具有以下信息:
Linux内核版本为:2.6.32.13
问题是:我可以通过任何更新(驱动程序、内核等)来解决这个问题吗?
此外,我使用ioctl
C++ 中的函数进行了相同的 ethtool 调用。有没有办法在代码中解决这个问题?或者有没有其他方法可以从 EEPROM 中获取永久 MAC 地址?