diff options
author | jim-p <jimp@pfsense.org> | 2016-02-14 00:28:29 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2016-02-14 00:28:29 -0500 |
commit | 2efb39d092a971c6ea8d06b25c315be7d400c4a1 (patch) | |
tree | f09467e90a4063d3dabcdcb065bc52e58be2b0cb /src | |
parent | 6a5fc3d7108e30f5a6867fe730804fe3064931d8 (diff) | |
download | pfsense-2efb39d092a971c6ea8d06b25c315be7d400c4a1.zip pfsense-2efb39d092a971c6ea8d06b25c315be7d400c4a1.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/interfaces.inc | 3 | ||||
-rwxr-xr-x | src/usr/local/sbin/ppp-linkdown | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index af0d11f..5d4d775 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -1766,6 +1766,8 @@ EOD; } } +/* Omit this, we maintain the default route by other means, and it causes problems with + * default gateway switching. See redmine #1837 if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true) { $setdefaultgw = true; $mpdconf .= <<<EOD @@ -1773,6 +1775,7 @@ EOD; EOD; } +*/ $mpdconf .= <<<EOD set iface {$ondemand} on-demand set iface idle {$ppp['idletimeout']} 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 |