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
Merged
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
10 changes: 7 additions & 3 deletions include/ignition/transport/Discovery.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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.


// Update timestamp and cache the callbacks.
DiscoveryCallback<Pub> connectCb;
DiscoveryCallback<Pub> disconnectCb;
Expand All @@ -923,7 +927,7 @@ namespace ignition
// Check scope of the topic.
if ((publisher.Options().Scope() == Scope_t::PROCESS) ||
(publisher.Options().Scope() == Scope_t::HOST &&
_fromIp != this->hostAddr))
!isSenderLocal))
{
return;
}
Expand Down Expand Up @@ -976,7 +980,7 @@ namespace ignition
// Check scope of the topic.
if ((nodeInfo.Options().Scope() == Scope_t::PROCESS) ||
(nodeInfo.Options().Scope() == Scope_t::HOST &&
_fromIp != this->hostAddr))
!isSenderLocal))
{
continue;
}
Expand Down Expand Up @@ -1048,7 +1052,7 @@ namespace ignition
// Check scope of the topic.
if ((publisher.Options().Scope() == Scope_t::PROCESS) ||
(publisher.Options().Scope() == Scope_t::HOST &&
_fromIp != this->hostAddr))
!isSenderLocal))
{
return;
}
Expand Down