route: handle zero cost links
refs: #4978
Change-Id: I461bdac9e10cb8362a7624b177ee68aa20d3ff3e
diff --git a/src/lsa.cpp b/src/lsa.cpp
index bee69db..5930e99 100644
--- a/src/lsa.cpp
+++ b/src/lsa.cpp
@@ -248,11 +248,16 @@
ndn::Name adjName(*tok_iter++);
std::string connectingFaceUri(*tok_iter++);
double linkCost = boost::lexical_cast<double>(*tok_iter++);
+
Adjacent adjacent(adjName, ndn::FaceUri(connectingFaceUri), linkCost,
Adjacent::STATUS_INACTIVE, 0, 0);
addAdjacent(adjacent);
}
}
+ // Ignore neighbors with negative cost received from the Adjacent LSA data.
+ catch (const ndn::tlv::Error& e) {
+ NLSR_LOG_ERROR(e.what());
+ }
catch (const std::exception& e) {
NLSR_LOG_ERROR("Could not deserialize from content: " << e.what());
return false;