summaryrefslogtreecommitdiff
path: root/lib/agentx.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-11-04 14:20:57 -0400
committerDonald Sharp <sharpd@nvidia.com>2022-12-15 11:14:53 -0500
commit6f83bbd614b9bc8b05d73227e1268c018a1c0c17 (patch)
tree5d4d192fa278c1d8caf36fada4a9a7897bfc48c0 /lib/agentx.c
parent2fcd46fe3817f162d08703ed9ab680f52ac0b24c (diff)
lib: On shutdown, disable snmp from working
When shutting down ensure that any daemon operating with snmp tells it to stop operating so no more data is sent. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/agentx.c')
-rw-r--r--lib/agentx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/agentx.c b/lib/agentx.c
index bdf0d97169..5f62459805 100644
--- a/lib/agentx.c
+++ b/lib/agentx.c
@@ -32,6 +32,8 @@
#include "linklist.h"
#include "lib/version.h"
#include "lib_errors.h"
+#include "hook.h"
+#include "libfrr.h"
#include "xref.h"
XREF_SETUP();
@@ -245,6 +247,13 @@ DEFUN (no_agentx,
return CMD_WARNING_CONFIG_FAILED;
}
+static int smux_disable(void)
+{
+ agentx_enabled = false;
+
+ return 0;
+}
+
bool smux_enabled(void)
{
return agentx_enabled;
@@ -264,6 +273,8 @@ void smux_init(struct thread_master *tm)
install_node(&agentx_node);
install_element(CONFIG_NODE, &agentx_enable_cmd);
install_element(CONFIG_NODE, &no_agentx_cmd);
+
+ hook_register(frr_early_fini, smux_disable);
}
void smux_agentx_enable(void)