diff --git a/fpmsyncd/routesync.cpp b/fpmsyncd/routesync.cpp index caf6210084..78272e6591 100644 --- a/fpmsyncd/routesync.cpp +++ b/fpmsyncd/routesync.cpp @@ -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 @@ -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) { @@ -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))) { m_routeTable.set(destipprefix, fvVector); SWSS_LOG_DEBUG("RouteTable set msg: %s %s %s %s", destipprefix, @@ -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 diff --git a/fpmsyncd/routesync.h b/fpmsyncd/routesync.h index fd18b9d25a..58a70ad321 100644 --- a/fpmsyncd/routesync.h +++ b/fpmsyncd/routesync.h @@ -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); diff --git a/warmrestart/warmRestartHelper.cpp b/warmrestart/warmRestartHelper.cpp index 580e9f98a6..c6da277a9b 100644 --- a/warmrestart/warmRestartHelper.cpp +++ b/warmrestart/warmRestartHelper.cpp @@ -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 { diff --git a/warmrestart/warmRestartHelper.h b/warmrestart/warmRestartHelper.h index 75af3c4b9d..066d782707 100644 --- a/warmrestart/warmRestartHelper.h +++ b/warmrestart/warmRestartHelper.h @@ -48,6 +48,8 @@ class WarmStartHelper { bool inProgress(void) const; + bool fastRestartInProgress(void) const; + uint32_t getRestartTimer(void) const; bool runRestoration(void);