From 6aa80778e8f2e1e5a9b213636a0b5f4c5864bcc3 Mon Sep 17 00:00:00 2001 From: Li Zhou Date: Fri, 28 Jul 2017 09:39:26 +0800 Subject: net-snmp: fix engineBoots value on SIGHUP Store the incremented engineBoots value on SIGHUP. And don't reset engineBoots to 1 when oldEngineIDLength is 0. For the first run, the oldEngineIDLength is 0. When we say first run of the daemon, we talk about the first run ever on the machine, not only first run of every boot. Signed-off-by: Marian Florea Reviewed-by: Wenkuan Wang Reviewed-by: Zhaolong Zhang Signed-off-by: Li Zhou Signed-off-by: Martin Jansa --- ...nmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch | 45 ++++++++++++++++++++++ .../recipes-protocols/net-snmp/net-snmp_5.7.3.bb | 1 + 2 files changed, 46 insertions(+) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch (limited to 'meta-networking/recipes-protocols') diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch new file mode 100644 index 0000000000..efe803876d --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch @@ -0,0 +1,45 @@ +From e47c60dc7f649959f63e56bc62355de4bdfd73f4 Mon Sep 17 00:00:00 2001 +From: Marian Florea +Date: Thu, 20 Jul 2017 16:55:24 +0800 +Subject: [PATCH] net snmp: fix engineBoots value on SIGHUP + +Upstream-Status: Pending + +Signed-off-by: Marian Florea +Signed-off-by: Li Zhou +--- + 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 056048a..12a7ea1 100644 +--- a/agent/snmpd.c ++++ b/agent/snmpd.c +@@ -1246,6 +1246,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_SIGHOLD + sigrelse(SIGHUP); +diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c +index 435cafd..6ad8208 100644 +--- a/snmplib/snmpv3.c ++++ b/snmplib/snmpv3.c +@@ -984,9 +984,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; + } + +-- +1.9.1 + diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb index 2d6887e377..af6fd1b1fe 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb @@ -30,6 +30,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ file://0002-configure-fix-a-cc-check-issue.patch \ file://0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch \ file://0004-configure-fix-incorrect-variable.patch \ + file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \ " SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee" SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e" -- cgit 1.2.3-korg