Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip reconcilation waiting for default routes in fast-reboot #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion fpmsyncd/routesync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ using namespace swss;
#define VRF_PREFIX "Vrf"
#define MGMT_VRF_PREFIX "mgmt"

#define IPV4_DEFAULT_ROUTE "0.0.0.0/0"
#define IPV6_DEFAULT_ROUTE "::/0"

#define NHG_DELIMITER ','

#ifndef ETH_ALEN
Expand Down Expand Up @@ -697,6 +700,7 @@ void RouteSync::onRouteMsg(int nlmsg_type, struct nl_object *obj, char *vrf)
* or we could opt to defer it if we are going through a warm-reboot cycle.
*/
bool warmRestartInProgress = m_warmStartHelper.inProgress();
bool fastRestartInProgress = m_warmStartHelper.fastRestartInProgress();

if (nlmsg_type == RTM_DELROUTE)
{
Expand Down Expand Up @@ -829,7 +833,7 @@ void RouteSync::onRouteMsg(int nlmsg_type, struct nl_object *obj, char *vrf)
fvVector.push_back(wt);
}

if (!warmRestartInProgress)
if (!warmRestartInProgress || (fastRestartInProgress && isDefaultRoute(destipprefix)))
Copy link

@nazariig nazariig Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arfeigin what happens to non default routes? Will they even be installed?

Copy link
Owner Author

@arfeigin arfeigin Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non default routes will be handled with existing logic (as prior to this change), by the else statement on line number 847 they will be stored in a helper map and then set to route-table after timer will expire/End-of-Rib arrives.

{
m_routeTable.set(destipprefix, fvVector);
SWSS_LOG_DEBUG("RouteTable set msg: %s %s %s %s", destipprefix,
Expand All @@ -852,6 +856,15 @@ void RouteSync::onRouteMsg(int nlmsg_type, struct nl_object *obj, char *vrf)
}
}

/*
* Check if given string route is IPV4/IPV6 default route
* @arg route route
*/
bool RouteSync::isDefaultRoute(char *route)
{
return (!strcmp (route, IPV4_DEFAULT_ROUTE)) || (!strcmp (route, IPV6_DEFAULT_ROUTE));
}

/*
* Handle label route
* @arg nlmsg_type Netlink message type
Expand Down
2 changes: 2 additions & 0 deletions fpmsyncd/routesync.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class RouteSync : public NetMsg
/* Handle regular route (include VRF route) */
void onRouteMsg(int nlmsg_type, struct nl_object *obj, char *vrf);

bool isDefaultRoute(char *route);

/* Handle label route */
void onLabelRouteMsg(int nlmsg_type, struct nl_object *obj);

Expand Down
4 changes: 4 additions & 0 deletions warmrestart/warmRestartHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ bool WarmStartHelper::inProgress(void) const
return (m_enabled && m_state != WarmStart::RECONCILED);
}

bool WarmStartHelper::fastRestartInProgress(void) const
{
return WarmStart::checkFastReboot();
}

uint32_t WarmStartHelper::getRestartTimer(void) const
{
Expand Down
2 changes: 2 additions & 0 deletions warmrestart/warmRestartHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class WarmStartHelper {

bool inProgress(void) const;

bool fastRestartInProgress(void) const;

uint32_t getRestartTimer(void) const;

bool runRestoration(void);
Expand Down