summaryrefslogtreecommitdiff
path: root/pimd/pimd.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pimd.c')
-rw-r--r--pimd/pimd.c64
1 files changed, 28 insertions, 36 deletions
diff --git a/pimd/pimd.c b/pimd/pimd.c
index 15e52afc1d..c8a0efc401 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -23,6 +23,9 @@
#include "log.h"
#include "memory.h"
#include "if.h"
+#include "prefix.h"
+#include "vty.h"
+#include "plist.h"
#include "pimd.h"
#include "pim_cmd.h"
@@ -35,6 +38,8 @@
#include "pim_rpf.h"
#include "pim_ssmpingd.h"
#include "pim_static.h"
+#include "pim_rp.h"
+#include "pim_zlookup.h"
const char *const PIM_ALL_SYSTEMS = MCAST_ALL_SYSTEMS;
const char *const PIM_ALL_ROUTERS = MCAST_ALL_ROUTERS;
@@ -45,21 +50,15 @@ struct thread_master *master = NULL;
uint32_t qpim_debugs = 0;
int qpim_mroute_socket_fd = -1;
int64_t qpim_mroute_socket_creation = 0; /* timestamp of creation */
-struct thread *qpim_mroute_socket_reader = 0;
-int qpim_mroute_oif_highest_vif_index = -1;
-struct list *qpim_channel_oil_list = 0;
int qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */
-struct list *qpim_upstream_list = 0;
-struct zclient *qpim_zclient_update = 0;
-struct zclient *qpim_zclient_lookup = 0;
struct pim_assert_metric qpim_infinite_assert_metric;
-long qpim_rpf_cache_refresh_delay_msec = 10000;
-struct thread *qpim_rpf_cache_refresher = 0;
+long qpim_rpf_cache_refresh_delay_msec = 50;
+struct thread *qpim_rpf_cache_refresher = NULL;
int64_t qpim_rpf_cache_refresh_requests = 0;
int64_t qpim_rpf_cache_refresh_events = 0;
int64_t qpim_rpf_cache_refresh_last = 0;
struct in_addr qpim_inaddr_any;
-struct list *qpim_ssmpingd_list = 0;
+struct list *qpim_ssmpingd_list = NULL;
struct in_addr qpim_ssmpingd_group_addr;
int64_t qpim_scan_oil_events = 0;
int64_t qpim_scan_oil_last = 0;
@@ -67,8 +66,11 @@ int64_t qpim_mroute_add_events = 0;
int64_t qpim_mroute_add_last = 0;
int64_t qpim_mroute_del_events = 0;
int64_t qpim_mroute_del_last = 0;
-struct list *qpim_static_route_list = 0;
-struct pim_rpf qpim_rp = { .rpf_addr.s_addr = INADDR_NONE };
+struct list *qpim_static_route_list = NULL;
+unsigned int qpim_keep_alive_time = PIM_KEEPALIVE_PERIOD;
+signed int qpim_rp_keep_alive_time = 0;
+int64_t qpim_nexthop_lookups = 0;
+int qpim_packet_process = PIM_DEFAULT_PACKET_PROCESS;
int32_t qpim_register_suppress_time = PIM_REGISTER_SUPPRESSION_TIME_DEFAULT;
int32_t qpim_register_probe_time = PIM_REGISTER_PROBE_TIME_DEFAULT;
@@ -77,21 +79,28 @@ static void pim_free()
{
pim_ssmpingd_destroy();
- if (qpim_channel_oil_list)
- list_free(qpim_channel_oil_list);
+ pim_oil_terminate ();
- if (qpim_upstream_list)
- list_free(qpim_upstream_list);
+ pim_upstream_terminate ();
if (qpim_static_route_list)
list_free(qpim_static_route_list);
+ pim_if_terminate ();
+ pim_rp_free ();
+
pim_route_map_terminate();
+
+ zclient_lookup_free ();
+
+ zprivs_terminate(&pimd_privs);
}
void pim_init()
{
- srandom(time(NULL));
+ qpim_rp_keep_alive_time = PIM_RP_KEEPALIVE_PERIOD;
+
+ pim_rp_init ();
if (!inet_aton(PIM_ALL_PIM_ROUTERS, &qpim_all_pim_routers_addr)) {
zlog_err("%s %s: could not solve %s to group address: errno=%d: %s",
@@ -101,22 +110,9 @@ void pim_init()
return;
}
- qpim_channel_oil_list = list_new();
- if (!qpim_channel_oil_list) {
- zlog_err("%s %s: failure: channel_oil_list=list_new()",
- __FILE__, __PRETTY_FUNCTION__);
- return;
- }
- qpim_channel_oil_list->del = (void (*)(void *)) pim_channel_oil_free;
+ pim_oil_init ();
- qpim_upstream_list = list_new();
- if (!qpim_upstream_list) {
- zlog_err("%s %s: failure: upstream_list=list_new()",
- __FILE__, __PRETTY_FUNCTION__);
- pim_free();
- return;
- }
- qpim_upstream_list->del = (void (*)(void *)) pim_upstream_free;
+ pim_upstream_init ();
qpim_static_route_list = list_new();
if (!qpim_static_route_list) {
@@ -126,11 +122,7 @@ void pim_init()
}
qpim_static_route_list->del = (void (*)(void *)) pim_static_route_free;
- qpim_mroute_socket_fd = -1; /* mark mroute as disabled */
- qpim_mroute_oif_highest_vif_index = -1;
-
- zassert(!qpim_debugs);
- zassert(!PIM_MROUTE_IS_ENABLED);
+ pim_mroute_socket_enable();
qpim_inaddr_any.s_addr = PIM_NET_INADDR_ANY;