rib: Don't add inherited routes to RIB entries pending removal
refs: #3404
Change-Id: I33a4ee7aa4e286a562c720656cb9e4ee7753ae05
diff --git a/rib/fib-updater.cpp b/rib/fib-updater.cpp
index 8478fe6..7cd4bed 100644
--- a/rib/fib-updater.cpp
+++ b/rib/fib-updater.cpp
@@ -568,10 +568,10 @@
Rib::RouteSet routesToRemove;
routesToRemove.insert(route);
- // If capture is turned off for the route, need to add ancestors
- // to self and children
+ // If capture is turned off for the route and another route is installed in the RibEntry,
+ // add ancestors to self
Rib::RouteSet routesToAdd;
- if (captureWasTurnedOff) {
+ if (captureWasTurnedOff && entry.getNRoutes() != 0) {
// Look for an ancestors that were blocked previously
routesToAdd = m_rib.getAncestorRoutes(entry);
@@ -595,10 +595,10 @@
modifyChildrensInheritedRoutes(entry.getChildren(), routesToAdd, routesToRemove);
}
else if (route.isCapture()) {
- // If capture is turned off for the route, need to add ancestors
- // to self and children
+ // If capture is turned off for the route and another route is installed in the RibEntry,
+ // add ancestors to self
Rib::RouteSet routesToAdd;
- if (captureWasTurnedOff) {
+ if (captureWasTurnedOff && entry.getNRoutes() != 0) {
// Look for an ancestors that were blocked previously
routesToAdd = m_rib.getAncestorRoutes(entry);