pimd: Fix various ifdown/ifup scenarios w/ J/P Agg

There exists situations where we may have cleaned not
properly cleaned up the various J/P aggregation lists.
This commit fixes those issues.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-03-06 12:56:32 -05:00
parent 1a664f5e36
commit fc9d070da4
2 changed files with 32 additions and 14 deletions

View File

@ -81,15 +81,27 @@ pim_jp_agg_src_cmp (void *arg1, void *arg2)
return 0; return 0;
} }
/*
* This function is used by scan_oil to clear
* the created jp_agg_group created when
* figuring out where to send prunes
* and joins.
*/
void void
pim_jp_agg_clear_group (struct list *group) pim_jp_agg_clear_group (struct list *group)
{ {
struct listnode *node, *nnode; struct listnode *gnode, *gnnode;
struct listnode *snode, *snnode;
struct pim_jp_agg_group *jag; struct pim_jp_agg_group *jag;
struct pim_jp_sources *js;
for (ALL_LIST_ELEMENTS(group, node, nnode, jag)) for (ALL_LIST_ELEMENTS(group, gnode, gnnode, jag))
{ {
list_delete(jag->sources); for (ALL_LIST_ELEMENTS(jag->sources, snode, snnode, js))
{
listnode_delete(jag->sources, js);
XFREE(MTYPE_PIM_JP_AGG_SOURCE, js);
}
jag->sources = NULL; jag->sources = NULL;
listnode_delete(group, jag); listnode_delete(group, jag);
XFREE(MTYPE_PIM_JP_AGG_GROUP, jag); XFREE(MTYPE_PIM_JP_AGG_GROUP, jag);

View File

@ -166,7 +166,6 @@ pim_upstream_del(struct pim_upstream *up, const char *name)
if (up->ref_count >= 1) if (up->ref_count >= 1)
return; return;
join_timer_stop(up);
THREAD_OFF(up->t_ka_timer); THREAD_OFF(up->t_ka_timer);
THREAD_OFF(up->t_rs_timer); THREAD_OFF(up->t_rs_timer);
THREAD_OFF(up->t_msdp_reg_timer); THREAD_OFF(up->t_msdp_reg_timer);
@ -181,6 +180,9 @@ pim_upstream_del(struct pim_upstream *up, const char *name)
} }
} }
join_timer_stop(up);
up->rpf.source_nexthop.interface = NULL;
if (up->sg.src.s_addr != INADDR_ANY) { if (up->sg.src.s_addr != INADDR_ANY) {
wheel_remove_item (pim_upstream_sg_wheel, up); wheel_remove_item (pim_upstream_sg_wheel, up);
notify_msdp = true; notify_msdp = true;
@ -252,7 +254,8 @@ static int on_join_timer(struct thread *t)
* Don't send the join if the outgoing interface is a loopback * Don't send the join if the outgoing interface is a loopback
* But since this might change leave the join timer running * But since this might change leave the join timer running
*/ */
if (!if_is_loopback (up->rpf.source_nexthop.interface)) if (up->rpf.source_nexthop.interface &&
!if_is_loopback (up->rpf.source_nexthop.interface))
pim_upstream_send_join (up); pim_upstream_send_join (up);
join_timer_start(up); join_timer_start(up);
@ -276,8 +279,10 @@ static void join_timer_stop(struct pim_upstream *up)
void void
join_timer_start(struct pim_upstream *up) join_timer_start(struct pim_upstream *up)
{ {
struct pim_neighbor *nbr; struct pim_neighbor *nbr = NULL;
if (up->rpf.source_nexthop.interface)
{
nbr = pim_neighbor_find (up->rpf.source_nexthop.interface, nbr = pim_neighbor_find (up->rpf.source_nexthop.interface,
up->rpf.rpf_addr.u.prefix4); up->rpf.rpf_addr.u.prefix4);
@ -287,6 +292,7 @@ join_timer_start(struct pim_upstream *up)
qpim_t_periodic, qpim_t_periodic,
up->sg_str); up->sg_str);
} }
}
if (nbr) if (nbr)
pim_jp_agg_add_group (nbr->upstream_jp_agg, up, 1); pim_jp_agg_add_group (nbr->upstream_jp_agg, up, 1);