1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

ip-node: fix wrong cast and add more sanity checks

This commit is contained in:
Daniel Krebs 2018-06-04 17:29:11 +02:00
parent 47bd186f5e
commit b03b94d754

View file

@ -96,6 +96,11 @@ IpNode::getLoopbackPorts() const
bool IpNode::connect(const StreamVertex& from, const StreamVertex& to)
{
if(from.nodeName != getInstanceName()) {
logger->error("Cannot connect from a foreign StreamVertex: {}", from);
return false;
}
StreamGraph::Path path;
if(not streamGraph.getPath(from.getIdentifier(), to.getIdentifier(), path)) {
logger->error("No path from {} to {}", from, to);
@ -132,7 +137,7 @@ bool IpNode::connect(const StreamVertex& from, const StreamVertex& to)
nextHopNode = secondHopNode;
}
auto nextHopNodeIp = reinterpret_cast<IpNode*>
auto nextHopNodeIp = dynamic_cast<IpNode*>
(card->lookupIp(nextHopNode->nodeName));
if(nextHopNodeIp == nullptr) {