mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 02:46:26 +00:00
pimd: add new/distinct enumeration for pim register state
With the separation of register-state and upstream-join-state we no longer need an enumeration that covers both states. This commit includes the following - 1. Defined new enumeration for reg state (this 1:1 with RFC4601). 2. Dropped JOIN_PENDING enum value from upstream join state. RFC4601 only define two values NOT_JOINED and JOINED for this state. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-14700 Testing Done: Verified register setup manually and ran pim-smoke
This commit is contained in:
parent
e0e127b009
commit
0c2ebf00a6
@ -1692,7 +1692,7 @@ static void pim_show_upstream(struct vty *vty, u_char uj)
|
|||||||
pim_time_timer_to_hhmmss (msdp_reg_timer, sizeof (msdp_reg_timer), up->t_msdp_reg_timer);
|
pim_time_timer_to_hhmmss (msdp_reg_timer, sizeof (msdp_reg_timer), up->t_msdp_reg_timer);
|
||||||
|
|
||||||
if (pim_if_connected_to_source (up->rpf.source_nexthop.interface, up->sg.src))
|
if (pim_if_connected_to_source (up->rpf.source_nexthop.interface, up->sg.src))
|
||||||
strcpy (state_str, pim_upstream_state2str (up->reg_state));
|
pim_reg_state2str (up->reg_state, state_str);
|
||||||
else
|
else
|
||||||
strcpy (state_str, pim_upstream_state2str (up->join_state));
|
strcpy (state_str, pim_upstream_state2str (up->join_state));
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
|
|||||||
up->channel_oil->cc.pktcnt++;
|
up->channel_oil->cc.pktcnt++;
|
||||||
PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
|
PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
|
||||||
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
||||||
up->reg_state = PIM_UPSTREAM_JOINED;
|
up->reg_state = PIM_REG_JOIN;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -453,7 +453,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf)
|
|||||||
up->channel_oil = oil;
|
up->channel_oil = oil;
|
||||||
up->channel_oil->cc.pktcnt++;
|
up->channel_oil->cc.pktcnt++;
|
||||||
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
||||||
up->reg_state = PIM_UPSTREAM_JOINED;
|
up->reg_state = PIM_REG_JOIN;
|
||||||
pim_upstream_inherited_olist (up);
|
pim_upstream_inherited_olist (up);
|
||||||
|
|
||||||
// Send the packet to the RP
|
// Send the packet to the RP
|
||||||
|
@ -124,17 +124,17 @@ pim_register_stop_recv (uint8_t *buf, int buf_size)
|
|||||||
|
|
||||||
switch (upstream->reg_state)
|
switch (upstream->reg_state)
|
||||||
{
|
{
|
||||||
case PIM_UPSTREAM_NOTJOINED:
|
case PIM_REG_NOINFO:
|
||||||
case PIM_UPSTREAM_PRUNE:
|
case PIM_REG_PRUNE:
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case PIM_UPSTREAM_JOINED:
|
case PIM_REG_JOIN:
|
||||||
upstream->reg_state = PIM_UPSTREAM_PRUNE;
|
upstream->reg_state = PIM_REG_PRUNE;
|
||||||
pim_channel_del_oif (upstream->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
pim_channel_del_oif (upstream->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
||||||
pim_upstream_start_register_stop_timer (upstream, 0);
|
pim_upstream_start_register_stop_timer (upstream, 0);
|
||||||
break;
|
break;
|
||||||
case PIM_UPSTREAM_JOIN_PENDING:
|
case PIM_REG_JOIN_PENDING:
|
||||||
upstream->reg_state = PIM_UPSTREAM_PRUNE;
|
upstream->reg_state = PIM_REG_PRUNE;
|
||||||
pim_upstream_start_register_stop_timer (upstream, 0);
|
pim_upstream_start_register_stop_timer (upstream, 0);
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
@ -485,8 +485,6 @@ pim_upstream_switch(struct pim_upstream *up,
|
|||||||
up->state_transition = pim_time_monotonic_sec ();
|
up->state_transition = pim_time_monotonic_sec ();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PIM_UPSTREAM_JOIN_PENDING:
|
|
||||||
break;
|
|
||||||
case PIM_UPSTREAM_NOTJOINED:
|
case PIM_UPSTREAM_NOTJOINED:
|
||||||
case PIM_UPSTREAM_JOINED:
|
case PIM_UPSTREAM_JOINED:
|
||||||
up->join_state = new_state;
|
up->join_state = new_state;
|
||||||
@ -509,7 +507,7 @@ pim_upstream_switch(struct pim_upstream *up,
|
|||||||
PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
|
PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
|
||||||
if (!old_fhr && PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags))
|
if (!old_fhr && PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags))
|
||||||
{
|
{
|
||||||
up->reg_state = PIM_UPSTREAM_JOINED;
|
up->reg_state = PIM_REG_JOIN;
|
||||||
pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time);
|
pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time);
|
||||||
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
||||||
}
|
}
|
||||||
@ -603,7 +601,7 @@ pim_upstream_new (struct prefix_sg *sg,
|
|||||||
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 = 0;
|
||||||
up->reg_state = 0;
|
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;
|
||||||
up->sptbit = PIM_UPSTREAM_SPTBIT_FALSE;
|
up->sptbit = PIM_UPSTREAM_SPTBIT_FALSE;
|
||||||
@ -959,8 +957,8 @@ static void pim_upstream_fhr_kat_expiry(struct pim_upstream *up)
|
|||||||
THREAD_OFF(up->t_rs_timer);
|
THREAD_OFF(up->t_rs_timer);
|
||||||
/* remove regiface from the OIL if it is there*/
|
/* remove regiface from the OIL if it is there*/
|
||||||
pim_channel_del_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
pim_channel_del_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
||||||
/* move to "not-joined" */
|
/* clear the register state */
|
||||||
up->reg_state = PIM_UPSTREAM_NOTJOINED;
|
up->reg_state = PIM_REG_NOINFO;
|
||||||
PIM_UPSTREAM_FLAG_UNSET_FHR(up->flags);
|
PIM_UPSTREAM_FLAG_UNSET_FHR(up->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,9 +972,9 @@ static void pim_upstream_fhr_kat_start(struct pim_upstream *up)
|
|||||||
zlog_debug ("kat started on %s; set fhr reg state to joined", up->sg_str);
|
zlog_debug ("kat started on %s; set fhr reg state to joined", up->sg_str);
|
||||||
|
|
||||||
PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
|
PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
|
||||||
if (up->reg_state == PIM_UPSTREAM_NOTJOINED) {
|
if (up->reg_state == PIM_REG_NOINFO) {
|
||||||
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
||||||
up->reg_state = PIM_UPSTREAM_JOINED;
|
up->reg_state = PIM_REG_JOIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1203,9 +1201,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_JOIN_PENDING:
|
|
||||||
return "JoinPending";
|
|
||||||
break;
|
|
||||||
case PIM_UPSTREAM_PRUNE:
|
case PIM_UPSTREAM_PRUNE:
|
||||||
return "Prune";
|
return "Prune";
|
||||||
break;
|
break;
|
||||||
@ -1214,24 +1209,24 @@ pim_upstream_state2str (enum pim_upstream_state join_state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
pim_reg_state2str (enum pim_upstream_state join_state, char *state_str)
|
pim_reg_state2str (enum pim_reg_state reg_state, char *state_str)
|
||||||
{
|
{
|
||||||
switch (join_state)
|
switch (reg_state)
|
||||||
{
|
{
|
||||||
case PIM_UPSTREAM_NOTJOINED:
|
case PIM_REG_NOINFO:
|
||||||
strcpy (state_str, "NoInfo");
|
strcpy (state_str, "RegNoInfo");
|
||||||
break;
|
break;
|
||||||
case PIM_UPSTREAM_JOINED:
|
case PIM_REG_JOIN:
|
||||||
strcpy (state_str, "Joined");
|
strcpy (state_str, "RegJoined");
|
||||||
break;
|
break;
|
||||||
case PIM_UPSTREAM_JOIN_PENDING:
|
case PIM_REG_JOIN_PENDING:
|
||||||
strcpy (state_str, "JoinPending");
|
strcpy (state_str, "RegJoinPend");
|
||||||
break;
|
break;
|
||||||
case PIM_UPSTREAM_PRUNE:
|
case PIM_REG_PRUNE:
|
||||||
strcpy (state_str, "Prune");
|
strcpy (state_str, "RegPrune");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy (state_str, "Unknown");
|
strcpy (state_str, "RegUnknown");
|
||||||
}
|
}
|
||||||
return state_str;
|
return state_str;
|
||||||
}
|
}
|
||||||
@ -1249,20 +1244,21 @@ pim_upstream_register_stop_timer (struct thread *t)
|
|||||||
|
|
||||||
if (PIM_DEBUG_TRACE)
|
if (PIM_DEBUG_TRACE)
|
||||||
{
|
{
|
||||||
|
char state_str[PIM_REG_STATE_STR_LEN];
|
||||||
zlog_debug ("%s: (S,G)=%s upstream register stop timer %s",
|
zlog_debug ("%s: (S,G)=%s upstream register stop timer %s",
|
||||||
__PRETTY_FUNCTION__, up->sg_str,
|
__PRETTY_FUNCTION__, up->sg_str,
|
||||||
pim_upstream_state2str(up->reg_state));
|
pim_reg_state2str(up->reg_state, state_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (up->reg_state)
|
switch (up->reg_state)
|
||||||
{
|
{
|
||||||
case PIM_UPSTREAM_JOIN_PENDING:
|
case PIM_REG_JOIN_PENDING:
|
||||||
up->reg_state = PIM_UPSTREAM_JOINED;
|
up->reg_state = PIM_REG_JOIN;
|
||||||
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
|
||||||
break;
|
break;
|
||||||
case PIM_UPSTREAM_JOINED:
|
case PIM_REG_JOIN:
|
||||||
break;
|
break;
|
||||||
case PIM_UPSTREAM_PRUNE:
|
case PIM_REG_PRUNE:
|
||||||
pim_ifp = up->rpf.source_nexthop.interface->info;
|
pim_ifp = up->rpf.source_nexthop.interface->info;
|
||||||
if (!pim_ifp)
|
if (!pim_ifp)
|
||||||
{
|
{
|
||||||
@ -1271,7 +1267,7 @@ pim_upstream_register_stop_timer (struct thread *t)
|
|||||||
__PRETTY_FUNCTION__, up->rpf.source_nexthop.interface->name);
|
__PRETTY_FUNCTION__, up->rpf.source_nexthop.interface->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
up->reg_state = PIM_UPSTREAM_JOIN_PENDING;
|
up->reg_state = PIM_REG_JOIN_PENDING;
|
||||||
pim_upstream_start_register_stop_timer (up, 1);
|
pim_upstream_start_register_stop_timer (up, 1);
|
||||||
|
|
||||||
if (((up->channel_oil->cc.lastused/100) > PIM_KEEPALIVE_PERIOD) &&
|
if (((up->channel_oil->cc.lastused/100) > PIM_KEEPALIVE_PERIOD) &&
|
||||||
|
@ -61,10 +61,16 @@
|
|||||||
enum pim_upstream_state {
|
enum pim_upstream_state {
|
||||||
PIM_UPSTREAM_NOTJOINED,
|
PIM_UPSTREAM_NOTJOINED,
|
||||||
PIM_UPSTREAM_JOINED,
|
PIM_UPSTREAM_JOINED,
|
||||||
PIM_UPSTREAM_JOIN_PENDING,
|
|
||||||
PIM_UPSTREAM_PRUNE,
|
PIM_UPSTREAM_PRUNE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum pim_reg_state {
|
||||||
|
PIM_REG_NOINFO,
|
||||||
|
PIM_REG_JOIN,
|
||||||
|
PIM_REG_JOIN_PENDING,
|
||||||
|
PIM_REG_PRUNE,
|
||||||
|
};
|
||||||
|
|
||||||
enum pim_upstream_sptbit {
|
enum pim_upstream_sptbit {
|
||||||
PIM_UPSTREAM_SPTBIT_FALSE,
|
PIM_UPSTREAM_SPTBIT_FALSE,
|
||||||
PIM_UPSTREAM_SPTBIT_TRUE
|
PIM_UPSTREAM_SPTBIT_TRUE
|
||||||
@ -88,7 +94,7 @@ struct pim_upstream {
|
|||||||
struct list *sources;
|
struct list *sources;
|
||||||
|
|
||||||
enum pim_upstream_state join_state;
|
enum pim_upstream_state join_state;
|
||||||
enum pim_upstream_state reg_state;
|
enum pim_reg_state reg_state;
|
||||||
enum pim_upstream_sptbit sptbit;
|
enum pim_upstream_sptbit sptbit;
|
||||||
|
|
||||||
int ref_count;
|
int ref_count;
|
||||||
@ -165,7 +171,7 @@ void pim_upstream_switch (struct pim_upstream *up, enum pim_upstream_state new_s
|
|||||||
|
|
||||||
const char *pim_upstream_state2str (enum pim_upstream_state join_state);
|
const char *pim_upstream_state2str (enum pim_upstream_state join_state);
|
||||||
#define PIM_REG_STATE_STR_LEN 12
|
#define PIM_REG_STATE_STR_LEN 12
|
||||||
const char *pim_reg_state2str (enum pim_upstream_state state, char *state_str);
|
const char *pim_reg_state2str (enum pim_reg_state state, char *state_str);
|
||||||
|
|
||||||
int pim_upstream_inherited_olist_decide (struct pim_upstream *up);
|
int pim_upstream_inherited_olist_decide (struct pim_upstream *up);
|
||||||
int pim_upstream_inherited_olist (struct pim_upstream *up);
|
int pim_upstream_inherited_olist (struct pim_upstream *up);
|
||||||
|
Loading…
Reference in New Issue
Block a user