summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient-script
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-12-08 17:55:04 +0000
committerErmal <eri@pfsense.org>2010-12-08 17:55:04 +0000
commit6cf1cc61168f9b70157424e8828b742a8e05d13d (patch)
treee5cdf438d748ce69b94cd5638696c60f20b433d9 /sbin/dhclient-script
parent20e18ef23b19279d12799813068b0d40a146be3e (diff)
downloadpfsense-6cf1cc61168f9b70157424e8828b742a8e05d13d.zip
pfsense-6cf1cc61168f9b70157424e8828b742a8e05d13d.tar.gz
Do not overrite the default gateway if already found.
Diffstat (limited to 'sbin/dhclient-script')
-rwxr-xr-xsbin/dhclient-script10
1 files changed, 6 insertions, 4 deletions
diff --git a/sbin/dhclient-script b/sbin/dhclient-script
index 515191a..a177e2c 100755
--- a/sbin/dhclient-script
+++ b/sbin/dhclient-script
@@ -183,6 +183,7 @@ add_new_routes() {
return
fi
+ ADDED_ROUTE=no
# Only allow the default route to be overridden if it's on our own interface
if [ -f "/tmp/${interface}_defaultgw" ]; then
$ROUTE delete default
@@ -191,13 +192,12 @@ add_new_routes() {
$ROUTE add default -iface $interface
echo $ROUTE add default -iface $interface | $LOGGER
echo $router > /tmp/${interface}_router
- echo $router > /tmp/${interface}_defaultgw
else
$ROUTE add default $router
echo $ROUTE add default $router | $LOGGER
echo $router > /tmp/${interface}_router
- echo $router > /tmp/${interface}_defaultgw
fi
+ ADDED_ROUTE=yes
# 2nd and subsequent default routers error out, so explicitly
# stop processing the list after the first one.
break
@@ -209,8 +209,10 @@ add_new_routes() {
set $new_static_routes
while [ $# -gt 1 ]; do
$ROUTE add $1 $2
+ if [ "$ADDED_ROUTE" = "no" ]; then
+ echo $2 > /tmp/${interface}_router
+ fi
shift; shift
- echo $new_routers > /tmp/${interface}_router
done
fi
}
@@ -260,7 +262,7 @@ if [ -f /etc/dhclient-enter-hooks ]; then
fi
if [ -x $ROUTE ]; then
- if_defaultroute=`$ROUTE get default | $GREP interface | $AWK '{print $2}'`
+ if_defaultroute=`$ROUTE -n get -inet default | $GREP interface | $AWK '{print $2}'`
else
$LOGGER "if_defaultroute"
if_defaultroute="x"
OpenPOWER on IntegriCloud