summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2003-09-15 04:47:41 +0000
committermbr <mbr@FreeBSD.org>2003-09-15 04:47:41 +0000
commit1c9b641a01d192d903a2b29a57f0eba909eb519e (patch)
tree7354fcf2461548df2ad444fd30bee86cbf302c5a /contrib
parentc606de95e480785bce8bb9f45b216e8c0539ead8 (diff)
downloadFreeBSD-src-1c9b641a01d192d903a2b29a57f0eba909eb519e.zip
FreeBSD-src-1c9b641a01d192d903a2b29a57f0eba909eb519e.tar.gz
Only kill the default route in the release mode if the interface
where the default route is bound to is the same device. Keep it working for the single user or sysinstall mode, where we just do what we did before. Suggested by: dougb
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/isc-dhcp/client/scripts/freebsd17
1 files changed, 15 insertions, 2 deletions
diff --git a/contrib/isc-dhcp/client/scripts/freebsd b/contrib/isc-dhcp/client/scripts/freebsd
index bc17e20..2f3ad52 100755
--- a/contrib/isc-dhcp/client/scripts/freebsd
+++ b/contrib/isc-dhcp/client/scripts/freebsd
@@ -66,6 +66,15 @@ if [ x$alias_subnet_mask != x ]; then
alias_subnet_arg="netmask $alias_subnet_mask"
fi
+# Get the interface to which our default route is bound to.
+if [ -x /usr/bin/netstat ]; then
+ if_defaultroute=`/usr/bin/netstat -rn \
+ | /usr/bin/grep "^default" \
+ | /usr/bin/awk '{print $6}'`
+else
+ if_defaultroute="x"
+fi
+
if [ x$reason = xMEDIUM ]; then
eval "ifconfig $interface $medium"
eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
@@ -155,13 +164,17 @@ if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
|| [ x$reason = xSTOP ]; then
if [ x$alias_ip_address != x ]; then
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
- route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
+ if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then
+ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
+ fi
fi
if [ x$old_ip_address != x ]; then
eval "ifconfig $interface inet -alias $old_ip_address $medium"
route delete $old_ip_address 127.1 >/dev/null 2>&1
for router in $old_routers; do
- route delete default $router >/dev/null 2>&1
+ if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then
+ route delete default $router >/dev/null 2>&1
+ fi
done
if [ -n "$old_static_routes" ]; then
set -- $old_static_routes
OpenPOWER on IntegriCloud