From e194c8fbe2cc2b1085a3da97ddb94eb329558446 Mon Sep 17 00:00:00 2001
From: chenrufeng <chenrufeng4@huawei.com>
Date: Fri, 5 Jan 2024 10:38:35 +0800
Subject: [PATCH] Reset last_engineTime when calling init_snmpv3()

---
 snmplib/snmpv3.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c
index 29c2a0ffc..d9b9eb7d6 100644
--- a/snmplib/snmpv3.c
+++ b/snmplib/snmpv3.c
@@ -99,6 +99,10 @@ static struct timeval snmpv3starttime;
 static int      getHwAddress(const char *networkDevice, char *addressOut);
 #endif
 
+#ifdef IDEAUI_RESET_LAST_ENGINETIME
+    static uint32_t last_engineTime = 0;
+#endif
+
 /*******************************************************************-o-******
  * snmpv3_secLevel_conf
  *
@@ -949,6 +953,9 @@ init_snmpv3(const char *type)
 {
     netsnmp_get_monotonic_clock(&snmpv3starttime);
 
+#ifdef IDEAUI_RESET_LAST_ENGINETIME
+    last_engineTime = 0;
+#endif
     if (!type)
         type = "__snmpapp__";
 
@@ -1249,7 +1256,9 @@ snmpv3_local_snmpEngineTime(void)
     netsnmp_feature_require(calculate_sectime_diff)
 #endif /* NETSNMP_FEATURE_CHECKING */
 
+#ifndef IDEAUI_RESET_LAST_ENGINETIME
     static uint32_t last_engineTime;
+#endif
     struct timeval  now;
     uint32_t engineTime;
 
-- 
2.34.1

