Closed sjorge closed 2 years ago
@sjorge - I have wondered for a while - why does Ciao use arp in the first place, and only os.networkInterfaces() as a fallback?
I must be missing something (in which case, please share!) because this doesn't make a lot of sense to me. Even if os.networkInterfaces(), due to some Node quirk, doesn't show all valid interfaces, these 'extra' interfaces would not then be usable from Node afterwards anyway. So why don't we just use os.networkInterfaces() as the primary? No need for arp, no need for parsing, no issue with SunOS.
I have no idea, just went for the most simple fix that I could get to work.
@sjorge - I think there is a much simpler fix though. Line 365 of NetworkManager.ts (original version) is currently:
names = await NetworkManager.getNetworkInterfaceNames();
Replace that line with:
throw('whatever');
Let me know if that works on SunOS.
That also seems to work.
Although it looks like the trick with arp is done for FreeBSD and Darwin too so it seems to be the 'common' way CIAO does it for most platforms that are not linux ¯\_(ツ)_/¯
:recycle: Current situation
See #21, but basically the field offset in the
arp
command output on SunOS-like systems does not match 100% with OpenBSD systems, resulting inNetworkManager.getOpenBSD_SUNOS_NetworkInterfaces()
not returning any interfaces on SunOS-like systems. Making CIAO kind of useless.:bulb: Proposed solution
Overall the code in
NetworkManager.getOpenBSD_SUNOS_NetworkInterfaces()
looks good, it just needs a different field offset between OpenBSD and SunOS.When
os.platform()
returns sunos (which it does on Oracle Solaris and illumos distros (OpenSolaris continuation)), we simple use a different offset. The default is left as 2 which was the old value.:gear: Release Notes
CIAO now works properly on SunOS-like systems and will be able to listen on an interface that is not lo0.
:heavy_plus_sign: Additional Information
n/a
Testing
Made sure I could run
npm run test
and that the tests still passI also switched my nrchkb node-red setup over to the CIAO backend instead of older bonjour backend. (Wanting to switch is what made me discover CIAO was broken)
I've been running said setup for about a month now with CIAO and the change in this PR.
Reviewer Nudging
Not sure, it's a simple offset change, the original issue I filed lists the output of the execute arp command for an illumos based distro and from Oracle Solaris.