Skip to content

Commit

Permalink
pimd: Fix PIM MLAG Update Peer Zebra Status Upon Local MLAG Connectio…
Browse files Browse the repository at this point in the history
…n Restoration

Issue:
In scenarios where the local MLAG connection is down, we currently halt processing
peer MLAG messages. However, upon restoration of the local connection,
 we fail to update the peer Zebra status accordingly.

Consider the case where the peer is up and sends FRR status messages to the local node.
If CLAGd restarts on the local node while FRR is running,
the local CLAGd assumes the peer is still down even when it's up.

Fix:
Update the peer Zebra status once the local MLAG connection is restored

Testing: UT, and TestPimFrrClagSyncTestsNew tests
test_files.evpn.test_evpn_pim.TestPimFrrClagSyncTestsNew.test01_PimFrrClagSyncTest PASSED

Ticket: #3832280
Signed-off-by: Rajesh Varatharaj <[email protected]>
  • Loading branch information
routingrocks committed May 3, 2024
1 parent 53820a5 commit 2e85117
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion pimd/pim_mlag.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,18 @@ static inline void pim_mlag_vxlan_state_update(void)


/********************API to process PIM MLAG Data ************************/
static void pim_mlag_peer_zebra_flag_set(void)
{
if (router->mlag_flags & PIM_MLAGF_PEER_CONN_UP) {
if (!(router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP)) {
if (PIM_DEBUG_MLAG)
zlog_debug(
"%s: update Mlag flag with PIM_MLAGF_PEER_ZEBRA_UP",
__func__);
router->mlag_flags |= PIM_MLAGF_PEER_ZEBRA_UP;
}
}
}

static void pim_mlag_process_mlagd_state_change(struct mlag_status msg)
{
Expand All @@ -575,7 +587,6 @@ static void pim_mlag_process_mlagd_state_change(struct mlag_status msg)
return;
}
++router->mlag_stats.msg.mlag_status_updates;

/* evaluate the changes first */
if (router->mlag_role != msg.my_role) {
role_chg = true;
Expand Down Expand Up @@ -618,6 +629,7 @@ static void pim_mlag_process_mlagd_state_change(struct mlag_status msg)
*/
if (!(router->mlag_flags & PIM_MLAGF_STATUS_RXED)) {
router->mlag_flags |= PIM_MLAGF_STATUS_RXED;
pim_mlag_peer_zebra_flag_set();
pim_mlag_vxlan_state_update();
/* on session up re-eval DF status */
pim_mlag_up_local_reeval(false /*mlagd_send*/, "mlagd_up");
Expand Down Expand Up @@ -668,6 +680,10 @@ static void pim_mlag_process_peer_frr_state_change(struct mlag_frr_status msg)
if (msg.frr_state == MLAG_FRR_STATE_UP) {
if (!(router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP)) {
router->mlag_flags |= PIM_MLAGF_PEER_ZEBRA_UP;
if (PIM_DEBUG_MLAG)
zlog_debug(
"%s:%d: Mlag Peer FRR state is UP Setting PIM_MLAGF_PEER_ZEBRA_UP mlag flag %0x",
__func__, __LINE__, router->mlag_flags);
/* XXX - when peer zebra comes up we need to wait for
* for some time to let the peer setup MDTs before
* before relinquishing DF status
Expand All @@ -679,6 +695,10 @@ static void pim_mlag_process_peer_frr_state_change(struct mlag_frr_status msg)
if (router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP) {
++router->mlag_stats.peer_zebra_downs;
router->mlag_flags &= ~PIM_MLAGF_PEER_ZEBRA_UP;
if (PIM_DEBUG_MLAG)
zlog_debug(
"%s:%d: Mlag Peer FRR state is DOWN unsetting PIM_MLAGF_PEER_ZEBRA_UP mlag flag %0x",
__func__, __LINE__, router->mlag_flags);
/* when a peer zebra goes down we assume DF role */
pim_mlag_up_local_reeval(true /*mlagd_send*/,
"zebra_down");
Expand Down Expand Up @@ -881,9 +901,16 @@ int pim_zebra_mlag_process_up(ZAPI_CALLBACK_ARGS)
*/
router->connected_to_mlag = true;
router->mlag_flags |= PIM_MLAGF_LOCAL_CONN_UP;
/*
* Handle when local mlag session comes up later,
* Update the Peer Zebra status once the local MLAG connection is
* restored based on peer connection status.
*/
pim_mlag_peer_zebra_flag_set();
return 0;
}


static void pim_mlag_param_reset(void)
{
/* reset the cached params and stats */
Expand Down

0 comments on commit 2e85117

Please sign in to comment.