Skip to content

Commit

Permalink
Ticket #9267: Fix dhclient-script to handle error properly
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgarga committed Mar 23, 2020
1 parent 7bf57a3 commit f8ac7bd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/usr/local/sbin/pfSense-dhclient-script
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit f8ac7bd

Please sign in to comment.