summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2017-11-04 14:49:22 +0000
committerpfg <pfg@FreeBSD.org>2017-11-04 14:49:22 +0000
commite71d890235222bbbdceb5f326e7ce96012abfd49 (patch)
treecd8b3da744c2c7cadb767d893589dc7662d3d19a /usr.sbin/bsnmpd
parentd27785b10fa4530fa6a277262ab105a6b0d17c42 (diff)
downloadFreeBSD-src-e71d890235222bbbdceb5f326e7ce96012abfd49.zip
FreeBSD-src-e71d890235222bbbdceb5f326e7ce96012abfd49.tar.gz
MFC r325067:
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 needlessly wastes lots of CPU. PR: 209368
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
index 8216acc..a360898 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
+++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
@@ -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);
}
}
OpenPOWER on IntegriCloud