]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bsnmpd(8): fix and optimize interface description processing
authoreugen <eugen@FreeBSD.org>
Sat, 18 Aug 2018 10:58:44 +0000 (10:58 +0000)
committereugen <eugen@FreeBSD.org>
Sat, 18 Aug 2018 10:58:44 +0000 (10:58 +0000)
commitdb47817e6d1234427fa0f0ac357d5c4f6be7c313
tree376680d94619333a618f709553fb1a478a7b0770
parentdc8f15c81cc1ba91c7be7fbe8a0d224dd716a027
bsnmpd(8): fix and optimize interface description processing

* correctly prepare a buffer to obtain interface description from a kernel and
  truncate long description instead of dropping it altogether and
  spamming logs;
* skip calling strlen() for each description and each SNMP request
  for MIB-II/ifXTable's ifAlias.
* teach bsnmpd to allocate memory dynamically for interface descriptions
  to decrease memory usage for common case and not to break
  if long description occurs;

PR: 217763
Reviewed by: harti and others
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16459
contrib/bsnmp/snmp_mibII/mibII.c
contrib/bsnmp/snmp_mibII/mibII.h
contrib/bsnmp/snmp_mibII/mibII_interfaces.c
contrib/bsnmp/snmp_mibII/snmp_mibII.h