Project

General

Profile

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

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

 
diff --git a/src/usr/local/sbin/pfSense-dhclient-script b/src/usr/local/sbin/pfSense-dhclient-script
index 726e4d4b5f..f784e3c5ae 100755
--- a/src/usr/local/sbin/pfSense-dhclient-script
+++ b/src/usr/local/sbin/pfSense-dhclient-script
@@ -286,11 +286,11 @@ notify_rc_newwanip() {
#
# Start of active code.
#
+exit_status=0
# Invoke the local dhcp client enter hooks, if they exist.
if [ -f /etc/dhclient-enter-hooks ]; then
$LOGGER "dhclient-enter-hooks"
- exit_status=0
. /etc/dhclient-enter-hooks
# allow the local script to abort processing of this state
# local script must set exit_status variable to nonzero.
@@ -359,6 +359,9 @@ EXPIRE|FAIL|RELEASE)
;;
TIMEOUT)
+ # This case must exit zero only if the cached address
+ # is considered valid. See dhclient-script(8).
+ exit_status=1
delete_old_alias
add_new_address
/bin/sleep 1
@@ -373,19 +376,21 @@ TIMEOUT)
if add_new_resolv_conf; then
notify_rc_newwanip
fi
+ exit_status=0
fi
fi
- $IFCONFIG $interface inet -alias $new_ip_address $medium
- delete_old_routes
+ if [ $exit_status -ne 0 ]; then
+ $IFCONFIG $interface inet -alias $new_ip_address $medium
+ delete_old_routes
+ fi
;;
esac
# Invoke the local dhcp client exit hooks, if they exist.
if [ -f /etc/dhclient-exit-hooks ]; then
$LOGGER "dhclient-exit-hooks"
- exit_status=0
. /etc/dhclient-exit-hooks
# allow the local script to abort processing of this state
# local script must set exit_status variable to nonzero.
- exit $exit_status
fi
+exit $exit_status
(1-1/2)