diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 74a3a9836b..65bfebec3b 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -445,10 +445,9 @@ static bool pim_msdp_sa_local_add_ok(struct pim_upstream *up) return false; } - if (!up->t_ka_timer) { + if (!pim_upstream_is_kat_running(up)) /* stream is not active */ return false; - } if (!I_am_RP(pim, up->sg.grp)) { /* we are not RP for the group */ diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index c79e85cd0f..673c56ea5d 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -536,7 +536,8 @@ void pim_upstream_register_reevaluate(struct pim_instance *pim) * is actually active; if it is not kat setup will trigger * source * registration whenever the flow becomes active. */ - if (!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags) || !up->t_ka_timer) + if (!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags) || + !pim_upstream_is_kat_running(up)) continue; if (pim_is_grp_ssm(pim, up->sg.grp)) { @@ -1046,11 +1047,6 @@ static bool pim_upstream_empty_immediate_olist(struct pim_instance *pim, return true; } -static bool pim_upstream_is_kat_running(struct pim_upstream *up) -{ - return (up->t_ka_timer != NULL); -} - /* * bool JoinDesired(*,G) { * if (immediate_olist(*,G) != NULL) diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index 815896a7dd..bb0921e108 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -242,6 +242,11 @@ struct pim_upstream { int64_t state_transition; /* Record current state uptime */ }; +static inline bool pim_upstream_is_kat_running(struct pim_upstream *up) +{ + return (up->t_ka_timer != NULL); +} + struct pim_upstream *pim_upstream_find(struct pim_instance *pim, struct prefix_sg *sg); struct pim_upstream *pim_upstream_find_or_add(struct prefix_sg *sg,