Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16880] Fix simple test scenarios #3249

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ bool PDPClient::create_ds_pdp_endpoints()

bool PDPClient::create_ds_pdp_reliable_endpoints(
DiscoveryServerPDPEndpoints& endpoints,
bool secure)
bool is_discovery_protected)
{

EPROSIMA_LOG_INFO(RTPS_PDP, "Beginning PDPClient Endpoints creation");
Expand Down Expand Up @@ -352,7 +352,7 @@ bool PDPClient::create_ds_pdp_reliable_endpoints(
ratt.endpoint.reliabilityKind = RELIABLE;
ratt.times.heartbeatResponseDelay = pdp_heartbeat_response_delay;
#if HAVE_SECURITY
if (secure)
if (is_discovery_protected)
{
ratt.endpoint.security_attributes().is_submessage_protected = true;
ratt.endpoint.security_attributes().plugin_endpoint_attributes =
Expand All @@ -364,7 +364,8 @@ bool PDPClient::create_ds_pdp_reliable_endpoints(

RTPSReader* reader = nullptr;
#if HAVE_SECURITY
EntityId_t reader_entity = secure ? c_EntityId_spdp_reliable_participant_secure_reader : c_EntityId_SPDPReader;
EntityId_t reader_entity =
is_discovery_protected ? c_EntityId_spdp_reliable_participant_secure_reader : c_EntityId_SPDPReader;
#else
EntityId_t reader_entity = c_EntityId_SPDPReader;
#endif // if HAVE_SECURITY
Expand Down Expand Up @@ -409,7 +410,7 @@ bool PDPClient::create_ds_pdp_reliable_endpoints(
watt.times.nackSupressionDuration = pdp_nack_supression_duration;

#if HAVE_SECURITY
if (secure)
if (is_discovery_protected)
{
watt.endpoint.security_attributes().is_submessage_protected = true;
watt.endpoint.security_attributes().plugin_endpoint_attributes =
Expand All @@ -424,7 +425,8 @@ bool PDPClient::create_ds_pdp_reliable_endpoints(

RTPSWriter* wout = nullptr;
#if HAVE_SECURITY
EntityId_t writer_entity = secure ? c_EntityId_spdp_reliable_participant_secure_writer : c_EntityId_SPDPWriter;
EntityId_t writer_entity =
is_discovery_protected ? c_EntityId_spdp_reliable_participant_secure_writer : c_EntityId_SPDPWriter;
#else
EntityId_t writer_entity = c_EntityId_SPDPWriter;
#endif // if HAVE_SECURITY
Expand Down Expand Up @@ -453,11 +455,23 @@ bool PDPClient::create_ds_pdp_reliable_endpoints(
mp_RTPSParticipant->createSenderResources(it.metatrafficMulticastLocatorList);
mp_RTPSParticipant->createSenderResources(it.metatrafficUnicastLocatorList);

if (!secure)
#if HAVE_SECURITY
if (!mp_RTPSParticipant->is_secure())
{
match_pdp_writer_nts_(it);
match_pdp_reader_nts_(it);
}
else if (!is_discovery_protected)
{
endpoints.reader.reader_->enableMessagesFromUnkownWriters(true);
}
#else
if (!is_discovery_protected)
{
match_pdp_writer_nts_(it);
match_pdp_reader_nts_(it);
}
#endif // HAVE_SECURITY
}
}

Expand Down Expand Up @@ -495,7 +509,7 @@ void PDPClient::notifyAboveRemoteEndpoints(
const ParticipantProxyData& pdata)
{
#if HAVE_SECURITY
if (should_protect_discovery())
if (mp_RTPSParticipant->is_secure())
{
eprosima::shared_lock<eprosima::shared_mutex> disc_lock(mp_builtin->getDiscoveryMutex());

Expand All @@ -504,6 +518,13 @@ void PDPClient::notifyAboveRemoteEndpoints(
{
if (data_matches_with_prefix(svr.guidPrefix, pdata))
{
if (nullptr == svr.proxy)
{
//! try to retrieve the participant proxy data from an unmangled prefix in case
//! we could not fill svr.proxy in assignRemoteEndpoints()
svr.proxy = get_participant_proxy_data(svr.guidPrefix);
}

match_pdp_reader_nts_(svr, pdata.m_guid.guidPrefix);
match_pdp_writer_nts_(svr, pdata.m_guid.guidPrefix);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/participant/PDPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class PDPClient : public PDP
*/
bool create_ds_pdp_reliable_endpoints(
DiscoveryServerPDPEndpoints& endpoints,
bool secure);
bool is_discovery_protected);

/**
* Performs creation of DS best-effort PDP reader.
Expand Down
3 changes: 2 additions & 1 deletion test/communication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/secure_simple_ds_server_no_discovery_
${CMAKE_CURRENT_BINARY_DIR}/secure_simple_ds_server_no_discovery_no_rtps_protection.xml COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/secure_simple_ds_server_no_discovery_protection.xml
${CMAKE_CURRENT_BINARY_DIR}/secure_simple_ds_server_no_discovery_protection.xml COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/secure_simple_ds_server_no_rtps_protection.xml ${CMAKE_CURRENT_BINARY_DIR}/secure_simple_ds_server_no_rtps_protection.xml COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/secure_simple_ds_server_no_rtps_protection.xml
${CMAKE_CURRENT_BINARY_DIR}/secure_simple_ds_server_no_rtps_protection.xml COPYONLY)

if(SECURITY)
configure_file(${PROJECT_SOURCE_DIR}/test/certs/maincacert.pem
Expand Down