node-raumkernel
node-raumkernel copied to clipboard
wrong ip address used when discovering device via bonjour when using mDNS repeater
Hello,
I have two seperate VLANs/subnets. Where the raumserver is one (ip range 10.10.20.x/24) and the Raumfeld Host is in another subnet (10.10.10.x/24). As mDNS (used by bonjour) by default only looks for devices (via multicast) in its own subnet you have to create some sort of bridge between those two subnets - the mDNS-repeater (the repeater runs on the router an has the IP 10.10.10.1 and 10.10.20.1). It will basically just forward (repeat) mDNS lookups as well as responses from one subnet to the other. In this setup an mDNS/bonjour response looks like so:
{
"addresses": [
"10.10.10.106"
],
"host": "stereo-l.local",
"referer": {
"address": "10.10.20.1",
"family": "IPv4",
"port": 5353,
"size": 203
},
"port": 47365,
...
}
The correct IP of the host is the one at the top (10.10.10.106). But in the code the IP from the referer is used, which in this case is the repeater and not the actual Raumfeld device. Hence "connecting" to the device fails.
Not sure if there are cases tho were using an address from the addresses-array might not work or where those are wrong. But would it make sense to just change the code to the following?
self.deviceFound(_service.addresses[0], _service.fqdn, _service, "BONJOUR")