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

Fix asymmetric whitelist matching [19035] #3733

Merged
merged 15 commits into from
Sep 21, 2023
Merged

Conversation

juanlofer-eprosima
Copy link
Contributor

@juanlofer-eprosima juanlofer-eprosima commented Jul 20, 2023

Description

Matching two local participants through UDP/TCP transport currently fails when only one of them sets an interface whitelist. In particular, the problematic cases are only including the loopback interface (A), or including all except the loopback interface (B).

The reason for this is that Fast DDS internally performs an optimization consisting in transforming a local locator to localhost (NetworkFactory::transform_remote_locators) whenever possible. This way, communication is performed through the loopback interface, which is allegedly more robust to changes in the environment.
However, the only input for determining whether this transformation should be performed is each transport's own interface whitelist. This implies that in some cases the transformation will be wrongly performed as the remote transport may not be listening on localhost (B).
Another issue with this transformation method is that it boths attempts conversion to localhost as well as filters locators based on one's interface whitelist. This explains why A arises, as the received remote (local) locator gets filtered out for being different than localhost.

This PR attempts to fix the issue by sending in discovery a new network configuration parameter, which for the moment only includes whether a participant is listening on localhost (depending on its whitelist). Four (plus 28 unused) different bits encoding this information are sent, each for a different transport kind (UDPv4, UDPv6, TCPv4 and TCPv6).
An extended NetworkFactory::transform_remote_locators is added leveraging this information, so conversion to localhost is only performed when both remote and local participants allow for it.

Behaviour changes:

  • Transformation to localhost is no longer attempted in Initial Peers and Discovery Server. This is because the remote's participant network configuration is only shared through discovery, and hence in these two cases it is not available.

@Mergifyio backport 2.11.x 2.10.x 2.6.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • Any new/modified methods have been properly documented using Doxygen.
  • Changes are ABI compatible.
  • Changes are API compatible.
  • N/A New feature has been added to the versions.md file (if applicable).
  • N/A New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@juanlofer-eprosima
Copy link
Contributor Author

Compatibility report: compat_report.zip

@EduPonz EduPonz added this to the v2.12.0 milestone Aug 7, 2023
@EduPonz EduPonz force-pushed the bugfix/asymmetric-whitelist branch 2 times, most recently from 0d081a6 to 2e7b31d Compare August 10, 2023 19:48
@EduPonz
Copy link

EduPonz commented Aug 10, 2023

@richiprosima please test this

@EduPonz
Copy link

EduPonz commented Aug 10, 2023

@Mergifyio backport 2.11.x 2.10.x 2.6.x

@mergify
Copy link
Contributor

mergify bot commented Aug 10, 2023

backport 2.11.x 2.10.x 2.6.x

✅ Backports have been created

EduPonz
EduPonz previously approved these changes Aug 10, 2023
@EduPonz
Copy link

EduPonz commented Aug 11, 2023

@richiprosima please test mac

2 similar comments
@EduPonz
Copy link

EduPonz commented Aug 11, 2023

@richiprosima please test mac

@EduPonz
Copy link

EduPonz commented Aug 11, 2023

@richiprosima please test mac

@JesusPoderoso JesusPoderoso added the ci-pending PR which CI is running label Aug 17, 2023
@rsanchez15
Copy link
Contributor

@Mergifyio backport eprosima/integration

@mergify
Copy link
Contributor

mergify bot commented Aug 22, 2023

backport eprosima/integration

✅ Backports have been created

MiguelCompany
MiguelCompany previously approved these changes Aug 29, 2023
@MiguelCompany
Copy link
Member

@richiprosima Please test mac

@JesusPoderoso
Copy link
Contributor

@richiprosima please test mac

@EduPonz EduPonz added to-do and removed ci-pending PR which CI is running labels Sep 6, 2023
JesusPoderoso and others added 9 commits September 19, 2023 16:19
Signed-off-by: Juan López Fernández <[email protected]>
Signed-off-by: Juan Lopez Fernandez <[email protected]>
…peers and discovery server

Signed-off-by: Juan Lopez Fernandez <[email protected]>
Signed-off-by: Juan Lopez Fernandez <[email protected]>
Signed-off-by: Juan Lopez Fernandez <[email protected]>
@juanlofer-eprosima
Copy link
Contributor Author

@richiprosima please test this

@juanlofer-eprosima
Copy link
Contributor Author

@richiprosima please test this

@juanlofer-eprosima
Copy link
Contributor Author

@richiprosima please test this

1 similar comment
@juanlofer-eprosima
Copy link
Contributor Author

@richiprosima please test this

@EduPonz EduPonz added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Sep 21, 2023
@EduPonz EduPonz merged commit c8ab860 into master Sep 21, 2023
11 of 14 checks passed
@EduPonz EduPonz deleted the bugfix/asymmetric-whitelist branch September 21, 2023 10:02
mergify bot pushed a commit that referenced this pull request Sep 21, 2023
* Refs #18854: Asymmetric whitelist regression test

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #18854: Fix Windows build error

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #18854: Apply rev suggestions

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #19203: Add more test cases

Signed-off-by: Juan López Fernández <[email protected]>

* Refs #19203: Asymmetric whitelist matching fix: transform_remote_locators refactor

Signed-off-by: Juan López Fernández <[email protected]>

