From 8de8df2d1584089c27ac8678ac598c9262721b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Wed, 12 May 2021 17:22:26 +0200 Subject: [PATCH 1/2] Consider all network interfaces when checking HOST option. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- include/ignition/transport/Discovery.hh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/ignition/transport/Discovery.hh b/include/ignition/transport/Discovery.hh index accb789ee..f3f4c6174 100644 --- a/include/ignition/transport/Discovery.hh +++ b/include/ignition/transport/Discovery.hh @@ -898,6 +898,10 @@ namespace ignition this->SendUnicast(msg); } + bool isSenderLocal = (std::find(this->hostInterfaces.begin(), + this->hostInterfaces.end(), _fromIp) != this->hostInterfaces.end()) || + _fromIp == "127.0.0.1"; + // Update timestamp and cache the callbacks. DiscoveryCallback connectCb; DiscoveryCallback disconnectCb; @@ -923,7 +927,7 @@ namespace ignition // Check scope of the topic. if ((publisher.Options().Scope() == Scope_t::PROCESS) || (publisher.Options().Scope() == Scope_t::HOST && - _fromIp != this->hostAddr)) + !isSenderLocal)) { return; } @@ -976,7 +980,7 @@ namespace ignition // Check scope of the topic. if ((nodeInfo.Options().Scope() == Scope_t::PROCESS) || (nodeInfo.Options().Scope() == Scope_t::HOST && - _fromIp != this->hostAddr)) + !isSenderLocal)) { continue; } @@ -1048,7 +1052,7 @@ namespace ignition // Check scope of the topic. if ((publisher.Options().Scope() == Scope_t::PROCESS) || (publisher.Options().Scope() == Scope_t::HOST && - _fromIp != this->hostAddr)) + !isSenderLocal)) { return; } From fc1c7da5ce0cd0b4342ceb145ca51a78dea91f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Fri, 14 May 2021 18:12:18 +0200 Subject: [PATCH 2/2] Update localhost address. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- include/ignition/transport/Discovery.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ignition/transport/Discovery.hh b/include/ignition/transport/Discovery.hh index f3f4c6174..b673e2ad7 100644 --- a/include/ignition/transport/Discovery.hh +++ b/include/ignition/transport/Discovery.hh @@ -900,7 +900,7 @@ namespace ignition bool isSenderLocal = (std::find(this->hostInterfaces.begin(), this->hostInterfaces.end(), _fromIp) != this->hostInterfaces.end()) || - _fromIp == "127.0.0.1"; + (_fromIp.find("127.") == 0); // Update timestamp and cache the callbacks. DiscoveryCallback connectCb;