svn commit: r325067 - head/usr.sbin/bsnmpd/modules/snmp_hostres

Pedro F. Giffuni pfg at FreeBSD.org
Sat Oct 28 21:26:51 UTC 2017


Author: pfg
Date: Sat Oct 28 21:26:49 2017
New Revision: 325067
URL: https://svnweb.freebsd.org/changeset/base/325067

Log:
  bsnmpd: Only refresh devtree if devd event is a new or removed device.
  
  It makes sense to refresh the tree only when a device is inserted or
  removed, otherwise bsnmpd wastes lot of CPU.
  
  PR:		209368
  MFC after:	1 week

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c	Sat Oct 28 20:09:34 2017	(r325066)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c	Sat Oct 28 21:26:49 2017	(r325067)
@@ -479,7 +479,9 @@ again:
 	} else {
 		if (read_len == sizeof(buf))
 			goto again;
-		refresh_device_tbl(1);
+		/* Only refresh device table on a device add or remove event. */
+		if (buf[0] == '+' || buf[0] == '-')
+			refresh_device_tbl(1);
 	}
 }
 


More information about the svn-src-all mailing list