From 2efb39d092a971c6ea8d06b25c315be7d400c4a1 Mon Sep 17 00:00:00 2001 From: jim-p Date: Sun, 14 Feb 2016 00:28:29 -0500 Subject: Make a couple changes to PPP default gateway handling to address issues with default gateway switching. Fixes #1837 Tested with default gateway switching on and off, by rebooting, manually disconnecting the PPP link, and manually disconnecting the NIC link, worked each time, though still possible some issues remain. Feedback appreciated. --- src/usr/local/sbin/ppp-linkdown | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/usr/local/sbin') diff --git a/src/usr/local/sbin/ppp-linkdown b/src/usr/local/sbin/ppp-linkdown index 6fca066..3faf5f1 100755 --- a/src/usr/local/sbin/ppp-linkdown +++ b/src/usr/local/sbin/ppp-linkdown @@ -13,9 +13,13 @@ fi if [ "${PROTOCOL}" == "inet" && -s "/tmp/${IF}_defaultgw" ]; then GW=`head -n 1 /tmp/${IF}_defaultgw` - [ -n "${GW}" ] \ - && /sbin/route -q delete default ${GW} + DGW=`/sbin/route -n get -inet default | /usr/bin/awk '/gateway:/ {print $2}'` + # Only remove the default gateway if it matches the gateway for this interface. See redmine #1837 + if [ "${GW}" = "${DGW}" ]; then + /sbin/route -q delete default ${GW} + fi fi + if [ "${PROTOCOL}" == "inet6" ]; then /usr/local/sbin/ppp-ipv6 ${IF} down fi -- cgit v1.1