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

[22056] Transform locators using new host_id PID (backport #107) #108

Merged
merged 2 commits into from
Dec 20, 2024
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
6 changes: 6 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ list(APPEND TEST_LIST

test_60_disconnection
test_61_superclient_environment_variable

test_94_tcpv4_custom_guid_transform_locators
test_95_tcpv4_cli
test_96_tcpv6_cli
test_97_tcpv4_env_var
test_98_tcpv6_env_var
test_99_tcp
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<!-- When a DS with a custom GUID (-i param of CLI) listens on any (0.0.0.0) and the clients use
localhost (127.0.0.1) to connect to the server, the GUID comparison is insufficient to
correctly transform the server's locator when it is received by the client. If a local interface
is received, a new entry to the channel_resources_ map will be created to redirect all TCP
traffic in the same machine through the same channel.
This test is a regression from #22006.-->

<clients>
<client name="client1" profile_name="TCPv4_client_1">
<subscriber topic="topic1"/>
</client>
<client name="client2" profile_name="TCPv4_client_2">
<publisher topic="topic1"/>
</client>
</clients>

<snapshots file="./test_94_tcpv4_custom_guid_transform_locators.snapshot">
<snapshot time="5">Knows all</snapshot>
</snapshots>

<profiles>

<transport_descriptors>
<transport_descriptor>
<transport_id>transport_client_1</transport_id>
<type>TCPv4</type>
<listening_ports>
<port>0</port>
</listening_ports>
</transport_descriptor>
<transport_descriptor>
<transport_id>transport_client_2</transport_id>
<type>TCPv4</type>
<listening_ports>
<port>0</port>
</listening_ports>
</transport_descriptor>
</transport_descriptors>

<participant profile_name="TCPv4_client_1" is_default_profile="true">
<rtps>
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
<useBuiltinTransports>false</useBuiltinTransports>
<userTransports>
<transport_id>transport_client_1</transport_id>
</userTransports>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<RemoteServer prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41">
<metatrafficUnicastLocatorList>
<locator>
<tcpv4>
<address>127.0.0.1</address>
<physical_port>42200</physical_port>
<port>42200</port>
</tcpv4>
</locator>
</metatrafficUnicastLocatorList>
</RemoteServer>
</discoveryServersList>
</discovery_config>
</builtin>
</rtps>
</participant>

<participant profile_name="TCPv4_client_2" is_default_profile="true">
<rtps>
<prefix>63.6c.69.65.6e.74.32.5f.73.31.5f.5f</prefix>
<useBuiltinTransports>false</useBuiltinTransports>
<userTransports>
<transport_id>transport_client_2</transport_id>
</userTransports>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<RemoteServer prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41">
<metatrafficUnicastLocatorList>
<locator>
<tcpv4>
<address>127.0.0.1</address>
<physical_port>42200</physical_port>
<port>42200</port>
</tcpv4>
</locator>
</metatrafficUnicastLocatorList>
</RemoteServer>
</discoveryServersList>
</discovery_config>
</builtin>
</rtps>
</participant>

<topic profile_name="topic1">
<name>topic_1</name>
<dataType>HelloWorld</dataType>
</topic>

</profiles>

</DS>
4 changes: 2 additions & 2 deletions test/configuration/test_cases/test_95_tcpv4_cli.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<clients>
<client name="client1" profile_name="TCPv4_client_1" listening_port="0">
<client name="client1" profile_name="TCPv4_client_1">
<subscriber topic="topic1"/>
</client>
<client name="client2" profile_name="TCPv4_client_2" listening_port="0">
<client name="client2" profile_name="TCPv4_client_2">
<publisher topic="topic1"/>
</client>
</clients>
Expand Down
10 changes: 8 additions & 2 deletions test/configuration/test_cases/test_96_tcpv6_cli.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<clients>
<client name="client1" profile_name="TCPv6_client_1" listening_port="0">
<client name="client1" profile_name="TCPv6_client_1">
<subscriber topic="topic1"/>
</client>
<client name="client2" profile_name="TCPv6_client_2" listening_port="0">
<client name="client2" profile_name="TCPv6_client_2">
<publisher topic="topic1"/>
</client>
</clients>
Expand All @@ -23,13 +23,19 @@
<listening_ports>
<port>0</port>
</listening_ports>
<interfaceWhiteList>
<address>::1</address>
</interfaceWhiteList>
</transport_descriptor>
<transport_descriptor>
<transport_id>transport_client_2</transport_id>
<type>TCPv6</type>
<listening_ports>
<port>0</port>
</listening_ports>
<interfaceWhiteList>
<address>::1</address>
</interfaceWhiteList>
</transport_descriptor>
</transport_descriptors>

Expand Down
4 changes: 2 additions & 2 deletions test/configuration/test_cases/test_97_tcpv4_env_var.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
</servers>

<simples>
<simple name="client1" profile_name="TCPv4_client_1" listening_port="0">
<simple name="client1" profile_name="TCPv4_client_1">
<subscriber topic="topic1"/>
</simple>
<simple name="client2" profile_name="TCPv4_client_2" listening_port="0">
<simple name="client2" profile_name="TCPv4_client_2">
<publisher topic="topic1"/>
</simple>
</simples>
Expand Down
13 changes: 11 additions & 2 deletions test/configuration/test_cases/test_98_tcpv6_env_var.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
</servers>

<simples>
<simple name="client1" profile_name="TCPv6_client_1" listening_port="0">
<simple name="client1" profile_name="TCPv6_client_1">
<subscriber topic="topic1"/>
</simple>
<simple name="client2" profile_name="TCPv6_client_2" listening_port="0">
<simple name="client2" profile_name="TCPv6_client_2">
<publisher topic="topic1"/>
</simple>
</simples>
Expand All @@ -27,20 +27,29 @@
<listening_ports>
<port>42100</port>
</listening_ports>
<interfaceWhiteList>
<address>::1</address>
</interfaceWhiteList>
</transport_descriptor>
<transport_descriptor>
<transport_id>transport_client_1</transport_id>
<type>TCPv6</type>
<listening_ports>
<port>0</port>
</listening_ports>
<interfaceWhiteList>
<address>::1</address>
</interfaceWhiteList>
</transport_descriptor>
<transport_descriptor>
<transport_id>transport_client_2</transport_id>
<type>TCPv6</type>
<listening_ports>
<port>0</port>
</listening_ports>
<interfaceWhiteList>
<address>::1</address>
</interfaceWhiteList>
</transport_descriptor>
</transport_descriptors>

Expand Down
40 changes: 10 additions & 30 deletions test/configuration/test_cases/test_99_tcp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@

<clients>
<client name="client1" profile_name="TCP_client_1" listening_port="27812">
<subscriber /> <!-- defaults to helloworld type -->
<subscriber topic="HelloWorldTopic"/>
<subscriber topic="topic_1" />
<subscriber topic="topic_2" />
<publisher topic="topic_2" />
</client>
<client name="client2" profile_name="TCP_client_2" listening_port="27813">
<publisher /> <!-- defaults to helloworld type -->
<publisher topic="HelloWorldTopic"/>
<publisher topic="topic_1" />
<publisher topic="topic_1" />
<subscriber topic="topic_2" />
</client>
</clients>

<snapshots file="./test_27_tcp.snapshot~">
<snapshot time="10">test_27_tcp_snapshot_1</snapshot>
<snapshots file="./test_99_tcp.snapshot~">
<snapshot time="10">test_99_tcp_snapshot_1</snapshot>
</snapshots>

<profiles>
Expand All @@ -44,8 +44,6 @@
<listening_ports>
<port>27811</port>
</listening_ports>
<calculate_crc>false</calculate_crc>
<check_crc>false</check_crc>
</transport_descriptor>
</transport_descriptors>

Expand Down Expand Up @@ -129,31 +127,13 @@

<topic profile_name="topic_2">
<name>topic_2</name>
<dataType>sample_type_2</dataType>
<dataType>HelloWorld</dataType>
</topic>
</profiles>

<types>
<type>
<struct name="HelloWorld">
<member name="index" type="uint32" />
<member name="message" type="string" />
</struct>
</type>

<type>
<union name="sample_type_2">
<discriminator type="byte" />
<case>
<caseDiscriminator value="0" />
<member name="index" type="uint32" />
</case>
<case>
<caseDiscriminator value="1" />
<member name="message" type="string" />
</case>
</union>
</type>
</types>
<topic profile_name="HelloWorldTopic">
<name>HelloWorldTopic</name>
<dataType>HelloWorld</dataType>
</topic>
</profiles>

</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<DS_Snapshots xmlns="http://www.eprosima.com/XMLSchemas/ds-snapshot">
<DS_Snapshot timestamp="1701424362042" process_time="5000" last_pdp_callback_time="620" last_edp_callback_time="1067" someone="true">
<description>Knows all</description>
<ptdb guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
<ptdi guid_prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41" guid_entity="0.0.1.c1" server="false" alive="true" name="eProsima Default Server number 0" discovered_timestamp="339"/>
<ptdi guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="" discovered_timestamp="125">
<subscriber type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.4" discovered_timestamp="125"/>
</ptdi>
<ptdi guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="client2" discovered_timestamp="620">
<publisher type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.3" discovered_timestamp="1067"/>
</ptdi>
</ptdb>
<ptdb guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
<ptdi guid_prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41" guid_entity="0.0.1.c1" server="false" alive="true" name="eProsima Default Server number 0" discovered_timestamp="489"/>
<ptdi guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="client1" discovered_timestamp="615">
<subscriber type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.4" discovered_timestamp="1067"/>
</ptdi>
<ptdi guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="" discovered_timestamp="233">
<publisher type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.3" discovered_timestamp="233"/>
</ptdi>
</ptdb>
</DS_Snapshot>
</DS_Snapshots>
Loading