From b03b94d754fa8ddfc88d701977bd8c53dba9b4d1 Mon Sep 17 00:00:00 2001 From: Daniel Krebs Date: Mon, 4 Jun 2018 17:29:11 +0200 Subject: [PATCH] ip-node: fix wrong cast and add more sanity checks --- fpga/lib/ip_node.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fpga/lib/ip_node.cpp b/fpga/lib/ip_node.cpp index be5af573c..9435e24a3 100644 --- a/fpga/lib/ip_node.cpp +++ b/fpga/lib/ip_node.cpp @@ -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 + auto nextHopNodeIp = dynamic_cast (card->lookupIp(nextHopNode->nodeName)); if(nextHopNodeIp == nullptr) {