diff --git a/lib/nodes/ethercat.cpp b/lib/nodes/ethercat.cpp index f56182453..c219855c4 100644 --- a/lib/nodes/ethercat.cpp +++ b/lib/nodes/ethercat.cpp @@ -102,6 +102,9 @@ int villas::node::ethercat_type_start(villas::node::SuperNode *sn) int ret; json_error_t err; + if (sn == nullptr) + throw RuntimeError("EtherCAT node-type requires super-node"); + json_t *json = sn->getConfig(); if (json) { ret = json_unpack_ex(json, &err, 0, "{ s?: i, s?:i, s?: { s?: { s?: i, s?: i, s?: i } } }", diff --git a/lib/nodes/ngsi.cpp b/lib/nodes/ngsi.cpp index 842fc062f..c40185f44 100644 --- a/lib/nodes/ngsi.cpp +++ b/lib/nodes/ngsi.cpp @@ -577,7 +577,8 @@ int villas::node::ngsi_type_start(villas::node::SuperNode *sn) CRYPTO_set_id_callback(curl_ssl_thread_id_function); CRYPTO_set_locking_callback(curl_ssl_locking_function); - sn->getLogger()->info("Setup libcurl/openssl locking primitives"); + auto logger = logging.get("curl"); + logger->info("Setup libcurl/openssl locking primitives"); #endif /* CURL_SSL_REQUIRES_LOCKING */ return curl_global_init(CURL_GLOBAL_ALL); diff --git a/lib/nodes/rtp.cpp b/lib/nodes/rtp.cpp index daef6015f..6718c28f7 100644 --- a/lib/nodes/rtp.cpp +++ b/lib/nodes/rtp.cpp @@ -467,16 +467,18 @@ int villas::node::rtp_type_start(villas::node::SuperNode *sn) return ret; #ifdef WITH_NETEM - /* Gather list of used network interfaces */ - for (auto *n : ncp.instances) { - auto *nc = dynamic_cast(n); - auto *r = nc->getData(); - Interface *j = Interface::getEgress(&r->out.saddr_rtp.u.sa, sn); + if (sn != nullptr) { + // Gather list of used network interfaces + for (auto *n : ncp.instances) { + auto *nc = dynamic_cast(n); + auto *r = nc->getData(); + Interface *j = Interface::getEgress(&r->out.saddr_rtp.u.sa, sn); - if (!j) - throw RuntimeError("Failed to find egress interface"); + if (!j) + throw RuntimeError("Failed to find egress interface"); - j->addNode(n); + j->addNode(n); + } } #endif /* WITH_NETEM */ diff --git a/lib/nodes/socket.cpp b/lib/nodes/socket.cpp index dc3d661ee..ab09dd00f 100644 --- a/lib/nodes/socket.cpp +++ b/lib/nodes/socket.cpp @@ -40,18 +40,20 @@ static NodeCompatFactory ncp(&p); int villas::node::socket_type_start(villas::node::SuperNode *sn) { #ifdef WITH_NETEM - /* Gather list of used network interfaces */ - for (auto *n : ncp.instances) { - auto *nc = dynamic_cast(n); - auto *s = nc->getData(); + if (sn != nullptr) { + // Gather list of used network interfaces + for (auto *n : ncp.instances) { + auto *nc = dynamic_cast(n); + auto *s = nc->getData(); - if (s->layer == SocketLayer::UNIX) - continue; + if (s->layer == SocketLayer::UNIX) + continue; - /* Determine outgoing interface */ - Interface *j = Interface::getEgress((struct sockaddr *) &s->out.saddr, sn); + /* Determine outgoing interface */ + Interface *j = Interface::getEgress((struct sockaddr *) &s->out.saddr, sn); - j->addNode(n); + j->addNode(n); + } } #endif /* WITH_NETEM */ diff --git a/lib/nodes/stats.cpp b/lib/nodes/stats.cpp index 2078639ce..c130dfdd1 100644 --- a/lib/nodes/stats.cpp +++ b/lib/nodes/stats.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -71,6 +72,9 @@ invalid_format: int villas::node::stats_node_type_start(villas::node::SuperNode *sn) { + if (sn == nullptr) + throw RuntimeError("Stats node-type requires super-node"); + nodes = sn->getNodes(); return 0; diff --git a/lib/nodes/websocket.cpp b/lib/nodes/websocket.cpp index 82f858d78..c4db02617 100644 --- a/lib/nodes/websocket.cpp +++ b/lib/nodes/websocket.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -333,6 +334,9 @@ int villas::node::websocket_protocol_cb(struct lws *wsi, enum lws_callback_reaso int villas::node::websocket_type_start(villas::node::SuperNode *sn) { + if (sn == nullptr) + throw RuntimeError("WebSocket node-type requires super-node"); + web = sn->getWeb(); if (!web->isEnabled()) return -1;