OSVR / OSVR-Core

The core libraries, applications, and plugins of the OSVR software platform.
Apache License 2.0
330 stars 124 forks source link

OSVR Remote clients fail with internal devices #139

Closed janoc closed 9 years ago

janoc commented 9 years ago

OSVR server advertises its local devices (e.g. a Razer Hydra) in the tree as "com_osvr_Multiserver/RazerHydra0@localhost".

This causes remote clients to attempt to connect to "localhost" - which is obviously not the place where the device is being hosted, resulting in the UDP connection from the client failing.

@rpavlik suggested a fix by doing a search & replace of localhost in the received tree by the actual host string used for the connection. It cannot be done reliably on the server ahead of time because on a multihomed (e.g. wifi + ethernet) machine the client connection could arrive from any of the available interfaces.

This is related to #127

russell-taylor commented 9 years ago

VRPN can be configured to listen on all interfaces. In fact, it does this by default. This was modified so that Windows security wouldn't complain about trying to provide network access when only exposing to localhost.

janoc commented 9 years ago

@russell-taylor That is actually not the issue, even though if VRPN listens only on a single interface, that could be messy/hard to find problem in the future for remote client use case ("It works when I am on wifi but doesn't when I plug the cable in!!!).

However, if you are multihomed (i.e. listening on all relevant interfaces), you could have a client connecting over e.g. ethernet and attempting to use a device that is advertised in the tree as on the wifi interface - which may not be accessible to that client.

EDIT: Actually that's incorrect, I have just realized that this concerns devices trying to access localhost - the external device would be advertised with its IP/hostname, so no rewriting there. The real bug would happen if the server tried to rewrite localhost for devices it is hosting by guessing which IP to use from the IP of the connecting client - that cannot be really done reliably, especially if the client is from another network (not local subnet) and connecting via a router.

That's why the localhost rewriting should be done on the client - the client knows which hostname/address it used to connect to the server.

rpavlik commented 9 years ago

@russell-taylor This is strictly an OSVR-specific bug, not related to VRPN.