]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Fix register stop behavior
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 17 Aug 2016 19:27:03 +0000 (19:27 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:06 +0000 (20:26 -0500)
Register stop was not being sent on a consistent basis.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_register.c
pimd/pim_upstream.c

index 79f9283138cdbf7a4eb530f85bfe923a839eaa0c..471279f077178c6383c8e48cbf9e47c36bed9a4a 100644 (file)
@@ -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;
     }
index 3685c6899fd0aa3fa70f7264a68098f48cf4010c..da1a1c7666fa893da788f8220ec55184b1cae9e1 100644 (file)
@@ -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;