From 7fcdfb34acd927d5ea15e871f6627385a3eac5d9 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 16 Jul 2016 08:27:24 -0400 Subject: [PATCH] pimd: Make pim_upstream_switch non static Allow pim_upstream_switch to be called from outside of pim_upstream.c Also change the assert to an if test to just correctly stop the timer. Signed-off-by: Donald Sharp --- pimd/pim_upstream.c | 11 +++++------ pimd/pim_upstream.h | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 3b533d27fe..a2f34d24e9 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -318,8 +318,9 @@ static void forward_off(struct pim_upstream *up) } /* scan iflist */ } -static void pim_upstream_switch(struct pim_upstream *up, - enum pim_upstream_state new_state) +void +pim_upstream_switch(struct pim_upstream *up, + enum pim_upstream_state new_state) { enum pim_upstream_state old_state = up->join_state; @@ -353,13 +354,11 @@ static void pim_upstream_switch(struct pim_upstream *up, up->source_addr, up->group_addr, 0 /* prune */); - zassert(up->t_join_timer); - THREAD_OFF(up->t_join_timer); + if (up->t_join_timer) + THREAD_OFF(up->t_join_timer); } - } - static struct pim_upstream *pim_upstream_new(struct in_addr source_addr, struct in_addr group_addr, struct interface *incoming) diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index 5e7d6114df..78206e8db7 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -155,5 +155,7 @@ void pim_upstream_start_register_stop_timer (struct pim_upstream *up, int null_r void pim_upstream_send_join (struct pim_upstream *up); +void pim_upstream_switch (struct pim_upstream *up, enum pim_upstream_state new_state); + const char *pim_upstream_state2str (struct pim_upstream *up); #endif /* PIM_UPSTREAM_H */ -- 2.39.5