From 80dc3bda5ab3224c0f9f023da0074d690997be05 Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Tue, 2 Jul 2024 17:00:53 -0500 Subject: [PATCH] Allow RtpsRelay Clients With Multiple IP Addresses --- docs/news.d/relay-multi-ip.rst | 5 +++++ tools/rtpsrelay/GuidAddrSet.cpp | 4 ++-- tools/rtpsrelay/GuidAddrSet.h | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 docs/news.d/relay-multi-ip.rst diff --git a/docs/news.d/relay-multi-ip.rst b/docs/news.d/relay-multi-ip.rst new file mode 100644 index 00000000000..4d4757db2c9 --- /dev/null +++ b/docs/news.d/relay-multi-ip.rst @@ -0,0 +1,5 @@ +.. news-prs: 4718 + +.. news-start-section: Fixes +- RtpsRelay: Recognize clients that are using different IP addresses for SPDP and SEDP. +.. news-end-section diff --git a/tools/rtpsrelay/GuidAddrSet.cpp b/tools/rtpsrelay/GuidAddrSet.cpp index 578bb953b36..6b30750bffc 100644 --- a/tools/rtpsrelay/GuidAddrSet.cpp +++ b/tools/rtpsrelay/GuidAddrSet.cpp @@ -208,7 +208,7 @@ bool GuidAddrSet::ignore_rtps(bool from_application_participant, pos->second.allow_rtps = true; if (config_.log_activity()) { - ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) INFO: GuidAddrSet::record_activity ") + ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) INFO: GuidAddrSet::ignore_rtps ") ACE_TEXT("%C was admitted %C into session\n"), guid_to_string(guid).c_str(), pos->second.get_session_time(now).sec_str().c_str())); @@ -246,7 +246,7 @@ bool GuidAddrSet::ignore_rtps(bool from_application_participant, admitted = true; if (config_.log_activity()) { - ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) INFO: GuidAddrSet::record_activity ") + ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) INFO: GuidAddrSet::ignore_rtps ") ACE_TEXT("%C was admitted %C into session\n"), guid_to_string(guid).c_str(), pos->second.get_session_time(now).sec_str().c_str())); diff --git a/tools/rtpsrelay/GuidAddrSet.h b/tools/rtpsrelay/GuidAddrSet.h index 1761979482a..94d67ab0873 100644 --- a/tools/rtpsrelay/GuidAddrSet.h +++ b/tools/rtpsrelay/GuidAddrSet.h @@ -163,8 +163,12 @@ struct AddrSetStats { bool has_discovery_addrs() const { + bool spdp = false; + bool sedp = false; for (const auto& ip : ip_to_ports) { - if (!ip.second.spdp_ports.empty() && !ip.second.sedp_ports.empty()) { + spdp = spdp || !ip.second.spdp_ports.empty(); + sedp = sedp || !ip.second.sedp_ports.empty(); + if (spdp && sedp) { return true; } }