summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_snmp.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-06-12 17:52:50 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-03-25 08:52:36 +0100
commit5986b66b82d2c8a15c9467032d912be07481f07d (patch)
tree500817709850f882497bfc820dd2d0ed3c247f92 /ospfd/ospf_snmp.c
parent*: use hooks for sending SNMP traps (diff)
downloadfrr-5986b66b82d2c8a15c9467032d912be07481f07d.tar.xz
frr-5986b66b82d2c8a15c9467032d912be07481f07d.zip
*: snmp: convert into modules
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_snmp.c')
-rw-r--r--ospfd/ospf_snmp.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index b5813d7d5..32449d559 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -24,7 +24,6 @@
#include <zebra.h>
-#ifdef HAVE_SNMP
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
@@ -35,6 +34,8 @@
#include "command.h"
#include "memory.h"
#include "smux.h"
+#include "libfrr.h"
+#include "version.h"
#include "ospfd/ospfd.h"
#include "ospfd/ospf_interface.h"
@@ -2781,8 +2782,18 @@ ospf_snmp_ism_change (struct ospf_interface *oi,
}
/* Register OSPF2-MIB. */
-void
-ospf_snmp_init ()
+static int
+ospf_snmp_init (struct thread_master *tm)
+{
+ ospf_snmp_iflist = list_new ();
+ ospf_snmp_vl_table = route_table_init ();
+ smux_init (tm);
+ REGISTER_MIB("mibII/ospf", ospf_variables, variable, ospf_oid);
+ return 0;
+}
+
+static int
+ospf_snmp_module_init (void)
{
hook_register(ospf_if_update, ospf_snmp_if_update);
hook_register(ospf_if_delete, ospf_snmp_if_delete);
@@ -2791,9 +2802,13 @@ ospf_snmp_init ()
hook_register(ospf_ism_change, ospf_snmp_ism_change);
hook_register(ospf_nsm_change, ospf_snmp_nsm_change);
- ospf_snmp_iflist = list_new ();
- ospf_snmp_vl_table = route_table_init ();
- smux_init (om->master);
- REGISTER_MIB("mibII/ospf", ospf_variables, variable, ospf_oid);
+ hook_register(frr_late_init, ospf_snmp_init);
+ return 0;
}
-#endif /* HAVE_SNMP */
+
+FRR_MODULE_SETUP(
+ .name = "ospfd_snmp",
+ .version = FRR_VERSION,
+ .description = "ospfd AgentX SNMP module",
+ .init = ospf_snmp_module_init,
+)