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

Consider all network interfaces when checking HOST option. #245

Merged
merged 2 commits into from
May 17, 2021

Conversation

caguero
Copy link
Collaborator

@caguero caguero commented May 12, 2021

Signed-off-by: Carlos Agüero [email protected]

🦟 Bug fix

Fixes the following issue:

One publisher sets IGN_IP to 127.0.0.1 and advertises a topic with Scope_T::Host. With these settings, a default subscriber is unable to receive any messages.

Summary

The problem was that we were only checking if the source IP received was matching the host address used by the receiver. Now, we're checking if the source IP received matches any of the network interfaces or localhost.

To test (from the examples directory:

Terminal 1: IGN_IP=127.0.0.1 ./publisher
Terminal 2: ./subscriber

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • [] All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

@peci1
Copy link
Contributor

peci1 commented May 12, 2021

Thanks, it works. I tested both the simple example and a more complex one with the comms model visualization service in SubT.

I have just one comment to the implementation: 127.0.0.1 is not the only localhost address. It's actually 127.255.255.255/8 that's reserved for loopback devices.

@caguero
Copy link
Collaborator Author

caguero commented May 13, 2021

Thanks, it works. I tested both the simple example and a more complex one with the comms model visualization service in SubT.

I have just one comment to the implementation: 127.0.0.1 is not the only localhost address. It's actually 127.255.255.255/8 that's reserved for loopback devices.

What do you suggest? Anything that starts with 127. should be considered localhost?

@peci1
Copy link
Contributor

peci1 commented May 14, 2021

Yes, that's my suggestion.

Signed-off-by: Carlos Agüero <[email protected]>
@caguero
Copy link
Collaborator Author

caguero commented May 14, 2021

Yes, that's my suggestion.

Sure, updated in fc1c7da.

@@ -898,6 +898,10 @@ namespace ignition
this->SendUnicast(msg);
}

bool isSenderLocal = (std::find(this->hostInterfaces.begin(),
this->hostInterfaces.end(), _fromIp) != this->hostInterfaces.end()) ||
(_fromIp.find("127.") == 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any need to make this also work for ipv6?

Copy link
Contributor

Choose a reason for hiding this comment

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

not from my view, but generally it would be good

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably out of scope for now.

@caguero caguero merged commit f083307 into ign-transport9 May 17, 2021
@caguero caguero deleted the fix_scope_host branch May 17, 2021 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔮 dome Ignition Dome
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants