diff --git a/openr/fib/Fib.cpp b/openr/fib/Fib.cpp index a27b3d15b75..dfb2c1abc62 100644 --- a/openr/fib/Fib.cpp +++ b/openr/fib/Fib.cpp @@ -233,6 +233,7 @@ Fib::processRequestMsg(fbzmq::Message&& request) { void Fib::processRouteDb(thrift::RouteDatabase&& newRouteDb) { thrift::RouteDatabase doNotInstallRouteDb; + std::vector installUnicastRoutes; VLOG(2) << "Processing new routes from Decision. " << newRouteDb.unicastRoutes.size() << " unicast routes and " @@ -251,12 +252,14 @@ Fib::processRouteDb(thrift::RouteDatabase&& newRouteDb) { if (rIter->doNotInstall) { doNotInstallRouteDb.unicastRoutes.emplace_back( *std::make_move_iterator(rIter)); - rIter = newRouteDb.unicastRoutes.erase(rIter); } else { - ++rIter; + installUnicastRoutes.emplace_back(*std::make_move_iterator(rIter)); } + ++rIter; } + // Update DB with non dry run routes + newRouteDb.unicastRoutes = installUnicastRoutes; // Find out delta to be programmed auto const routeDelta = findDeltaRoutes(newRouteDb, routeDb_); // update new routeDb_