-
Notifications
You must be signed in to change notification settings - Fork 799
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6ccef08
to
83a8ba0
Compare
83a8ba0
to
6cbdbf0
Compare
6cbdbf0
to
454c038
Compare
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
454c038
to
8fc7afd
Compare
@MiguelCompany / @richiware Any idea why the Linux build did not pass?
But I don't understand how this is related to the change in this PR. |
MiguelCompany
approved these changes
Apr 30, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Failed tests not related. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, theappId
(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