diff options
Diffstat (limited to 'ospfd/ospf_main.c')
-rw-r--r-- | ospfd/ospf_main.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 6a4a9a1..fdb4e5c 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -28,6 +28,7 @@ #include "libfrr.h" #include "routemap.h" #include "keychain.h" +#include "libagentx.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_interface.h" @@ -44,6 +45,7 @@ #include "ospfd/ospf_errors.h" #include "ospfd/ospf_ldp_sync.h" #include "ospfd/ospf_routemap_nb.h" +#include "ospfd/ospf_apiserver.h" #define OSPFD_STATE_NAME "%s/ospfd.json", frr_libstatedir #define OSPFD_INST_STATE_NAME(i) "%s/ospfd-%d.json", frr_runstatedir, i @@ -75,6 +77,7 @@ struct zebra_privs_t ospfd_privs = { const struct option longopts[] = { {"instance", required_argument, NULL, 'n'}, {"apiserver", no_argument, NULL, 'a'}, + {"apiserver_addr", required_argument, NULL, 'l'}, {0} }; @@ -83,10 +86,6 @@ const struct option longopts[] = { /* Master of threads. */ struct event_loop *master; -#ifdef SUPPORT_OSPF_API -extern int ospf_apiserver_enable; -#endif /* SUPPORT_OSPF_API */ - /* SIGHUP handler. */ static void sighup(void) { @@ -134,6 +133,8 @@ static const struct frr_yang_module_info *const ospfd_yang_modules[] = { &frr_route_map_info, &frr_vrf_info, &frr_ospf_route_map_info, + &ietf_key_chain_info, + &ietf_key_chain_deviation_info, }; /* actual paths filled in main() */ @@ -191,15 +192,11 @@ static void ospf_config_end(void) /* OSPFd main routine. */ int main(int argc, char **argv) { -#ifdef SUPPORT_OSPF_API - /* OSPF apiserver is disabled by default. */ - ospf_apiserver_enable = 0; -#endif /* SUPPORT_OSPF_API */ - frr_preinit(&ospfd_di, argc, argv); - frr_opt_add("n:a", longopts, + frr_opt_add("n:al:", longopts, " -n, --instance Set the instance id\n" - " -a, --apiserver Enable OSPF apiserver\n"); + " -a, --apiserver Enable OSPF apiserver\n" + " -l, --apiserver_addr Set OSPF apiserver bind address\n"); while (1) { int opt; @@ -221,6 +218,14 @@ int main(int argc, char **argv) case 'a': ospf_apiserver_enable = 1; break; + case 'l': + if (inet_pton(AF_INET, optarg, &ospf_apiserver_addr) <= + 0) { + zlog_err("OSPF: Invalid API Server IPv4 address %s specified", + optarg); + exit(0); + } + break; #endif /* SUPPORT_OSPF_API */ default: frr_help_exit(1); @@ -252,6 +257,7 @@ int main(int argc, char **argv) master = om->master; /* Library inits. */ + libagentx_init(); ospf_debug_init(); ospf_vrf_init(); |