From: Donald Sharp Date: Fri, 16 Oct 2015 14:50:16 +0000 (-0700) Subject: pimd: Add code to start the KAT(S,G) as needed X-Git-Tag: frr-2.0-rc1~827 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=f14248dddb3f40870cbded81778e5e9749208a89;p=mirror%2Ffrr.git pimd: Add code to start the KAT(S,G) as needed The KAT(S,G) timer can now be started and on expiry the timer clears the PMBR(S,G). More work needs to be done for when this timer pops, but good enough of a start now. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_br.c b/pimd/pim_br.c index db4aa3e864..6958ad545d 100644 --- a/pimd/pim_br.c +++ b/pimd/pim_br.c @@ -81,6 +81,26 @@ pim_br_set_pmbr (struct in_addr source, struct in_addr group, struct in_addr br) pim_br->pmbr = br; } +/* + * Remove the (S,G) from the stored values + */ +void +pim_br_clear_pmbr (struct in_addr source, struct in_addr group) +{ + struct listnode *node, *next; + struct pim_br *pim_br; + + for (ALL_LIST_ELEMENTS (pim_br_list, node, next, pim_br)) { + if (source.s_addr == pim_br->source.s_addr && + group.s_addr == pim_br->group.s_addr) + break; + } + + if (!pim_br) + return; + + listnode_delete (pim_br_list, pim_br); +} void pim_br_init (void) { diff --git a/pimd/pim_br.h b/pimd/pim_br.h index 8986d01622..06b10ada30 100644 --- a/pimd/pim_br.h +++ b/pimd/pim_br.h @@ -24,6 +24,7 @@ struct in_addr pim_br_get_pmbr (struct in_addr source, struct in_addr group); void pim_br_set_pmbr (struct in_addr source, struct in_addr group, struct in_addr value); +void pim_br_clear_pmbr (struct in_addr source, struct in_addr group); void pim_br_init (void); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index d22362fc07..6ac968ac11 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -45,6 +45,7 @@ #include "pim_oil.h" #include "pim_macro.h" #include "pim_rp.h" +#include "pim_br.h" static void join_timer_start(struct pim_upstream *up); static void pim_upstream_update_assert_tracking_desired(struct pim_upstream *up); @@ -65,6 +66,7 @@ static void upstream_channel_oil_detach(struct pim_upstream *up) void pim_upstream_delete(struct pim_upstream *up) { THREAD_OFF(up->t_join_timer); + THREAD_OFF(up->t_ka_timer); upstream_channel_oil_detach(up); @@ -699,3 +701,34 @@ static void pim_upstream_update_assert_tracking_desired(struct pim_upstream *up) } /* scan iface channel list */ } /* scan iflist */ } + +/* + * On an RP, the PMBR value must be cleared when the + * Keepalive Timer expires + */ +static int +pim_upstream_keep_alive_timer (struct thread *t) +{ + struct pim_upstream *up; + + up = THREAD_ARG(t); + + pim_br_clear_pmbr (up->source_addr, up->group_addr); + /* + * We need to do more here :) + * But this is the start. + */ + + return 0; +} + + +void +pim_upstream_keep_alive_timer_start (struct pim_upstream *up, + uint32_t time) +{ + THREAD_TIMER_ON (master, + up->t_ka_timer, + pim_upstream_keep_alive_timer, + up, time); +} diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index 6ffe165954..fd277c1f6e 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -135,4 +135,5 @@ void pim_upstream_rpf_interface_changed(struct pim_upstream *up, void pim_upstream_update_could_assert(struct pim_upstream *up); void pim_upstream_update_my_assert_metric(struct pim_upstream *up); +void pim_upstream_keep_alive_timer_start (struct pim_upstream *up, uint32_t time); #endif /* PIM_UPSTREAM_H */