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

RTPS Domain hostid part of the GUID match first interface IP [4970] #458

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

guillaumeautran
Copy link
Contributor

@guillaumeautran guillaumeautran commented Mar 20, 2019

Because of the code here, the RTPS Domain GUID can potentially be not unique between multiple participant hosted on different computer. This happens because the host ID component is initialized with eProsima magic number (0x010f) and the last two digit of the IPv4 address of the first interface enumerated by getifaddrs.

On some systems where there are several network interfaces, this scheme is not sufficient for generating a mostly unique hostId to be used for the RTPS Domain and collision can happen in the case where the first interface enumerated is an interface used by the system in isolation with the actual network. In addition, the appId (the process ID running the stack) is only unique within the computer itself and does not provide enough uniqueness especially when the process is started as part of a systemd job on boot.

This fix generates a MD5 sum of all IPv4 addresses for all interfaces, then "folds" that 16 bytes MD5 sum into a 16 bits value to be used as the lower two bytes of the hostId field. Doing it this way provides more guarantee that the field will be unique across multiple identical systems.
issue: #456

@richiware
Copy link
Member

Build status:

  • Linux Build Status
  • Mac Build Status
  • Windows Build Status

@richiware richiware changed the title RTPS Domain hostid part of the GUID match first interface IP RTPS Domain hostid part of the GUID match first interface IP [4970] Mar 21, 2019
@MiguelCompany MiguelCompany mentioned this pull request Mar 29, 2019
31 tasks
@richiware
Copy link
Member

Build status:

  • Linux Build Status
  • Mac Build Status
  • Windows Build Status

@richiware
Copy link
Member

Build status:

  • Linux Build Status
  • Mac Build Status
  • Windows Build Status

Because of the code [here](https://github.com/eProsima/Fast-RTPS/blob/f6ebf154a97089136c4906de11f535969708f2a0/src/cpp/rtps/RTPSDomain.cpp#L113), the RTPS Domain GUID can potentially be not unique between multiple participant hosted on different computer. This happens because the host ID component is initialized with eProsima magic number (0x010f) and the last two digit of the IPv4 address of the first interface enumerated by `getifaddrs`.

On some systems where there are several network interfaces, this scheme is not sufficient for generating a mostly unique hostid to be used for the RTPS Domain and collision can happen in the case where the first interface enumerated is an interface used by the system in isolation with the actual network. In addition, the `appId (the process ID running the stack) is only unique within the computer itself and does not provide enough uniqueness especially when the process is started as part of a systemd job on boot.

This fix generates a MD5 sum of all IPv4 addresses for all interfaces, then "folds" that 16 bytes MD5 sum into a 16 bits value to be used as the lower two bytes of the hostid field. Doing it this way provides more guarantee that the field will be unique across multiple identical systems.

issue: eProsima#456
@richiware
Copy link
Member

Build status:

  • Linux Build Status
  • Mac Build Status
  • Windows Build Status

@guillaumeautran
Copy link
Contributor Author

@MiguelCompany / @richiware Any idea why the Linux build did not pass?
Logs are stating:

The following tests FAILED:
	176 - BlackBox_PreallocMem.TCP_TLS (Timeout)

But I don't understand how this is related to the change in this PR.

Copy link
Member

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@richiware
Copy link
Member

Build status:

  • Linux Build Status
  • Mac Build Status
  • Windows Build Status

@richiware richiware merged commit 59e296e into eProsima:develop Apr 30, 2019
@richiware
Copy link
Member

Failed tests not related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants