rib: do the longest-prefix match in self-learning route renew helper

Change-Id: I7f6f349fda6925dc3847716fed123d745f11b02a
refs: #4683
diff --git a/rib/rib.cpp b/rib/rib.cpp
index d209f63..bbd72f1 100644
--- a/rib/rib.cpp
+++ b/rib/rib.cpp
@@ -80,6 +80,20 @@
   return nullptr;
 }
 
+Route*
+Rib::findLongestPrefix(const Name& prefix, const Route& route) const
+{
+  Route* existingRoute = find(prefix, route);
+  if (existingRoute == nullptr) {
+    auto parent = findParent(prefix);
+    if (parent) {
+      existingRoute = find(parent->getName(), route);
+    }
+  }
+
+  return existingRoute;
+}
+
 void
 Rib::insert(const Name& prefix, const Route& route)
 {