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

BUG: doesn't work if LAN is not /24 #9

Open
AtmanActive opened this issue Aug 27, 2023 · 2 comments
Open

BUG: doesn't work if LAN is not /24 #9

AtmanActive opened this issue Aug 27, 2023 · 2 comments
Labels
bug Something isn't working network involves low level networking (e.g. wol protocol)

Comments

@AtmanActive
Copy link

Was testing several Wake on LAN apps from F-Droid and this one doesn't work on my network. My network is a bit specific as it is /23 wide, not /24, like most are. The other competing app had a broadcast address input box where I could enter my specific broadcast address and that one works on my LAN.

Suggestion: either allow manual input of LAN broadcast address or do a proper broadcast calculation by querying android for both IP and mask.

Thanks.

@herzhenr
Copy link
Owner

I have only tested the app with the normal /24 subnet but haven't thought of other subnet configurations. I assume if your phone has an ip of e.g. 192.168.0.25 only devices which also have a zero in the third octet are discovered e.g. 192.168.0.26 but devices which have an IP address of 192.168.1.27 are a) not discoverable in the network scan and b) even if you add them manually, they can't be woken up? Can you provide me an example IP address for a device which can't be woken up and the corresponding correct broadcast address? (It doesn't has to be the specific IP address but an example would help a lot!)

There is a flutter package called network_info_plus which I am already using and which returns the right subnet. This would allow me to scan the whole network, but the larger the network gets, the longer the scan takes (In your case with /23 it would already take double the amount of time for a /24 network, /22 4 times and so on). For the device itself, I can implement an extra field where for each device a specific broadcast address to wake the device up can be specified. But I would like it better if my app calculates it automatically so the ui is more minimalistic.

@AtmanActive
Copy link
Author

So my phone has an IP address of 192.168.150.18, but my network's subnet mask is 255.255.254.0. That means that my network uses IP addresses from 192.168.150.0 to 192.168.151.255. If the app assumes /24 network, then, it will incorrectly assume that my network's broadcast is at 192.168.150.255. On the other hand, if the app would get both the IP address and the subnet mask from android and calculate from there, then, it would get the correct broadcast address, which is 192.168.151.255 in my case. The bug stems from assuming the broadcast address instead of calculating the broadcast address. Maybe obtaining the subnet mask from android is the problem?

@herzhenr herzhenr added bug Something isn't working network involves low level networking (e.g. wol protocol) labels Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working network involves low level networking (e.g. wol protocol)
Projects
None yet
Development

No branches or pull requests

2 participants