-
Notifications
You must be signed in to change notification settings - Fork 105
DeviceManager: don't listen on 11095 when ephemeral is enabled #573
base: master
Are you sure you want to change the base?
Conversation
When both device emulator and device manager running on the same station, both of them will listen on 11095, only one of them choosing randomly can receive packets from the socket. Ephemeral port is introduced to solve the problem, let device manager to choose a random port instead of 11095. But there is a bug that even with ephemeral enabled, device manager still listening on 11095. The patch solved the bug, and prevent device manager from listening of 11095 when ephemeral is enabled. Change-Id: I61e1b92fd329991d5931ce8472fa91580794bbcc
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.
This behavior is by design, and changing it will break various scenarios.
So can we add another option to prevent device manager binding on 11095, so we can run device daemon and device manager simultaneously ? |
This is already possible, by instructing either the device manager or the device to bind to a different IP address. For the mock device, and other test-app command-line tools, you can pass the --node-addr argument to give a specific IP address to bind to. (You can actually pass two --node-addr arguments, one IPv6, one IPv4, to bind to two addresses). On the device manager side, you can instruct it to bind to specific IPv6/IPv4 addresses using the environment variables WEAVE_IPV6_LISTEN_ADDR/WEAVE_IPV4_LISTEN_ADDR. On linux, the easiest way to run both the device manager and a device on the same system is to bind the device manager to an alternate localhost address. For IPv4, this address does not need to be configured in advance:
If you want to use IPv6, you can assign temporary ULA addresses to the loopback interface:
|
This method looks pretty good, I'll update docs corresponding to the setup. |
@jaylogue This solution is not working properly. Once I specify any IPv4 local address, then Message layer refuse to bind any IPv6 address, so it will not be able to connect to cloud via tunnel. I got the error:
The logic is here: openweave-core/src/lib/core/WeaveMessageLayer.h Lines 836 to 845 in efbed8f
If we bind to an IPv6 local address, since the bond address is not inside ULA network, so it is also not able to communicate with cloud. I think we should continue working on solution using the different ports. I'll add an command line option to let device manager do not bind 11095. The option will be off by default to keep it compatible with current behavior. |
@kghost If you are running a simulated device that creates a tunnel you cannot force bind the device to a particular IPv4/IPv6 address. It will not be able to talk to the service correctly. Also, if you disable listening on port 11095 in the device manager, some features will not work. If you want to run a device and the device manager on the same node, you really should be using network namespaces. |
@jaylogue In my original setup guide, I'm suggesting using namespace or docker, but the setup procedure is a little bit tedious, and the experience is not great. For our 1P developers who have fully aware of technologies like docker or network namespaces, this is totally fine, but for our MFGN partners, it is not a simple task to setup docker or namespaces for an inexperienced developer. Here I want to improve our user experience targeting all third party developers, and preferably one click fire and go without bunch of environment setups. |
When both device emulator and device manager running on the same
station, both of them will listen on 11095, only one of them choosing
randomly can receive packets from the socket.
Ephemeral port is introduced to solve the problem, let device manager to
choose a random port instead of 11095. But there is a bug that even with
ephemeral enabled, device manager still listening on 11095.
The patch solved the bug, and prevent device manager from listening of
11095 when ephemeral is enabled.
Change-Id: I61e1b92fd329991d5931ce8472fa91580794bbcc