Project

General

Profile

Bug #9267 » pfsense-dhclient-script-patch.txt

Nash Kaminski, 01/10/2019 06:59 PM

 
1
diff --git a/src/usr/local/sbin/pfSense-dhclient-script b/src/usr/local/sbin/pfSense-dhclient-script
2
index 726e4d4b5f..f784e3c5ae 100755
3
--- a/src/usr/local/sbin/pfSense-dhclient-script
4
+++ b/src/usr/local/sbin/pfSense-dhclient-script
5
@@ -286,11 +286,11 @@ notify_rc_newwanip() {
6
 #
7
 # Start of active code.
8
 #
9
+exit_status=0
10
 
11
 # Invoke the local dhcp client enter hooks, if they exist.
12
 if [ -f /etc/dhclient-enter-hooks ]; then
13
 	$LOGGER "dhclient-enter-hooks"
14
-	exit_status=0
15
 	. /etc/dhclient-enter-hooks
16
 	# allow the local script to abort processing of this state
17
 	# local script must set exit_status variable to nonzero.
18
@@ -359,6 +359,9 @@ EXPIRE|FAIL|RELEASE)
19
 	;;
20
 
21
 TIMEOUT)
22
+	# This case must exit zero only if the cached address
23
+	# is considered valid. See dhclient-script(8).
24
+	exit_status=1
25
 	delete_old_alias
26
 	add_new_address
27
 	/bin/sleep 1
28
@@ -373,19 +376,21 @@ TIMEOUT)
29
 			if add_new_resolv_conf; then
30
 				notify_rc_newwanip
31
 			fi
32
+			exit_status=0
33
 		fi
34
 	fi
35
-	$IFCONFIG $interface inet -alias $new_ip_address $medium
36
-	delete_old_routes
37
+	if [ $exit_status -ne 0 ]; then
38
+		$IFCONFIG $interface inet -alias $new_ip_address $medium
39
+		delete_old_routes
40
+	fi
41
 	;;
42
 esac
43
 
44
 # Invoke the local dhcp client exit hooks, if they exist.
45
 if [ -f /etc/dhclient-exit-hooks ]; then
46
 	$LOGGER "dhclient-exit-hooks"
47
-	exit_status=0
48
 	. /etc/dhclient-exit-hooks
49
 	# allow the local script to abort processing of this state
50
 	# local script must set exit_status variable to nonzero.
51
-	exit $exit_status
52
 fi
53
+exit $exit_status
(1-1/2)