Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Solaris ifHighSpeed issue #409

Closed
wants to merge 4 commits into from

Conversation

lijog
Copy link
Contributor

@lijog lijog commented Feb 25, 2022

The ifHighSpeed value is not being fetched correctly for Solaris systems as seen in the following output

For a 10Gbps interface, we see

snmpwalk -v 2c -c public localhost ifdescr
IF-MIB::ifDescr.2 = STRING: net0

snmpwalk -v 2c -c public localhost ifspeed
IF-MIB::ifSpeed.2 = Gauge32: 1410065408

snmpwalk -v 2c -c public localhost ifHighSpeed
IF-MIB::ifHighSpeed.1 = Gauge32: 127
IF-MIB::ifHighSpeed.2 = Gauge32: 1410

dladm show-phys -Z
LINK ZONE MEDIA STATE SPEED DUPLEX DEVICE
net0 global Ethernet up 10000 full ixgbe0

kstat -p|grep speed
....
ixgbe:0:phys:ifspeed 10000000000 //10Gbps
..

The expected output is 10000000000 expressed in Mbps, i.e 10000
IF-MIB::ifSpeed.2 = Gauge32: 10000

The issue occurs as we are using an integer(Gauge) type to fetch the ifspeed value and simply convert it into Mbps for the ifHighSpeed value, which will fail for speeds > INT_MAX-1.

From the net-snmp documentation at http://www.net-snmp.org/docs/mibs/interfaces.html
"An estimate of the interface's current bandwidth in bits per second. For interfaces which do not vary in bandwidth
or for those where no accurate estimation can be made, this object should contain the nominal bandwidth. If the
bandwidth of the interface is greater than the maximum value reportable by this object then this object should report its
maximum value (4,294,967,295) and ifHighSpeed must be used to report the interace's speed. For a sub-layer which has
no concept of bandwidth, this object should be zero.
"

The fix will use a uint64 type for storing the ifspeed value, and will display the ifspeed value as per the docs.

Here's the output after applying the fix

snmpwalk -c public -v 2c localhost ifSpeed
IF-MIB::ifSpeed.2 = Gauge32: 4294967295

snmpwalk -c public -v 2c localhost ifHighSpeed
IF-MIB::ifHighSpeed.2 = Gauge32: 10000

@bvanassche
Copy link
Contributor

These patches have been applied on the v5.9 and master branches. Thanks for the patches!

lsang6WIND pushed a commit to lsang6WIND/net-snmp that referenced this pull request Sep 11, 2023
As issue#409, the link speed is not proprely retrieved in
"netsnmp_retrieve_link_speed".

Link: net-snmp#409
Fixes: b78b674 ("Linux: IF-MIB: Use libnl-route-3 instead of reading /proc/net/dev")
Signed-off-by: Loïc Sang <loic.sang@6wind.com>
bvanassche pushed a commit that referenced this pull request Sep 11, 2023
As issue#409, the link speed is not proprely retrieved in
"netsnmp_retrieve_link_speed".

Link: #409
Fixes: b78b674 ("Linux: IF-MIB: Use libnl-route-3 instead of reading /proc/net/dev")
Signed-off-by: Loïc Sang <loic.sang@6wind.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants