From ade2c61bd4bba0de331509458dad46db98f77f04 Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Fri, 1 Mar 2024 08:07:10 -0600 Subject: [PATCH 1/2] Also update input URIs that target host 0.0.0.0 --- src/network/NetworkManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/NetworkManager.cpp b/src/network/NetworkManager.cpp index 4a7f6b4..3ea2be8 100755 --- a/src/network/NetworkManager.cpp +++ b/src/network/NetworkManager.cpp @@ -292,7 +292,7 @@ NetworkManager::create_receiver(std::vector connections, Connect if (oldUri.port == "*") oldUri.port = newUri.port; - if (oldUri.host == "*") + if (oldUri.host == "*" || oldUri.host == "0.0.0.0") oldUri.host = newUri.host; connections[0].uri = oldUri.to_string(); @@ -343,7 +343,7 @@ NetworkManager::create_sender(ConnectionInfo connection) if (oldUri.port == "*") oldUri.port = newUri.port; - if (oldUri.host == "*") + if (oldUri.host == "*" || oldUri.host == "0.0.0.0") oldUri.host = newUri.host; connection.uri = oldUri.to_string(); From 2017ca66922fa1cfe1dfada52f82ba99d2ea8973 Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Fri, 1 Mar 2024 09:54:19 -0600 Subject: [PATCH 2/2] Add more checks for 0.0.0.0 ips and add TRACE message --- src/network/NetworkManager.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/network/NetworkManager.cpp b/src/network/NetworkManager.cpp index 3ea2be8..17080bd 100755 --- a/src/network/NetworkManager.cpp +++ b/src/network/NetworkManager.cpp @@ -270,7 +270,7 @@ NetworkManager::create_receiver(std::vector connections, Connect std::vector uris; for (auto& conn : connections) { // Check for case where both ends are in app and ConnectivityService hasn't received other end yet - if (conn.uri.find("*") != std::string::npos) { + if (conn.uri.find("*") != std::string::npos || conn.uri.find("0.0.0.0") != std::string::npos) { continue; } uris.push_back(conn.uri); @@ -286,7 +286,8 @@ NetworkManager::create_receiver(std::vector connections, Connect TLOG_DEBUG(12) << "Receiver reports connected to URI " << newCs; // Replace with resolved if there are wildcards (host and/or port) - if (connections[0].uri.find("*") != std::string::npos) { + if (connections[0].uri.find("*") != std::string::npos || connections[0].uri.find("0.0.0.0") != std::string::npos) { + TLOG_DEBUG(14) << "Wildcard found in connection URI " << connections[0].uri << ", adjusting before publish"; auto newUri = utilities::parse_connection_string(newCs); auto oldUri = utilities::parse_connection_string(connections[0].uri); @@ -296,6 +297,7 @@ NetworkManager::create_receiver(std::vector connections, Connect oldUri.host = newUri.host; connections[0].uri = oldUri.to_string(); + TLOG_DEBUG(14) << "Connection URI is now " << connections[0].uri; } if (is_pubsub) { @@ -326,7 +328,7 @@ NetworkManager::create_sender(ConnectionInfo connection) ipm::get_recommended_plugin_name(is_pubsub ? ipm::IpmPluginType::Publisher : ipm::IpmPluginType::Sender); // Check for case where both ends are in app and ConnectivityService hasn't received other end yet - if (!is_pubsub && connection.uri.find("*") != std::string::npos) { + if (!is_pubsub && (connection.uri.find("*") != std::string::npos || connection.uri.find("0.0.0.0") != std::string::npos)) { return nullptr; } @@ -337,7 +339,8 @@ NetworkManager::create_sender(ConnectionInfo connection) TLOG_DEBUG(11) << "Sender Plugin connected, reports URI " << newCs; // Replace with resolved if there are wildcards (host and/or port) - if (connection.uri.find("*") != std::string::npos) { + if (connection.uri.find("*") != std::string::npos || connection.uri.find("0.0.0.0") != std::string::npos) { + TLOG_DEBUG(13) << "Wildcard found in connection URI " << connection.uri << ", adjusting before publish"; auto newUri = utilities::parse_connection_string(newCs); auto oldUri = utilities::parse_connection_string(connection.uri); @@ -347,6 +350,7 @@ NetworkManager::create_sender(ConnectionInfo connection) oldUri.host = newUri.host; connection.uri = oldUri.to_string(); + TLOG_DEBUG(13) << "Connection URI is now " << connection.uri; } if (m_config_client != nullptr && is_pubsub) {