1From b5cbe0953a7e7a3c77c7ec69dfe81254475f08c0 Mon Sep 17 00:00:00 2001
2From: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
3Date: Wed, 9 Jun 2021 15:47:30 +0900
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>
10Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
11---
12 agent/snmpd.c    | 1 +
13 snmplib/snmpv3.c | 4 ++--
14 2 files changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/agent/snmpd.c b/agent/snmpd.c
17index fe31c87..d9f68dd 100644
18--- a/agent/snmpd.c
19+++ b/agent/snmpd.c
20@@ -1169,6 +1169,7 @@ snmpd_reconfig(void)
21     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 #ifdef HAVE_SIGPROCMASK
27     ret = sigprocmask(SIG_UNBLOCK, &set, NULL);
28diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c
29index be9256f..d17d2e3 100644
30--- a/snmplib/snmpv3.c
31+++ b/snmplib/snmpv3.c
32@@ -1071,9 +1071,9 @@ init_snmpv3_post_config(int majorid, int minorid, void *serverarg,
33     /*
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
44--
452.25.1
46
47