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

net-online: ping default gateway does not work #179

Closed
bell07 opened this issue Nov 3, 2017 · 4 comments
Closed

net-online: ping default gateway does not work #179

bell07 opened this issue Nov 3, 2017 · 4 comments

Comments

@bell07
Copy link
Contributor

bell07 commented Nov 3, 2017

get_default_gateway does not work in case of dhcp client because the gateway is not provided directly after the interface is up. So we need to wait till the default entry appears or a new conf.d setting for host to ping.
The second issue the ping to the gateway appears just one time. The service should try to ping multiple times till the timeout is reached.

@williamh
Copy link
Contributor

williamh commented Dec 5, 2017

The ping default gateway idea has been removed in favor of you designating the host to ping and setting a switch that says whether a ping test should be included.
This change was made in OpenRC 0.27.1, so you need at least that version, preferably OpenRC-0.34.11 however since this is the latest version.
I will be addressing the ping test and the possibility of the device not being configured yet in OpenRC
0.35.

@bell07
Copy link
Contributor Author

bell07 commented Dec 12, 2017

I tried the new test logic with

include_ping_test=yes
ping_test_host=192.168.1.1

It does not work for me. If the host is not available the script fails.
Expected behavior is the script wait till the host is reachable or till timeout is reached.

@bell07
Copy link
Contributor Author

bell07 commented Dec 12, 2017

My proposal, working for me

--- a/net-online.in
+++ b/etc/init.d/net-online
@@ -65,8 +65,14 @@ start ()
  if [ $rc -eq 0 ] && yesno ${include_ping_test:-no}; then
        ping_test_host="${ping_test_host:-google.com}"
        if [ -n "$ping_test_host" ]; then
+ while $infinite || [ $timeout -gt 0 ]; do
+
                ping -c 1 $ping_test_host > /dev/null 2>&1
                rc=$?
+if [ $rc -eq 0 ]; then break; fi
+sleep 1
+: $((timeout -= 1))
+done
        fi
  fi
  eend $rc "The network is offline"

@williamh
Copy link
Contributor

@bell07 it looks ok, but I can't apply it to the tree in this form. Please open a pull request.

Thanks,

William

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

No branches or pull requests

2 participants