blob: efe803876dbaef80542cf3f25ac59726c22c7a9b [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From e47c60dc7f649959f63e56bc62355de4bdfd73f4 Mon Sep 17 00:00:00 2001
2From: 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>
10---
11 agent/snmpd.c | 1 +
12 snmplib/snmpv3.c | 4 ++--
13 2 files changed, 3 insertions(+), 2 deletions(-)
14
15diff --git a/agent/snmpd.c b/agent/snmpd.c
16index 056048a..12a7ea1 100644
17--- a/agent/snmpd.c
18+++ b/agent/snmpd.c
19@@ -1246,6 +1246,7 @@ receive(void)
20 snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
21 netsnmp_get_version());
22 update_config();
23+ snmp_store(app_name);
24 send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
25 #if HAVE_SIGHOLD
26 sigrelse(SIGHUP);
27diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c
28index 435cafd..6ad8208 100644
29--- a/snmplib/snmpv3.c
30+++ b/snmplib/snmpv3.c
31@@ -984,9 +984,9 @@ init_snmpv3_post_config(int majorid, int minorid, void *serverarg,
32 /*
33 * if our engineID has changed at all, the boots record must be set to 1
34 */
35- if (engineIDLen != oldEngineIDLength ||
36+ if (oldEngineIDLength != (size_t)0 && (engineIDLen != oldEngineIDLength ||
37 oldEngineID == NULL || c_engineID == NULL ||
38- memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
39+ memcmp(oldEngineID, c_engineID, engineIDLen) != 0)) {
40 engineBoots = 1;
41 }
42
43--
441.9.1
45