Fix IP binding of rosbridge_server #1047
Open
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.
Public API Changes
None
Description
While launching
rosbridge_server
with theaddress
parameter, it can still be accessed through another interface. For example:My IP addresses:
Although the output shows it is bound to the specified address:
In fact, it has not taken effect at all, connections from other interface (which is
enp6s0
on my computer) are still allowed:We can verify it through
netstat
:On the other hand, it even allows you to bind IP addresses that are not on the local machine:
Finally I found that the root cause is no
interface
parameter is passed when calling functionlistenWS
, and it work as expected after this fix. To evaluate it, simply apply the fix to/opt/ros/noetic/lib/rosbridge_server/rosbridge_websocket
, then launch the server again, you will find that the IP binding is correct:And if you want to bind to
1.1.1.1
again, you will get error like this:The bug was introduced in #426. This PR fixes #904.