rib: do the longest-prefix match in self-learning route renew helper
Change-Id: I7f6f349fda6925dc3847716fed123d745f11b02a
refs: #4683
diff --git a/tests/rib/rib.t.cpp b/tests/rib/rib.t.cpp
index 420a82d..3b9840c 100644
--- a/tests/rib/rib.t.cpp
+++ b/tests/rib/rib.t.cpp
@@ -216,6 +216,12 @@
BOOST_CHECK(rib.find(name2, route2) == nullptr);
BOOST_CHECK(rib.find(name1, route1) != nullptr);
+ Name name5("/hello/world/666");
+ Name name6("/hello/world/cs/ua/edu");
+ BOOST_CHECK(rib.findLongestPrefix(name1, route1) != nullptr);
+ BOOST_CHECK(rib.findLongestPrefix(name5, route1) != nullptr);
+ BOOST_CHECK(rib.findLongestPrefix(name6, route1) != nullptr);
+
rib.erase(name1, route1);
BOOST_CHECK_EQUAL(rib.size(), 1);
}
diff --git a/tests/rib/sl-announce.t.cpp b/tests/rib/sl-announce.t.cpp
index c7808d3..86b6025 100644
--- a/tests/rib/sl-announce.t.cpp
+++ b/tests/rib/sl-announce.t.cpp
@@ -248,7 +248,7 @@
BOOST_CHECK_EQUAL(slAnnounceSync(pa, 4506, 2_h), SlAnnounceResult::OK);
advanceClocks(1_h); // Route has 1_h remaining lifetime
- BOOST_CHECK_EQUAL(slRenewSync("/P2IYFqtr", 4506, 2_h), SlAnnounceResult::OK);
+ BOOST_CHECK_EQUAL(slRenewSync("/P2IYFqtr/2321", 4506, 2_h), SlAnnounceResult::OK);
Route* route = findAnnRoute("/P2IYFqtr", 4506);
BOOST_REQUIRE(route != nullptr);
@@ -262,7 +262,7 @@
BOOST_CHECK_EQUAL(slAnnounceSync(pa, 1589, 2_h), SlAnnounceResult::OK);
advanceClocks(1_h); // Route has 1_h remaining lifetime
- BOOST_CHECK_EQUAL(slRenewSync("/be01Yiba", 1589, 5_h), SlAnnounceResult::OK);
+ BOOST_CHECK_EQUAL(slRenewSync("/be01Yiba/4324", 1589, 5_h), SlAnnounceResult::OK);
Route* route = findAnnRoute("/be01Yiba", 1589);
BOOST_REQUIRE(route != nullptr);
@@ -276,7 +276,7 @@
BOOST_CHECK_EQUAL(slAnnounceSync(pa, 3851, 4_h), SlAnnounceResult::OK);
advanceClocks(1_h); // Route has 3_h remaining lifetime
- BOOST_CHECK_EQUAL(slRenewSync("/5XCHYCAd", 3851, 1_h), SlAnnounceResult::OK);
+ BOOST_CHECK_EQUAL(slRenewSync("/5XCHYCAd/98934", 3851, 1_h), SlAnnounceResult::OK);
Route* route = findAnnRoute("/5XCHYCAd", 3851);
BOOST_REQUIRE(route != nullptr);
@@ -290,7 +290,7 @@
BOOST_CHECK_EQUAL(slAnnounceSync(pa, 8031, 4_h), SlAnnounceResult::OK);
advanceClocks(1_h); // Route has 3_h remaining lifetime
- BOOST_CHECK_EQUAL(slRenewSync("/cdQ7KPNw", 8031, 0_s), SlAnnounceResult::EXPIRED);
+ BOOST_CHECK_EQUAL(slRenewSync("/cdQ7KPNw/8023", 8031, 0_s), SlAnnounceResult::EXPIRED);
BOOST_CHECK(findAnnRoute("/cdQ7KPNw", 8031) == nullptr);
}