diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2018-05-09 13:56:47 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2018-05-09 13:56:47 +0000 |
commit | 493635e9c42fad2747d11c7370cc7f07c1bf04df (patch) | |
tree | 418c224f7b3190afc136018b2ad72d7f0d480e40 | |
parent | c7132708c2e0f194922f7a0eb469c070ac1c0733 (diff) |
As required by IF-MIB, cap ifSpeed at UINT32_MAX; the value is a GAUGE32 so
values above this can't be represented and ifHighSpeed must be used instead.
Problem reported by Arnaud BRAND, ok mpi
-rw-r--r-- | usr.sbin/snmpd/mib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c index 47940c9c2b8..1fed561c435 100644 --- a/usr.sbin/snmpd/mib.c +++ b/usr.sbin/snmpd/mib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mib.c,v 1.85 2017/12/18 05:51:53 cheloha Exp $ */ +/* $OpenBSD: mib.c,v 1.86 2018/05/09 13:56:46 sthen Exp $ */ /* * Copyright (c) 2012 Joel Knight <joel@openbsd.org> @@ -1109,7 +1109,11 @@ mib_iftable(struct oid *oid, struct ber_oid *o, struct ber_element **elm) 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: |