Skip to content

Commit

Permalink
Ignore 0x8007 if coming from other vendor (#4291) (#4309)
Browse files Browse the repository at this point in the history
* Ignore 0x8007 if coming from other vendor (#4291)

* Refs #20306: Add regression test

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20306: Ignore PID_NETWORK_CONFIGURATION_SET if coming from other vendor

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20306: Apply Miguel's suggestions

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20306: Fix windows warning

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 5a3acb4)

* Fix compilation

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
  • Loading branch information
mergify[bot] and EduPonz committed Feb 27, 2024
1 parent a704436 commit a00eb67
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/cpp/rtps/builtin/data/ParticipantProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,17 @@ bool ParticipantProxyData::readFromCDRMessage(
}
case fastdds::dds::PID_NETWORK_CONFIGURATION_SET:
{
// This is a custom PID defined by eProsima, so if the DATA(p)'s
// vendor ID is not ours we need just ignore it.
// TODO(eduponz): This is a workaround for the moment, as it is implicitly assuming
// that the vendor ID parameter came before this one. In the future, we should propagate
// the vendor ID from the RTPS message header using the CacheChange and check it here.
FASTDDS_TODO_BEFORE(2, 14, "Add vendor ID to CacheChange");
if (c_VendorId_eProsima != m_VendorId)
{
return true;
}

ParameterNetworkConfigSet_t p(pid, plength);
if (!fastdds::dds::ParameterSerializer<ParameterNetworkConfigSet_t>::read_from_cdr_message(p,
msg, plength))
Expand Down
38 changes: 38 additions & 0 deletions test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,44 @@ TEST(BuiltinDataSerializationTests, property_list_with_binary_properties)
EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false)));
}

// Regression test for redmine ticket 20306
TEST(BuiltinDataSerializationTests, other_vendor_parameter_list_with_custom_pids)
{
octet data_p_buffer[] =
{
// Encapsulation
0x00, 0x03, 0x00, 0x00,

// PID_PROTOCOL_VERSION
0x15, 0, 4, 0,
2, 1, 0, 0,

// PID_VENDORID
0x16, 0, 4, 0,
2, 0, 0, 0,

// PID_PARTICIPANT_GUID
0x50, 0, 16, 0,
2, 0, 54, 83, 136, 247, 149, 252, 47, 105, 174, 141, 0, 0, 1, 193,

// PID_NETWORK_CONFIGURATION_SET
0x07, 0x80, 8, 0,
1, 2, 3, 4, 5, 6, 7, 8,

// PID_SENTINEL
0x01, 0, 0, 0
};

CDRMessage_t msg(0);
msg.init(data_p_buffer, static_cast<uint32_t>(sizeof(data_p_buffer)));
msg.length = msg.max_size;

ParticipantProxyData out(RTPSParticipantAllocationAttributes{});
out.m_networkConfiguration = 0;
EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false)));
ASSERT_EQ(out.m_networkConfiguration, 0u);
}

/*!
* \test RTPS-CFT-CFP-01 Tests serialization of `ContentFilterProperty_t` works successfully without parameters.
*/
Expand Down

0 comments on commit a00eb67

Please sign in to comment.