Skip to content

Commit

Permalink
Fix Ipv6 names
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Mar 1, 2024
1 parent 2c883e7 commit 74d1ea0
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/cpp/rtps/transport/TCPv6Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,29 @@ TCPv6Transport::TCPv6Transport(
: TCPTransportInterface(LOCATOR_KIND_TCPv6)
, configuration_(descriptor)
{
for (const auto& interface : descriptor.interfaceWhiteList)
if (!descriptor.interfaceWhiteList.empty())
{
interface_whitelist_.emplace_back(ip::address_v6::from_string(interface));
const auto white_begin = descriptor.interfaceWhiteList.begin();
const auto white_end = descriptor.interfaceWhiteList.end();

std::vector<IPFinder::info_IP> local_interfaces;
get_ipv6s(local_interfaces, true);
for (const IPFinder::info_IP& infoIP : local_interfaces)
{
if (std::find_if(white_begin, white_end, [this, infoIP](const std::string& white_list_element)
{
return compare_ips(white_list_element, infoIP.name);
}) != white_end )
{
interface_whitelist_.emplace_back(ip::address_v6::from_string(infoIP.name));
}
}

if (interface_whitelist_.empty())
{
EPROSIMA_LOG_ERROR(TRANSPORT, "All whitelist interfaces were filtered out");
interface_whitelist_.emplace_back(ip::address_v6::from_string("2001:db8::"));
}
}

for (uint16_t& port : configuration_.listening_ports)
Expand Down

0 comments on commit 74d1ea0

Please sign in to comment.