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

[17873] DomainParticipant::ignore_participant implementation #3412

Merged
merged 13 commits into from
Apr 3, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Refs #17873: Reevaluate source ignored status after the reception of …
…an INFO_SRC message

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
  • Loading branch information
jsan-rt committed Mar 29, 2023
commit 9a6634a5ff0bbff10aa1e23aa9dee9e3aa95b1e4
225 changes: 121 additions & 104 deletions src/cpp/rtps/messages/MessageReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
*/

#include <fastdds/rtps/common/Guid.h>
#include <fastdds/rtps/messages/MessageReceiver.h>

#include <cassert>
Expand Down Expand Up @@ -334,6 +335,8 @@ void MessageReceiver::processCDRMsg(
int decode_ret = 0;
#endif // if HAVE_SECURITY && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)

bool ignore_submessages;
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved

{
std::lock_guard<eprosima::shared_mutex> guard(mtx_);

Expand All @@ -349,13 +352,12 @@ void MessageReceiver::processCDRMsg(
return;
}

if (participant_->is_participant_ignored(source_guid_prefix_))
ignore_submessages = participant_->is_participant_ignored(source_guid_prefix_);
if (!ignore_submessages)
{
return;
notify_network_statistics(source_locator, reception_locator, msg);
}

notify_network_statistics(source_locator, reception_locator, msg);

#if HAVE_SECURITY && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
decode_ret = security.decode_rtps_message(*msg, *auxiliary_buffer, source_guid_prefix_);

Expand All @@ -380,6 +382,8 @@ void MessageReceiver::processCDRMsg(
bool valid;
SubmessageHeader_t submsgh; //Current submessage header

bool ignore_current_submessage;

while (msg->pos < msg->length)// end of the message
{
CDRMessage_t* submessage = msg;
Expand Down Expand Up @@ -407,124 +411,137 @@ void MessageReceiver::processCDRMsg(
valid = true;
uint32_t next_msg_pos = submessage->pos;
next_msg_pos += (submsgh.submessageLength + 3u) & ~3u;
switch (submsgh.submessageId)

// We ignore submessage if the source participant is to be ignored, unless the submessage king is INFO_SRC
// which triggers a reevaluation of the flag.
ignore_current_submessage = ignore_submessages &&
submsgh.submessageId != INFO_SRC;

if (!ignore_current_submessage)
{
case DATA:
{
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Data Submsg ignored, DST is another RTPSParticipant");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Data Submsg received, processing.");
valid = proc_Submsg_Data(submessage, &submsgh);
}
break;
}
case DATA_FRAG:
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "DataFrag Submsg ignored, DST is another RTPSParticipant");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "DataFrag Submsg received, processing.");
valid = proc_Submsg_DataFrag(submessage, &submsgh);
}
break;
case GAP:
{
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Gap Submsg ignored, DST is another RTPSParticipant...");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Gap Submsg received, processing...");
valid = proc_Submsg_Gap(submessage, &submsgh);
}
break;
}
case ACKNACK:

switch (submsgh.submessageId)
{
if (dest_guid_prefix_ != participantGuidPrefix)
case DATA:
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN,
IDSTRING "Acknack Submsg ignored, DST is another RTPSParticipant...");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Acknack Submsg received, processing...");
valid = proc_Submsg_Acknack(submessage, &submsgh);
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Data Submsg ignored, DST is another RTPSParticipant");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Data Submsg received, processing.");
valid = proc_Submsg_Data(submessage, &submsgh);
}
break;
}
break;
}
case NACK_FRAG:
{
if (dest_guid_prefix_ != participantGuidPrefix)
case DATA_FRAG:
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN,
IDSTRING "DataFrag Submsg ignored, DST is another RTPSParticipant");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "DataFrag Submsg received, processing.");
valid = proc_Submsg_DataFrag(submessage, &submsgh);
}
break;
case GAP:
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN,
IDSTRING "NackFrag Submsg ignored, DST is another RTPSParticipant...");
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN,
IDSTRING "Gap Submsg ignored, DST is another RTPSParticipant...");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Gap Submsg received, processing...");
valid = proc_Submsg_Gap(submessage, &submsgh);
}
break;
}
else
case ACKNACK:
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "NackFrag Submsg received, processing...");
valid = proc_Submsg_NackFrag(submessage, &submsgh);
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN,
IDSTRING "Acknack Submsg ignored, DST is another RTPSParticipant...");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Acknack Submsg received, processing...");
valid = proc_Submsg_Acknack(submessage, &submsgh);
}
break;
}
break;
}
case HEARTBEAT:
{
if (dest_guid_prefix_ != participantGuidPrefix)
case NACK_FRAG:
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "HB Submsg ignored, DST is another RTPSParticipant...");
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN,
IDSTRING "NackFrag Submsg ignored, DST is another RTPSParticipant...");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "NackFrag Submsg received, processing...");
valid = proc_Submsg_NackFrag(submessage, &submsgh);
}
break;
}
else
case HEARTBEAT:
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Heartbeat Submsg received, processing...");
valid = proc_Submsg_Heartbeat(submessage, &submsgh);
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "HB Submsg ignored, DST is another RTPSParticipant...");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "Heartbeat Submsg received, processing...");
valid = proc_Submsg_Heartbeat(submessage, &submsgh);
}
break;
}
break;
}
case HEARTBEAT_FRAG:
{
if (dest_guid_prefix_ != participantGuidPrefix)
case HEARTBEAT_FRAG:
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "HBFrag Submsg ignored, DST is another RTPSParticipant...");
if (dest_guid_prefix_ != participantGuidPrefix)
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN,
IDSTRING "HBFrag Submsg ignored, DST is another RTPSParticipant...");
}
else
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "HeartbeatFrag Submsg received, processing...");
valid = proc_Submsg_HeartbeatFrag(submessage, &submsgh);
}
break;
}
else
case PAD:
EPROSIMA_LOG_WARNING(RTPS_MSG_IN, IDSTRING "PAD messages not yet implemented, ignoring");
break;
case INFO_DST:
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "InfoDST message received, processing...");
valid = proc_Submsg_InfoDST(submessage, &submsgh);
break;
case INFO_SRC:
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "InfoSRC message received, processing...");
valid = proc_Submsg_InfoSRC(submessage, &submsgh);
ignore_submessages = participant_->is_participant_ignored(source_guid_prefix_);
break;
case INFO_TS:
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "HeartbeatFrag Submsg received, processing...");
valid = proc_Submsg_HeartbeatFrag(submessage, &submsgh);
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "InfoTS Submsg received, processing...");
valid = proc_Submsg_InfoTS(submessage, &submsgh);
break;
}
break;
}
case PAD:
EPROSIMA_LOG_WARNING(RTPS_MSG_IN, IDSTRING "PAD messages not yet implemented, ignoring");
break;
case INFO_DST:
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "InfoDST message received, processing...");
valid = proc_Submsg_InfoDST(submessage, &submsgh);
break;
case INFO_SRC:
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "InfoSRC message received, processing...");
valid = proc_Submsg_InfoSRC(submessage, &submsgh);
break;
case INFO_TS:
{
EPROSIMA_LOG_INFO(RTPS_MSG_IN, IDSTRING "InfoTS Submsg received, processing...");
valid = proc_Submsg_InfoTS(submessage, &submsgh);
break;
case INFO_REPLY:
break;
case INFO_REPLY_IP4:
break;
default:
break;
}
case INFO_REPLY:
break;
case INFO_REPLY_IP4:
break;
default:
break;
}

if (!valid || submsgh.is_last)
{
break;
Expand Down