]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bsnmpd(8): fix and optimize interface description processing
authorEugene Grosbein <eugen@FreeBSD.org>
Sat, 18 Aug 2018 10:58:44 +0000 (10:58 +0000)
committerEugene Grosbein <eugen@FreeBSD.org>
Sat, 18 Aug 2018 10:58:44 +0000 (10:58 +0000)
commit1a498d2e689f9e8220e2ad64b018eb1f0d11127e
tree376680d94619333a618f709553fb1a478a7b0770
parent52809cc35bfa603a6fd15ea832c8d9fdc93fa5e9
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