Thanks - I'm inclined to leave that one, I'm not sure why (possibly because of the division rather than using the value directly) but that one feels better to me as-is.
On 2018/05/09 13:45, BRAND Arnaud wrote: > I do agree with you. > I based my patch on the code on the ifHighSpeed case block at line 1291 in > the same file. > You might want to make it more explicit too. > > -----Message d'origine----- > De : Stuart Henderson <s...@spacehopper.org> > Envoyé : mercredi 9 mai 2018 15:41 > À : BRAND Arnaud <arnaud.br...@md6.fr> > Cc : bugs@openbsd.org > Objet : Re: snmpd ifSpeed reporting seems wrong for speeds over 4G (ex: 10G) > > On 2018/05/09 12:48, BRAND Arnaud wrote: > > Hi, > > > > I would like to report was looks like a bug in snmpd. > > > > When walking on the ifTable my client crashes when walking over 10G > > interfaces. > > Tcpdump shows that ifSpeed (1.3.6.1.2.1.2.2.1.5) is sending the value > > 10000000000 (10Gbps). > > But ifSpeed is of type GAUGE and maxes out at 2^32-1 (4Gbps-1). > > > > My MIB browser states : > > "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." > > > > So I guess the case block at line 1111 in /usr.sbin/snmpd/mib.c should read > > : > > case 5: > > i = kif->if_baudrate >= 4294967295 ? > > 4294967295 : > > kif->if_baudrate ; > > ber = ber_add_integer(ber, i); > > ber_set_header(ber, BER_CLASS_APPLICATION, > > SNMP_T_GAUGE32); > > break; > > instead of > > case 5: > > ber = ber_add_integer(ber, kif->if_baudrate); > > ber_set_header(ber, BER_CLASS_APPLICATION, > > SNMP_T_GAUGE32); > > break; > > > > Is my assumption correct or have I missed something ? > > > > I'm gonna give it a try while a fix perhaps makes its way in the next > > release or patches. > > > > Have a nice day and thanks for your nice work in OpenBSD ! > > > > Best regards > > Arnaud > > I think that's the right thing to do, but an if() and using a macro instead > of writing 4294967295 out in full is easier on the eye. > Any OKs for this? > > > Index: mib.c > =================================================================== > RCS file: /cvs/src/usr.sbin/snmpd/mib.c,v retrieving revision 1.85 diff -u -p > -r1.85 mib.c > --- mib.c 18 Dec 2017 05:51:53 -0000 1.85 > +++ mib.c 9 May 2018 13:38:50 -0000 > @@ -1109,7 +1109,11 @@ mib_iftable(struct oid *oid, struct ber_ > ber = ber_add_integer(ber, kif->if_mtu); > break; > case 5: > - ber = ber_add_integer(ber, kif->if_baudrate); > + if (kif->if_baudrate > UINT32_MAX) { > + /* speed should be obtained from ifHighSpeed instead */ > + ber = ber_add_integer(ber, UINT32_MAX); > + } else > + ber = ber_add_integer(ber, kif->if_baudrate); > ber_set_header(ber, BER_CLASS_APPLICATION, SNMP_T_GAUGE32); > break; > case 6: > >