]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: simplify pim upstream state transitions
authoranuradhak <anuradhak@cumulusnetworks.com>
Thu, 9 Mar 2017 18:47:50 +0000 (10:47 -0800)
committeranuradhak <anuradhak@cumulusnetworks.com>
Fri, 10 Mar 2017 18:48:43 +0000 (10:48 -0800)
This is another follow-up change to the reg-state and up-join-state
separation. The upstream join state machine can now respond to
JoinDesired macro changes independent of router role.

I have also dropped the PRUNE state from the upstream-join-state
enumeration. RFC4601 only defines JOINED and NOTJOINED states. And PRUNE
can really be replace by NOTJOINED.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-14700
Testing Done: Register state machine in FHR only, combined FHR-RP and
FHR-RP-LHR/all-in-one setups. Also ran pim-smoke.

pimd/pim_register.c
pimd/pim_upstream.c
pimd/pim_upstream.h

index 99ddd45d7fec401faf07e13daf749cdf5205c2a4..46d8e3ec2e7ca55e1de8c5ecb8be9f86a6efdd11 100644 (file)
@@ -358,7 +358,7 @@ pim_register_recv (struct interface *ifp,
        upstream->sg.src = sg.src;
        upstream->rpf.rpf_addr = upstream->rpf.source_nexthop.mrib_nexthop_addr;
 
-       upstream->join_state = PIM_UPSTREAM_PRUNE;
+       upstream->join_state = PIM_UPSTREAM_NOTJOINED;
 
       }
 
index 5324d555ec8db284b0b4e506e2de7a052f8e96dc..19f7d3336cb99c94303202e32ecc9301d61cd1c3 100644 (file)
@@ -473,26 +473,9 @@ pim_upstream_switch(struct pim_upstream *up,
               pim_upstream_state2str (new_state));
   }
 
-  /*
-   * This code still needs work.
-   */
-  switch (up->join_state)
-    {
-    case PIM_UPSTREAM_PRUNE:
-      if (!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags))
-        {
-          up->join_state       = new_state;
-          up->state_transition = pim_time_monotonic_sec ();
-        }
-      break;
-    case PIM_UPSTREAM_NOTJOINED:
-    case PIM_UPSTREAM_JOINED:
-      up->join_state       = new_state;
-      if (old_state != new_state)
-        up->state_transition = pim_time_monotonic_sec();
-
-      break;
-    }
+  up->join_state = new_state;
+  if (old_state != new_state)
+    up->state_transition = pim_time_monotonic_sec();
 
   pim_upstream_update_assert_tracking_desired(up);
 
@@ -600,7 +583,7 @@ pim_upstream_new (struct prefix_sg *sg,
   up->t_ka_timer                 = NULL;
   up->t_rs_timer                 = NULL;
   up->t_msdp_reg_timer           = NULL;
-  up->join_state                 = 0;
+  up->join_state                 = PIM_UPSTREAM_NOTJOINED;
   up->reg_state                  = PIM_REG_NOINFO;
   up->state_transition           = pim_time_monotonic_sec();
   up->channel_oil                = NULL;
@@ -1201,9 +1184,6 @@ pim_upstream_state2str (enum pim_upstream_state join_state)
     case PIM_UPSTREAM_JOINED:
       return "Joined";
       break;
-    case PIM_UPSTREAM_PRUNE:
-      return "Prune";
-      break;
     }
   return "Unknown";
 }
index cd7c16be75ed8c1a9c0498c76278b376e63da1f5..b191fe94044cfb8472f8e8466dc831e562a517cb 100644 (file)
@@ -61,7 +61,6 @@
 enum pim_upstream_state {
   PIM_UPSTREAM_NOTJOINED,
   PIM_UPSTREAM_JOINED,
-  PIM_UPSTREAM_PRUNE,
 };
 
 enum pim_reg_state {