aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch
blob: 022eb958f3f5c7dd8ee13196ac79841bc2304912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 1e3178835217ba89aa355e2b6b88e490f17be16d Mon Sep 17 00:00:00 2001
From: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Date: Wed, 9 Jun 2021 15:47:30 +0900
Subject: [PATCH] net snmp: fix engineBoots value on SIGHUP

Upstream-Status: Pending

Signed-off-by: Marian Florea <marian.florea@windriver.com>
Signed-off-by: Li Zhou <li.zhou@windriver.com>

---
 agent/snmpd.c    | 1 +
 snmplib/snmpv3.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/agent/snmpd.c b/agent/snmpd.c
index 1af439f..355b510 100644
--- a/agent/snmpd.c
+++ b/agent/snmpd.c
@@ -1208,6 +1208,7 @@ receive(void)
 	    snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
 		     netsnmp_get_version());
             update_config();
+	    snmp_store(app_name);
             send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
 #if HAVE_SIGPROCMASK
             ret = sigprocmask(SIG_UNBLOCK, &set, NULL);
diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c
index 29c2a0f..ada961c 100644
--- a/snmplib/snmpv3.c
+++ b/snmplib/snmpv3.c
@@ -1059,9 +1059,9 @@ init_snmpv3_post_config(int majorid, int minorid, void *serverarg,
     /*
      * if our engineID has changed at all, the boots record must be set to 1 
      */
-    if (engineIDLen != oldEngineIDLength ||
+    if (oldEngineIDLength != (size_t)0 && (engineIDLen != oldEngineIDLength ||
         oldEngineID == NULL || c_engineID == NULL ||
-        memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
+        memcmp(oldEngineID, c_engineID, engineIDLen) != 0)) {
         engineBoots = 1;
     }
 
-- 
2.25.1