Change SIOCETHTOOL ioctl to use ETHTOOL_GLINKSETTINGS instead of obsolete ETHTOOL_GSET.
Changes needed to avoid kernel warnings: "warning: 'snmpd' uses legacy ethtool link settings API, link modes are only partially reported"
Version: 5.8
Tested on Linux, kernel 4.12.29 x86_64
Patch update for older kernels without support for ETHTOOL_GLINKSETTINGS
A modified version of this patch has been applied on the v5.8 and master branches. Please retest.
These patches in V5-8-patches break the ifSpeed and ifHighSpeed functionality:
09da7e2 Fix CentOS6 compile witch does not define ETHTOOL_GLINKSETTINGS
ec9f614 CHANGES: snmpd: Use ETHTOOL_GLINKSETTINGS when available
I compiled latest patches from this branch and tested on a recently upgraded Debian Buster
VM server:
Latest code:
Where previously, using the default (5.7.3) snmpd, I had these results:
Can you please either fix the ETHTOOL_GLINKSETTINGS patch or just revert it?
I looked at the code briefly but couldn't see why it was failing. It seems that the
ioctl call with ETHTOOL_GLINKSETTINGS returns 0 (in my small sample code) but
doesn't retrieve the actual speed (it's 0) so that the ETHTOOL_GSET call is never made.
Thanks,
Sam
When looking over the ethtool code, it appears that multiple ioctl calls may be required.
Why, I do not know.....This small patch works:
--Regards,
Sam
I think that patch could cause a stack overflow so I have checked in a slightly different patch. Please retest.
That works fine. And no stack smashing. Thanks, Bart.
--Sam