blob: 5cbb60d8e5dcfba417ce8fa81bdc9179745cde09 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From d619cd9fc01f336ff0ff55b18f9112789eb4d84c 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
17index 6566354..eb0d4b4 100644
18--- a/agent/snmpd.c
19+++ b/agent/snmpd.c
20@@ -1239,6 +1239,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
29index 771ba3b..5de05e7 100644
30--- a/snmplib/snmpv3.c
31+++ b/snmplib/snmpv3.c
32@@ -1060,9 +1060,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