blob: 022eb958f3f5c7dd8ee13196ac79841bc2304912 [file] [log] [blame]
Andrew Geissler69721092021-07-23 12:57:00 -04001From 1e3178835217ba89aa355e2b6b88e490f17be16d Mon Sep 17 00:00:00 2001
2From: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
3Date: Wed, 9 Jun 2021 15:47:30 +0900
Brad Bishopd7bf8c12018-02-25 22:55:05 -05004Subject: [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 Geissler69721092021-07-23 12:57:00 -040017index 1af439f..355b510 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080018--- a/agent/snmpd.c
19+++ b/agent/snmpd.c
Andrew Geissler69721092021-07-23 12:57:00 -040020@@ -1208,6 +1208,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();
Andrew Geissler69721092021-07-23 12:57:00 -040024+ snmp_store(app_name);
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025 send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
Andrew Geissler69721092021-07-23 12:57:00 -040026 #if HAVE_SIGPROCMASK
27 ret = sigprocmask(SIG_UNBLOCK, &set, NULL);
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
Andrew Geissler69721092021-07-23 12:57:00 -040044--
452.25.1
46