diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-07 16:25:08 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-22 02:26:11 +0100 |
commit | 0f5889897125e5ba5d62bc1151cec3c7d6c6d404 (patch) | |
tree | 54c98d701ffd158f2b7c964206255e9dde8c7b9a /pimd/pimd.c | |
parent | pimd: Only delete on KAT when created by stream (diff) | |
download | frr-0f5889897125e5ba5d62bc1151cec3c7d6c6d404.tar.xz frr-0f5889897125e5ba5d62bc1151cec3c7d6c6d404.zip |
pimd: Add hash lookups for upstream
Diffstat (limited to 'pimd/pimd.c')
-rw-r--r-- | pimd/pimd.c | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/pimd/pimd.c b/pimd/pimd.c index 3a010e81a..82ecdc9fc 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -54,7 +54,6 @@ struct thread *qpim_mroute_socket_reader = NULL; int qpim_mroute_oif_highest_vif_index = -1; struct list *qpim_channel_oil_list = NULL; int qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */ -struct list *qpim_upstream_list = NULL; struct zclient *qpim_zclient_update = NULL; struct pim_assert_metric qpim_infinite_assert_metric; long qpim_rpf_cache_refresh_delay_msec = 2000; @@ -86,8 +85,7 @@ static void pim_free() if (qpim_channel_oil_list) list_free(qpim_channel_oil_list); - if (qpim_upstream_list) - list_free(qpim_upstream_list); + pim_upstream_terminate (); if (qpim_static_route_list) list_free(qpim_static_route_list); @@ -116,24 +114,6 @@ pim_channel_oil_compare (struct channel_oil *c1, struct channel_oil *c2) return 0; } -static int -pim_upstream_compare (struct pim_upstream *up1, struct pim_upstream *up2) -{ - if (ntohl(up1->sg.grp.s_addr) < ntohl(up2->sg.grp.s_addr)) - return -1; - - if (ntohl(up1->sg.grp.s_addr) > ntohl(up2->sg.grp.s_addr)) - return 1; - - if (ntohl(up1->sg.src.s_addr) < ntohl(up2->sg.src.s_addr)) - return -1; - - if (ntohl(up1->sg.src.s_addr) > ntohl(up2->sg.src.s_addr)) - return 1; - - return 0; -} - void pim_init() { srandom(time(NULL)); @@ -159,15 +139,7 @@ void pim_init() qpim_channel_oil_list->del = (void (*)(void *)) pim_channel_oil_free; qpim_channel_oil_list->cmp = (int (*)(void *, void *)) pim_channel_oil_compare; - 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; - qpim_upstream_list->cmp = (int (*)(void *, void *)) pim_upstream_compare; + pim_upstream_init (); qpim_static_route_list = list_new(); if (!qpim_static_route_list) { |