summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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