From 9c96f22ed0b0f235a69c29a6f32c12c373d1dcc3 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Fri, 17 Jan 2020 22:29:51 +0200 Subject: [PATCH] S40network: fix def route validation --- board/common/overlay/etc/init.d/S40network | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/board/common/overlay/etc/init.d/S40network b/board/common/overlay/etc/init.d/S40network index 4885db4028..08f1356c3f 100755 --- a/board/common/overlay/etc/init.d/S40network +++ b/board/common/overlay/etc/init.d/S40network @@ -197,10 +197,7 @@ start() { fi fi - # re-evalutate default route, as it might have changed with start_eth - def_route_ok=$(ip route get 1.1.1.1 &>/dev/null && echo "ok") - - if [[ "${eth_ok}" != "ok" ]] && [[ "${wlan_ok}" != "ok" ]] && [[ "${ppp_ok}" != "ok" ]] || [[ "${def_route_ok}" != "ok" ]]; then + if [[ "${eth_ok}" != "ok" ]] && [[ "${wlan_ok}" != "ok" ]] && [[ "${ppp_ok}" != "ok" ]]; then if [[ "${LINK_WATCH}" == "true" ]]; then logger -t network "no network connection available, calling panic action" panic_action network @@ -235,6 +232,19 @@ start() { test $? == 0 && msg_done || msg_fail fi fi + + # re-evalutate default route, as it might have changed with start_eth or static IP + def_route_ok=$(ip route get 1.1.1.1 &>/dev/null && echo "ok") + if [[ "${def_route_ok}" != "ok" ]]; then + if [[ "${IP_WATCH}" == "true" ]]; then + logger -t network "no default route, calling panic action" + panic_action network + return 1 + else + logger -t network "no default route" + return 0 + fi + fi } stop() {