NLSR
NLSR copied to clipboard
About the problems encountered when using nlsrc withdraw <name>
Problem Description:On a simple NFD-connected topology, after a prefix is withdrawn using nlsrc withdraw
`void Fib::update(const ndn::Name& name, const NexthopList& allHops)
{
NLSR_LOG_DEBUG("Fib::update called");
// Get the max possible faces which is the minumum of the configuration setting and // the length of the list of all next hops. unsigned int maxFaces = getNumberOfFacesForName(allHops);
NexthopList hopsToAdd; unsigned int nFaces = 0;
// Create a list of next hops to be installed with length == maxFaces for (NexthopList::iterator it = allHops.cbegin(); it != allHops.cend() && nFaces < maxFaces; ++it, ++nFaces) { hopsToAdd.addNextHop(*it); }
std::map<ndn::Name, FibEntry>::iterator entryIt = m_table.find(name);
// New FIB entry that has nextHops if (entryIt == m_table.end() && hopsToAdd.size() != 0) { NLSR_LOG_DEBUG("New FIB Entry");
FibEntry entry(name);
addNextHopsToFibEntryAndNfd(entry, hopsToAdd);
m_table.emplace(name, entry);
entryIt = m_table.find(name);
} // Existing FIB entry that may or may not have nextHops else { // Existing FIB entry NLSR_LOG_DEBUG("Existing FIB Entry");
// Remove empty FIB entry
if (hopsToAdd.size() == 0) {
remove(name);
return;
}
FibEntry& entry = (entryIt->second);//
//**addNextHopsToFibEntryAndNfd(entry, hopsToAdd);**//Adjust the position of the row
std::set<NextHop, NextHopComparator> hopsToRemove;
std::set_difference(entry.getNexthopList().begin(), entry.getNexthopList().end(),
hopsToAdd.begin(), hopsToAdd.end(),
std::inserter(hopsToRemove, hopsToRemove.end()), NextHopComparator());
bool isUpdatable = isPrefixUpdatable(entry.getName());
// Remove the uninstalled next hops from NFD and FIB entry
for (const auto& hop: hopsToRemove){
if (isUpdatable) {
unregisterPrefix(entry.getName(), hop.getConnectingFaceUri());
}
NLSR_LOG_DEBUG("Removing " << hop.getConnectingFaceUri() << " from " << entry.getName());
entry.getNexthopList().removeNextHop(hop);
}
addNextHopsToFibEntryAndNfd(entry, hopsToAdd); // Adjust here
// Increment sequence number
entry.setSeqNo(entry.getSeqNo() + 1);
entryIt = m_table.find(name);
} if (entryIt != m_table.end() && !entryIt->second.getRefreshEventId()) { scheduleEntryRefresh(entryIt->second, [this] (FibEntry& entry) { scheduleLoop(entry); }); } }
Does this happen with the latest commit from github? I had fixed a similar bug earlier which is not part of any release yet I think: https://redmine.named-data.net/issues/5179 https://github.com/named-data/NLSR/commit/6f0f35d96d6c28fea8a066de47c03b647a841f85 https://github.com/named-data/NLSR/blob/master/tests/route/test-fib.cpp#L361
Can you please write a unit test against the latest commit from github documenting the problem?