* Refs #19203: Tiny fixes

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Add warnings for non-localhost local address in initial peers and discovery server

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Bonus fix: TCPv6 + whitelist

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Avoid API/ABI break

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Fix TCP when no whitelist and initial peer != localhost

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Improve some comments

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Uncrustify

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Fix missing include

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Revert locator scope append in TCPChannelResourceBasic::connect

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Disable (almost) all IPv6 tests

Signed-off-by: Juan Lopez Fernandez <[email protected]>

---------

Signed-off-by: JesusPoderoso <[email protected]>
Signed-off-by: Juan López Fernández <[email protected]>
Signed-off-by: Juan Lopez Fernandez <[email protected]>
Signed-off-by: Eduardo Ponz <[email protected]>
Co-authored-by: JesusPoderoso <[email protected]>
Co-authored-by: Eduardo Ponz <[email protected]>
(cherry picked from commit c8ab860)
mergify bot pushed a commit that referenced this pull request Sep 21, 2023
* Refs #18854: Asymmetric whitelist regression test

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #18854: Fix Windows build error

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #18854: Apply rev suggestions

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #19203: Add more test cases

Signed-off-by: Juan López Fernández <[email protected]>

* Refs #19203: Asymmetric whitelist matching fix: transform_remote_locators refactor

Signed-off-by: Juan López Fernández <[email protected]>

* Refs #19203: Tiny fixes

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Add warnings for non-localhost local address in initial peers and discovery server

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Bonus fix: TCPv6 + whitelist

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Avoid API/ABI break

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Fix TCP when no whitelist and initial peer != localhost

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Improve some comments

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Uncrustify

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Fix missing include

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Revert locator scope append in TCPChannelResourceBasic::connect

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Disable (almost) all IPv6 tests

Signed-off-by: Juan Lopez Fernandez <[email protected]>

---------

Signed-off-by: JesusPoderoso <[email protected]>
Signed-off-by: Juan López Fernández <[email protected]>
Signed-off-by: Juan Lopez Fernandez <[email protected]>
Signed-off-by: Eduardo Ponz <[email protected]>
Co-authored-by: JesusPoderoso <[email protected]>
Co-authored-by: Eduardo Ponz <[email protected]>
(cherry picked from commit c8ab860)
mergify bot pushed a commit that referenced this pull request Sep 21, 2023
* Refs #18854: Asymmetric whitelist regression test

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #18854: Fix Windows build error

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #18854: Apply rev suggestions

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #19203: Add more test cases

Signed-off-by: Juan López Fernández <[email protected]>

* Refs #19203: Asymmetric whitelist matching fix: transform_remote_locators refactor

Signed-off-by: Juan López Fernández <[email protected]>

* Refs #19203: Tiny fixes

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Add warnings for non-localhost local address in initial peers and discovery server

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Bonus fix: TCPv6 + whitelist

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Avoid API/ABI break

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Fix TCP when no whitelist and initial peer != localhost

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Improve some comments

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Uncrustify

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Fix missing include

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Revert locator scope append in TCPChannelResourceBasic::connect

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Disable (almost) all IPv6 tests

Signed-off-by: Juan Lopez Fernandez <[email protected]>

---------

Signed-off-by: JesusPoderoso <[email protected]>
Signed-off-by: Juan López Fernández <[email protected]>
Signed-off-by: Juan Lopez Fernandez <[email protected]>
Signed-off-by: Eduardo Ponz <[email protected]>
Co-authored-by: JesusPoderoso <[email protected]>
Co-authored-by: Eduardo Ponz <[email protected]>
(cherry picked from commit c8ab860)

# Conflicts:
#	include/fastdds/rtps/attributes/RTPSParticipantAttributes.h
#	include/fastdds/rtps/transport/TransportInterface.h
#	src/cpp/rtps/transport/TCPTransportInterface.cpp
#	test/mock/rtps/NetworkFactory/fastdds/rtps/network/NetworkFactory.h
mergify bot pushed a commit that referenced this pull request Sep 21, 2023
* Refs #18854: Asymmetric whitelist regression test

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #18854: Fix Windows build error

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #18854: Apply rev suggestions

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #19203: Add more test cases

Signed-off-by: Juan López Fernández <[email protected]>

* Refs #19203: Asymmetric whitelist matching fix: transform_remote_locators refactor

Signed-off-by: Juan López Fernández <[email protected]>

* Refs #19203: Tiny fixes

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Add warnings for non-localhost local address in initial peers and discovery server

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Bonus fix: TCPv6 + whitelist

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Avoid API/ABI break

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Fix TCP when no whitelist and initial peer != localhost

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Improve some comments

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Uncrustify

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Fix missing include

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19203: Revert locator scope append in TCPChannelResourceBasic::connect

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Refs #19203: Disable (almost) all IPv6 tests

Signed-off-by: Juan Lopez Fernandez <[email protected]>

---------

Signed-off-by: JesusPoderoso <[email protected]>
Signed-off-by: Juan López Fernández <[email protected]>
Signed-off-by: Juan Lopez Fernandez <[email protected]>
Signed-off-by: Eduardo Ponz <[email protected]>
Co-authored-by: JesusPoderoso <[email protected]>
Co-authored-by: Eduardo Ponz <[email protected]>
(cherry picked from commit c8ab860)

# Conflicts:
#	include/fastdds/rtps/transport/TransportInterface.h
#	test/mock/rtps/NetworkFactory/fastdds/rtps/network/NetworkFactory.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants