From 44718ea0ec96349802bed40e21f3b81e0e9a43be Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 30 May 2023 21:52:24 -0500 Subject: [PATCH] Update mm-scripts.sh --- mm-scripts.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm-scripts.sh b/mm-scripts.sh index 32e6cac..a244b63 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -228,15 +228,15 @@ MMSTART(){ until [ "${checked}" = "" ]; do zerogw=$(/bin/ip route show | grep 0.0.0.0 | cut -d' ' -f 3) defaultgw=$(/bin/ip route show | grep default | cut -d' ' -f 3) - if [ "${zerogw}" = "${defaultgw}" ]; then + if [ "${zerogw}" == "${defaultgw}" ] && [ "${defaultgw}" == "${VPN_INTERFACE}" ]; then checked="" - elif [ "${checked}" == "false" ] && [ ${cc} -ge 2 ]; then + elif [ ${cc} -ge 2 ] && [ "${zerogw}" == "${VPN_INTERFACE}" ] && [ "${defaultgw}" != "${VPN_INTERFACE}" ]; then /bin/ip route del default /bin/ip route add default dev ${VPN_INTERFACE} SENDNOTICE "MM FIX" "Default route failure, default route re-added" - elif [ "${checked}" == "false" ] && [ ${cc} -eq 10 ]; then + elif [ ${cc} -eq 10 ]; then echo -e "${idsCL[Red]}Could not confirm default routes, restarting system!${idsCL[Default]}" echo "$(date) - Could not confirm default routes, restarting system" >> $logfile SENDNOTICE "Network Failure" "Default route failure, will try and restart the VPN" 1