summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranuradhak <anuradhak@cumulusnetworks.com>2017-03-09 10:47:50 -0800
committeranuradhak <anuradhak@cumulusnetworks.com>2017-03-10 10:48:43 -0800
commitb4786acd7ea88ec0a3da8edfc4e0ce71f67b5f12 (patch)
tree4a6e881973a3cdb5b008d565452e6f865a920c94
parent0c2ebf00a628772c09ec97f970ae34b8076e9976 (diff)
pimd: simplify pim upstream state transitions
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.
-rw-r--r--pimd/pim_register.c2
-rw-r--r--pimd/pim_upstream.c28
-rw-r--r--pimd/pim_upstream.h1
3 files changed, 5 insertions, 26 deletions
diff --git a/pimd/pim_register.c b/pimd/pim_register.c
index 99ddd45d7f..46d8e3ec2e 100644
--- a/pimd/pim_register.c
+++ b/pimd/pim_register.c
@@ -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;
}
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index 5324d555ec..19f7d3336c 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -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";
}
diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h
index cd7c16be75..b191fe9404 100644
--- a/pimd/pim_upstream.h
+++ b/pimd/pim_upstream.h
@@ -61,7 +61,6 @@
enum pim_upstream_state {
PIM_UPSTREAM_NOTJOINED,
PIM_UPSTREAM_JOINED,
- PIM_UPSTREAM_PRUNE,
};
enum pim_reg_state {