rib: Insert RIB command prefixes into RIB

refs: #2312

Change-Id: I9452f60d4c2162ad265603d3d5d44f083452ec58
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 44214a3..ae64820 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -106,7 +106,7 @@
     ControlParameters()
       .setName(commandPrefix)
       .setFaceId(0),
-    bind(&RibManager::onNrdCommandPrefixAddNextHopSuccess, this, cref(commandPrefix)),
+    bind(&RibManager::onNrdCommandPrefixAddNextHopSuccess, this, cref(commandPrefix), _1),
     bind(&RibManager::onNrdCommandPrefixAddNextHopError, this, cref(commandPrefix), _2));
 
   m_face.setInterestFilter(commandPrefix, onRequest);
@@ -529,9 +529,22 @@
 }
 
 void
-RibManager::onNrdCommandPrefixAddNextHopSuccess(const Name& prefix)
+RibManager::onNrdCommandPrefixAddNextHopSuccess(const Name& prefix,
+                                                const ndn::nfd::ControlParameters& result)
 {
   NFD_LOG_DEBUG("Successfully registered " + prefix.toUri() + " with NFD");
+
+  // Routes must be inserted into the RIB so route flags can be applied
+  Route route;
+  route.faceId = result.getFaceId();
+  route.origin = ndn::nfd::ROUTE_ORIGIN_APP;
+  route.expires = time::steady_clock::TimePoint::max();
+  route.flags = ndn::nfd::ROUTE_FLAG_CHILD_INHERIT;
+
+  m_managedRib.insert(prefix, route);
+
+  m_registeredFaces.insert(route.faceId);
+  m_managedRib.clearFibUpdates();
 }
 
 void