From: Donald Sharp Date: Wed, 17 Aug 2016 19:27:03 +0000 (+0000) Subject: pimd: Fix register stop behavior X-Git-Tag: frr-3.0-branchpoint~64^2~10^2~286 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=bb027ee881eec8e98e30be04432438f644bb3979;p=mirror%2Ffrr.git pimd: Fix register stop behavior Register stop was not being sent on a consistent basis. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 79f9283138..471279f077 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -131,10 +131,12 @@ pim_register_stop_recv (uint8_t *buf, int buf_size) return 0; break; case PIM_UPSTREAM_JOINED: + upstream->join_state = PIM_UPSTREAM_PRUNE; + pim_channel_del_oif (upstream->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM); + pim_upstream_start_register_stop_timer (upstream, 0); case PIM_UPSTREAM_JOIN_PENDING: upstream->join_state = PIM_UPSTREAM_PRUNE; pim_upstream_start_register_stop_timer (upstream, 0); - pim_channel_del_oif (upstream->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM); return 0; break; } diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 3685c6899f..da1a1c7666 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -380,9 +380,6 @@ pim_upstream_switch(struct pim_upstream *up, { enum pim_upstream_state old_state = up->join_state; - up->join_state = new_state; - up->state_transition = pim_time_monotonic_sec(); - if (PIM_DEBUG_PIM_EVENTS) { zlog_debug("%s: PIM_UPSTREAM_%s: (S,G)=%s", __PRETTY_FUNCTION__, @@ -390,6 +387,22 @@ pim_upstream_switch(struct pim_upstream *up, pim_str_sg_dump (&up->sg)); } + /* + * This code still needs work. + */ + switch (up->join_state) + { + case PIM_UPSTREAM_PRUNE: + case PIM_UPSTREAM_JOIN_PENDING: + break; + case PIM_UPSTREAM_NOTJOINED: + case PIM_UPSTREAM_JOINED: + up->join_state = new_state; + up->state_transition = pim_time_monotonic_sec(); + + break; + } + pim_upstream_update_assert_tracking_desired(up); if (new_state == PIM_UPSTREAM_JOINED) { @@ -911,7 +924,6 @@ pim_upstream_register_stop_timer (struct thread *t) struct pim_upstream *up; struct pim_rpf *rpg; struct ip ip_hdr; - up = THREAD_ARG (t); THREAD_TIMER_OFF (up->t_rs_timer); @@ -927,6 +939,9 @@ pim_upstream_register_stop_timer (struct thread *t) { case PIM_UPSTREAM_JOIN_PENDING: up->join_state = PIM_UPSTREAM_JOINED; + pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM); + break; + case PIM_UPSTREAM_JOINED: break; case PIM_UPSTREAM_PRUNE: up->join_state = PIM_UPSTREAM_JOIN_PENDING;