Open firestack opened 5 years ago
With more investigation, it's found that posix machines work fine with this library, windows machines do not, it would seem when passing 255.255.255.255 to the dst
of send_magic_to
windows doesn't send the packet to the proper broadcast address on the local subnet.
To fix this we'll either need to integrate https://github.com/libpnet/libpnet or wait for https://github.com/retep998/winapi-rs/pull/802 to be accepted and pull in the https://docs.microsoft.com/en-us/windows/desktop/api/iphlpapi/nf-iphlpapi-getadaptersaddresses function to access the local IP address of the adapters on the machine
In the mean time it could be possible to allow the user to specify the broadcast address if using windows.
Currently this fails to properly work on windows and other OS's disallowing access to write raw data to an interface.
There exists libpnet to allow rust to write to raw sockets but it seems a bit bloated at 24kb and also has a dependency on libpcap/winpcap.
It might be worth investigating into platform apis for low level access but it also seems that there needs to be some hacks with setuid to allow that to work without elevating(eg ping)