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.
This commit is contained in:
anuradhak 2017-03-09 10:47:50 -08:00
parent 0c2ebf00a6
commit b4786acd7e
3 changed files with 5 additions and 26 deletions

View File

@ -358,7 +358,7 @@ pim_register_recv (struct interface *ifp,
upstream->sg.src = sg.src; upstream->sg.src = sg.src;
upstream->rpf.rpf_addr = upstream->rpf.source_nexthop.mrib_nexthop_addr; upstream->rpf.rpf_addr = upstream->rpf.source_nexthop.mrib_nexthop_addr;
upstream->join_state = PIM_UPSTREAM_PRUNE; upstream->join_state = PIM_UPSTREAM_NOTJOINED;
} }

View File

@ -473,26 +473,9 @@ pim_upstream_switch(struct pim_upstream *up,
pim_upstream_state2str (new_state)); pim_upstream_state2str (new_state));
} }
/* up->join_state = new_state;
* This code still needs work. if (old_state != new_state)
*/ up->state_transition = pim_time_monotonic_sec();
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;
}
pim_upstream_update_assert_tracking_desired(up); 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_ka_timer = NULL;
up->t_rs_timer = NULL; up->t_rs_timer = NULL;
up->t_msdp_reg_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->reg_state = PIM_REG_NOINFO;
up->state_transition = pim_time_monotonic_sec(); up->state_transition = pim_time_monotonic_sec();
up->channel_oil = NULL; up->channel_oil = NULL;
@ -1201,9 +1184,6 @@ pim_upstream_state2str (enum pim_upstream_state join_state)
case PIM_UPSTREAM_JOINED: case PIM_UPSTREAM_JOINED:
return "Joined"; return "Joined";
break; break;
case PIM_UPSTREAM_PRUNE:
return "Prune";
break;
} }
return "Unknown"; return "Unknown";
} }

View File

@ -61,7 +61,6 @@
enum pim_upstream_state { enum pim_upstream_state {
PIM_UPSTREAM_NOTJOINED, PIM_UPSTREAM_NOTJOINED,
PIM_UPSTREAM_JOINED, PIM_UPSTREAM_JOINED,
PIM_UPSTREAM_PRUNE,
}; };
enum pim_reg_state { enum pim_reg_state {