summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-05-31 19:14:29 +0000
committerErmal <eri@pfsense.org>2010-05-31 19:14:29 +0000
commit924f202ee818c72b10855d3a1c06b34a9e7aa595 (patch)
tree7c21bb5ebd72f07849c9438f046fd859578528cb /sbin
parent1fb059612c78c034fc77ff98085576625c1d3324 (diff)
downloadpfsense-924f202ee818c72b10855d3a1c06b34a9e7aa595.zip
pfsense-924f202ee818c72b10855d3a1c06b34a9e7aa595.tar.gz
Fixes #622. Add a new file status for signaling default gateway under /tmp. dhclient script will check for this file to define if the interface needs a default gateway or not from its given routes.
Diffstat (limited to 'sbin')
-rwxr-xr-xsbin/dhclient-script26
1 files changed, 9 insertions, 17 deletions
diff --git a/sbin/dhclient-script b/sbin/dhclient-script
index d7cd3a6..35ce76f 100755
--- a/sbin/dhclient-script
+++ b/sbin/dhclient-script
@@ -130,23 +130,22 @@ delete_old_routes() {
}
add_new_routes() {
- $LOGGER "Adding new routes"
- # $ROUTE add $new_ip_address $LOCALHOST >/dev/null 2>&1
+ $LOGGER "Adding new routes to interface: $interface"
# Only allow the default route to be overridden if it's on our own interface
- DEFAULTROUTE_IFACE=`/sbin/route get default | grep interface | awk '{print $2};'`
- if [ -z "${DEFAULTROUTE_IFACE}" -o "{$interface}" = "${DEFAULTROUTE_IFACE}" ]; then
+ if [ -f "/tmp/${interface}_defaultgw" ]; then
+ $ROUTE delete default
for router in $new_routers; do
if [ "$new_ip_address" = "$router" ]; then
- $ROUTE add default -iface $router
- #>/dev/null 2>&1
- echo $ROUTE add default -iface $router | $LOGGER
- echo $new_routers > /tmp/${interface}_router
+ $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
- #>/dev/null 2>&1
- echo $new_routers > /tmp/${interface}_router
+ echo $router > /tmp/${interface}_router
+ echo $router > /tmp/${interface}_defaultgw
fi
# 2nd and subsequent default routers error out, so explicitly
# stop processing the list after the first one.
@@ -163,13 +162,6 @@ add_new_routes() {
echo $new_routers > /tmp/${interface}_router
done
fi
-
- # last ditch effort if no route exists.
- DEFAULTROUTE=`$NETSTAT -rn | $GREP default`
- if [ -z "${DEFAULTROUTE}" ]; then
- $ROUTE add default -iface $interface
- fi
-
}
add_new_resolv_conf() {
OpenPOWER on IntegriCloud