aboutsummaryrefslogtreecommitdiff
path: root/net/isc-dhcp40-server/files/patch-freebsd
blob: 9fef4fdab877628ef0777e401f86536ad7bda2cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
--- client/scripts/freebsd.orig	Sun Apr 27 21:44:01 2003
+++ client/scripts/freebsd	Wed Mar  3 02:28:29 2004
@@ -16,7 +16,7 @@
       ( echo search $new_domain_name >/etc/resolv.conf )
       exit_status=$?
     else
-      rm /etc/resolv.conf
+      ( rm /etc/resolv.conf )
       exit_status=$?
     fi
     if [ $exit_status -ne 0 ]; then
@@ -32,17 +32,17 @@
 # Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
 exit_with_hooks() {
   exit_status=$1
-  if [ -f /etc/dhclient-exit-hooks ]; then
-    . /etc/dhclient-exit-hooks
+  if [ -f %%PREFIX%%/etc/dhclient-exit-hooks ]; then
+    . %%PREFIX%%/etc/dhclient-exit-hooks
   fi
 # probably should do something with exit status of the local script
   exit $exit_status
 }
 
 # Invoke the local dhcp client enter hooks, if they exist.
-if [ -f /etc/dhclient-enter-hooks ]; then
+if [ -f %%PREFIX%%/etc/dhclient-enter-hooks ]; then
   exit_status=0
-  . /etc/dhclient-enter-hooks
+  . %%PREFIX%%/etc/dhclient-enter-hooks
   # allow the local script to abort processing of this state
   # local script must set exit_status variable to nonzero.
   if [ $exit_status -ne 0 ]; then
@@ -51,11 +51,11 @@
 fi
 
 if [ x$new_network_number != x ]; then
-   $LOGGER New Network Number: $new_network_number
+  $LOGGER "New Network Number: $new_network_number"
 fi
 
 if [ x$new_broadcast_address != x ]; then
- $LOGGER New Broadcast Address: $new_broadcast_address
+  $LOGGER "New Broadcast Address: $new_broadcast_address"
   new_broadcast_arg="broadcast $new_broadcast_address"
 fi
 if [ x$old_broadcast_address != x ]; then
@@ -71,6 +71,15 @@
   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=""
+fi
+
 if [ x$reason = xMEDIUM ]; then
   eval "ifconfig $interface $medium"
   eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
@@ -113,7 +122,10 @@
     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 [ x$if_defaultroute = x ] || [ x$if_defaultroute = x$interface ]
+	 then
+	      route delete default $router >/dev/null 2>&1
+	fi
     done
     if [ -n "$old_static_routes" ]; then
       set -- $old_static_routes