summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <Jafaral@users.noreply.github.com>2017-03-08 15:59:07 +0100
committerGitHub <noreply@github.com>2017-03-08 15:59:07 +0100
commitbaf9c436222ef0901caf2ba694f87a2746ddcd02 (patch)
tree065defcca23e718bb9371f64240214ec2fae388f
parentMerge pull request #261 from opensourcerouting/lib_cleanup (diff)
parentpimd: Don't double include Source (diff)
downloadfrr-baf9c436222ef0901caf2ba694f87a2746ddcd02.tar.xz
frr-baf9c436222ef0901caf2ba694f87a2746ddcd02.zip
Merge pull request #262 from donaldsharp/pim_jp_fixesfrr-3.0-branchpoint
Pim jp fixes
-rw-r--r--pimd/pim_jp_agg.c37
-rw-r--r--pimd/pim_upstream.c30
2 files changed, 47 insertions, 20 deletions
diff --git a/pimd/pim_jp_agg.c b/pimd/pim_jp_agg.c
index ca9d62e63..67ddf05d0 100644
--- a/pimd/pim_jp_agg.c
+++ b/pimd/pim_jp_agg.c
@@ -81,15 +81,27 @@ pim_jp_agg_src_cmp (void *arg1, void *arg2)
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
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_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;
listnode_delete(group, jag);
XFREE(MTYPE_PIM_JP_AGG_GROUP, jag);
@@ -158,7 +170,7 @@ pim_jp_agg_add_group (struct list *group, struct pim_upstream *up, bool is_join)
{
struct listnode *node, *nnode;
struct pim_jp_agg_group *jag = NULL;
- struct pim_jp_sources *js;
+ struct pim_jp_sources *js = NULL;
for (ALL_LIST_ELEMENTS(group, node, nnode, jag))
{
@@ -176,11 +188,20 @@ pim_jp_agg_add_group (struct list *group, struct pim_upstream *up, bool is_join)
listnode_add (group, jag);
}
- js = XCALLOC(MTYPE_PIM_JP_AGG_SOURCE, sizeof (struct pim_jp_sources));
- js->up = up;
- js->is_join = is_join;
+ for (ALL_LIST_ELEMENTS(jag->sources, node, nnode, js))
+ {
+ if (js->up->sg.src.s_addr == up->sg.src.s_addr)
+ break;
+ }
- listnode_add (jag->sources, js);
+ if (!js)
+ {
+ js = XCALLOC(MTYPE_PIM_JP_AGG_SOURCE, sizeof (struct pim_jp_sources));
+ js->up = up;
+ listnode_add (jag->sources, js);
+ }
+
+ js->is_join = is_join;
}
void
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index ce567824f..4187635b1 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -166,7 +166,6 @@ pim_upstream_del(struct pim_upstream *up, const char *name)
if (up->ref_count >= 1)
return;
- join_timer_stop(up);
THREAD_OFF(up->t_ka_timer);
THREAD_OFF(up->t_rs_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) {
wheel_remove_item (pim_upstream_sg_wheel, up);
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
* 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);
join_timer_start(up);
@@ -276,17 +279,20 @@ static void join_timer_stop(struct pim_upstream *up)
void
join_timer_start(struct pim_upstream *up)
{
- struct pim_neighbor *nbr;
-
- nbr = pim_neighbor_find (up->rpf.source_nexthop.interface,
- up->rpf.rpf_addr.u.prefix4);
+ struct pim_neighbor *nbr = NULL;
- if (PIM_DEBUG_PIM_EVENTS) {
- zlog_debug("%s: starting %d sec timer for upstream (S,G)=%s",
- __PRETTY_FUNCTION__,
- qpim_t_periodic,
- up->sg_str);
- }
+ if (up->rpf.source_nexthop.interface)
+ {
+ nbr = pim_neighbor_find (up->rpf.source_nexthop.interface,
+ up->rpf.rpf_addr.u.prefix4);
+
+ if (PIM_DEBUG_PIM_EVENTS) {
+ zlog_debug("%s: starting %d sec timer for upstream (S,G)=%s",
+ __PRETTY_FUNCTION__,
+ qpim_t_periodic,
+ up->sg_str);
+ }
+ }
if (nbr)
pim_jp_agg_add_group (nbr->upstream_jp_agg, up, 1);