blob: da6d80ef4afe4b2d94e2741c3f40ef5618111654 [file] [log] [blame]
Andrew Geisslerd688a012020-09-18 13:36:00 -05001From b6a3d6c8af35f1ef27b80b0516742fce89f4eb29 Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Marian Florea <marian.florea@windriver.com>
3Date: Thu, 20 Jul 2017 16:55:24 +0800
4Subject: [PATCH] net snmp: fix engineBoots value on SIGHUP
5
6Upstream-Status: Pending
7
8Signed-off-by: Marian Florea <marian.florea@windriver.com>
9Signed-off-by: Li Zhou <li.zhou@windriver.com>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011---
12 agent/snmpd.c | 1 +
13 snmplib/snmpv3.c | 4 ++--
14 2 files changed, 3 insertions(+), 2 deletions(-)
15
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016diff --git a/agent/snmpd.c b/agent/snmpd.c
Andrew Geisslerd688a012020-09-18 13:36:00 -050017index ae73eda..66b4560 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080018--- a/agent/snmpd.c
19+++ b/agent/snmpd.c
Andrew Geisslerd688a012020-09-18 13:36:00 -050020@@ -1207,6 +1207,7 @@ receive(void)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021 snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
22 netsnmp_get_version());
23 update_config();
24+ snmp_store(app_name);
25 send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
26 #if HAVE_SIGHOLD
27 sigrelse(SIGHUP);
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080028diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c
Andrew Geisslerd688a012020-09-18 13:36:00 -050029index 29c2a0f..ada961c 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030--- a/snmplib/snmpv3.c
31+++ b/snmplib/snmpv3.c
Andrew Geisslerd688a012020-09-18 13:36:00 -050032@@ -1059,9 +1059,9 @@ init_snmpv3_post_config(int majorid, int minorid, void *serverarg,
Brad Bishopd7bf8c12018-02-25 22:55:05 -050033 /*
34 * if our engineID has changed at all, the boots record must be set to 1
35 */
36- if (engineIDLen != oldEngineIDLength ||
37+ if (oldEngineIDLength != (size_t)0 && (engineIDLen != oldEngineIDLength ||
38 oldEngineID == NULL || c_engineID == NULL ||
39- memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
40+ memcmp(oldEngineID, c_engineID, engineIDLen) != 0)) {
41 engineBoots = 1;
42 }
43