Commit 231dccb0 authored by Daniel Krebs's avatar Daniel Krebs
Browse files

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

parent f11a7a3f
Pipeline #52940 passed with stages
in 1 minute and 29 seconds
...@@ -96,6 +96,11 @@ IpNode::getLoopbackPorts() const ...@@ -96,6 +96,11 @@ IpNode::getLoopbackPorts() const
bool IpNode::connect(const StreamVertex& from, const StreamVertex& to) 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; StreamGraph::Path path;
if(not streamGraph.getPath(from.getIdentifier(), to.getIdentifier(), path)) { if(not streamGraph.getPath(from.getIdentifier(), to.getIdentifier(), path)) {
logger->error("No path from {} to {}", from, to); logger->error("No path from {} to {}", from, to);
...@@ -132,7 +137,7 @@ bool IpNode::connect(const StreamVertex& from, const StreamVertex& to) ...@@ -132,7 +137,7 @@ bool IpNode::connect(const StreamVertex& from, const StreamVertex& to)
nextHopNode = secondHopNode; nextHopNode = secondHopNode;
} }
auto nextHopNodeIp = reinterpret_cast<IpNode*> auto nextHopNodeIp = dynamic_cast<IpNode*>
(card->lookupIp(nextHopNode->nodeName)); (card->lookupIp(nextHopNode->nodeName));
if(nextHopNodeIp == nullptr) { if(nextHopNodeIp == nullptr) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment