Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Oct 2017 21:26:49 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325067 - head/usr.sbin/bsnmpd/modules/snmp_hostres
Message-ID:  <201710282126.v9SLQnuw071928@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710282126.v9SLQnuw071928>