SNMP context details are not removing from cache

Abhishek Singh <[email protected]> Fri, 5 Aug 2022 18:10:00 +0530
Newsgroups gmane.network.net-snmp.devel
Message-ID <CAKL5aj2MJaA-QDEYcbbTCOrM5D6SnSkZeLocWWNKMN2ETTXVJA@mail.gmail.com>
Hello,

I have a requirement not to restart snmpd for SNMP config changes.
Am using the SIGHUP signal to reread for any snmp configuration changes.
I was facing two issues while using SIGHUP.
1. The issue was existing snmpv3 details were not updated in the net-snmp
cache. Used clear_user_list() to clear users details. The patch is in
attachments. Is this the correct way to go forward?
2. SNMP context details are not removed from the net-snmp cache after
deleting context details.
Do we have any API to clear SNMPv3 context details from cache?

Please share API or any other way to solve this problem.


Thanks,
Abhishek Singh

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
agent_usm.patch (application/octet-stream, 643 B)
--- a/agent/snmpd.c     2018-03-09 04:34:56.000000000 -0800
+++ b/agent/snmpd.c     2021-08-18 04:21:33.189243523 -0700
@@ -38,6 +38,7 @@
 #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-features.h>
 #include <net-snmp/types.h>
+#include <net-snmp/library/snmpusm.h>

 #if HAVE_IO_H
 #include <io.h>
@@ -1232,6 +1233,7 @@
            snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
                     netsnmp_get_version());
             update_config();
+            clear_user_list();
             send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
 #if HAVE_SIGHOLD
             sigrelse(SIGHUP);