diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2016-06-12 17:52:50 +0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2017-03-25 08:52:36 +0100 |
commit | 5986b66b82d2c8a15c9467032d912be07481f07d (patch) | |
tree | 500817709850f882497bfc820dd2d0ed3c247f92 /ospf6d | |
parent | *: use hooks for sending SNMP traps (diff) | |
download | frr-5986b66b82d2c8a15c9467032d912be07481f07d.tar.xz frr-5986b66b82d2c8a15c9467032d912be07481f07d.zip |
*: snmp: convert into modules
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/Makefile.am | 12 | ||||
-rw-r--r-- | ospf6d/ospf6_snmp.c | 27 | ||||
-rw-r--r-- | ospf6d/ospf6d.c | 8 |
3 files changed, 28 insertions, 19 deletions
diff --git a/ospf6d/Makefile.am b/ospf6d/Makefile.am index 30268c688..933a97ca8 100644 --- a/ospf6d/Makefile.am +++ b/ospf6d/Makefile.am @@ -7,6 +7,7 @@ INSTALL_SDATA=@INSTALL@ -m 600 AM_CFLAGS = $(WERROR) noinst_LIBRARIES = libospf6.a +module_LTLIBRARIES = sbin_PROGRAMS = ospf6d libospf6_a_SOURCES = \ @@ -14,7 +15,7 @@ libospf6_a_SOURCES = \ ospf6_network.c ospf6_message.c ospf6_lsa.c ospf6_lsdb.c \ ospf6_top.c ospf6_area.c ospf6_interface.c ospf6_neighbor.c \ ospf6_flood.c ospf6_route.c ospf6_intra.c ospf6_zebra.c \ - ospf6_spf.c ospf6_proto.c ospf6_asbr.c ospf6_abr.c ospf6_snmp.c \ + ospf6_spf.c ospf6_proto.c ospf6_asbr.c ospf6_abr.c \ ospf6d.c ospf6_bfd.c noinst_HEADERS = \ @@ -28,7 +29,14 @@ noinst_HEADERS = \ ospf6d_SOURCES = \ ospf6_main.c $(libospf6_a_SOURCES) -ospf6d_LDADD = ../lib/libfrr.la ../lib/libfrrsnmp.la @LIBCAP@ +ospf6d_LDADD = ../lib/libfrr.la @LIBCAP@ + +if SNMP +module_LTLIBRARIES += ospf6d_snmp.la +endif +ospf6d_snmp_la_SOURCES = ospf6_snmp.c +ospf6d_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic +ospf6d_snmp_la_LIBADD = ../lib/libfrrsnmp.la examplesdir = $(exampledir) dist_examples_DATA = ospf6d.conf.sample diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index 57fc94fd5..96f1e3dd2 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -21,8 +21,6 @@ #include <zebra.h> -#ifdef HAVE_SNMP - #include <net-snmp/net-snmp-config.h> #include <net-snmp/net-snmp-includes.h> @@ -32,6 +30,8 @@ #include "vector.h" #include "vrf.h" #include "smux.h" +#include "libfrr.h" +#include "version.h" #include "ospf6_proto.h" #include "ospf6_lsa.h" @@ -46,8 +46,6 @@ #include "ospf6_asbr.h" #include "ospf6d.h" -void ospf6_snmp_init (struct thread_master *master); - /* OSPFv3-MIB */ #define OSPFv3MIB 1,3,6,1,2,1,191 @@ -1194,15 +1192,26 @@ ospf6TrapIfStateChange (struct ospf6_interface *oi, } /* Register OSPFv3-MIB. */ -void +static int ospf6_snmp_init (struct thread_master *master) { - hook_register(ospf6_interface_change, ospf6TrapIfStateChange); - hook_register(ospf6_neighbor_change, ospf6TrapNbrStateChange); - smux_init (master); REGISTER_MIB ("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid); + return 0; } -#endif /* HAVE_SNMP */ +static int +ospf6_snmp_module_init (void) +{ + hook_register(ospf6_interface_change, ospf6TrapIfStateChange); + hook_register(ospf6_neighbor_change, ospf6TrapNbrStateChange); + hook_register(frr_late_init, ospf6_snmp_init); + return 0; +} +FRR_MODULE_SETUP( + .name = "ospf6d_snmp", + .version = FRR_VERSION, + .description = "ospf6d AgentX SNMP module", + .init = ospf6_snmp_module_init, +) diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 9a5868f57..036cc6d4c 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -45,10 +45,6 @@ #include "ospf6d.h" #include "ospf6_bfd.h" -#ifdef HAVE_SNMP -extern void ospf6_snmp_init (struct thread_master *); -#endif /*HAVE_SNMP*/ - char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION; struct route_node * @@ -1215,10 +1211,6 @@ ospf6_init (void) ospf6_asbr_init (); ospf6_abr_init (); -#ifdef HAVE_SNMP - ospf6_snmp_init (master); -#endif /*HAVE_SNMP*/ - ospf6_bfd_init(); install_node (&debug_node, config_write_ospf6_debug); |