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

ping the default gateway to check connectivity #4

Closed
RoguedBear opened this issue Dec 4, 2021 · 0 comments
Closed

ping the default gateway to check connectivity #4

RoguedBear opened this issue Dec 4, 2021 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@RoguedBear
Copy link
Owner

RoguedBear commented Dec 4, 2021

in case the router is a DHCP relay the /sys/class/net/wlo1/operstate still shows up and the computer wakes up even if the main router is down.
Since i want "connection to a network" being if the main router is up, pinging the default gateway seems to be the best option

src: https://stackoverflow.com/a/932187

@RoguedBear RoguedBear added bug Something isn't working enhancement New feature or request labels Dec 4, 2021
RoguedBear added a commit that referenced this issue Dec 7, 2021
valid connectivity method options: v2, v3, v2+v3

also resolves #4

## Difference between different connectivity methods:
- v2: default, will work for almost everyone. see's the carrier and operstate values in `/sys/class/net/<device>/` to decide if the device is up or not
- v3: pings the default gateway (or the gateways for wired/wireless devices if specified) to check for connectivity. if ping fails then device is offline
- v2+v3: uses both the methods to check for connectivity. basically an: `v2() and v3()`. aka `and` short-circuiting happens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant