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

Discovery does not work on FreeBSD 11.1 #105

Open
displaced opened this issue Oct 7, 2017 · 1 comment · May be fixed by #117
Open

Discovery does not work on FreeBSD 11.1 #105

displaced opened this issue Oct 7, 2017 · 1 comment · May be fixed by #117

Comments

@displaced
Copy link

Hi,

This is a problem common to several pieces of cross-platform software which attempt to use broadcast pings.

If I understand the docs correctly, FreeBSD will interpret 255.255.255.255 as broadcast on the first IP interface with the IFF_BROADCAST flag set -- which I think appears to be the loopback interface (lo0). Whichever it is, it's definitely not my LAN interface!

I think the IP_ONESBCAST socket option might change it to the Linux-y meaning of broadcast on all interfaces.

A quick workaround is to specify the broadcast address of the interface I want to broadcast on (my LAN interface). To do this, I edited:

/usr/local/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-discover/lib/ping.js

I changed line 9 from this.address = '255.255.255.255' to this.address = '192.168.50.255', since my network's subnet is 192.168.50.0/24. Other FreeBSD users would need to adjust as necessary.

As I say, this problem is prevalent amongst software which is FreeBSD-compatible in every other way, but is easily worked-around. Not sure if it's possible for ping libraries to check their platform first, but very few seem to!

Hope that helps out some people!

@stblassitude
Copy link

Making the broadcast address configurable would be highly appreciated!

stblassitude added a commit to stblassitude/harmonyhubjs-discover that referenced this issue Dec 16, 2017
This allows users to specify the broadcast address to send the ping to.
This is neccessary on systems with more than one interface, or certain
operating systems.

This allows KraigM/homebridge-harmonyhub#105 to be addressed.
stblassitude added a commit to stblassitude/homebridge-harmonyhub that referenced this issue Dec 16, 2017
This enables passing options to harmonyhubjs-discover's Discover
constructor.

This closes KraigM#105.

For systems with multiple interfaces, using the default broadcast
address of 255.255.255.255 will not give consistent results. Instead,
you need to pass the appropriate broadcast address for the network
you're addressing, like 192.168.1.255 for the network 192.168.1.0/24.

This PR requires swissmanu/harmonyhubjs-discover#8 to be merged and
released.
@stblassitude stblassitude linked a pull request Dec 16, 2017 that will close this issue
stblassitude added a commit to stblassitude/harmonyhubjs-discover that referenced this issue Dec 19, 2017
This allows users to specify the broadcast address to send the ping to.

This allows KraigM/homebridge-harmonyhub#105 to be addressed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants