Project

General

Profile

« Previous | Next » 

Revision d5cbbe6a

Added by Renato Botelho about 5 years ago

Ticket #9267: Fix dhclient-script to handle error properly

View differences:

src/usr/local/sbin/pfSense-dhclient-script
297 297
#
298 298
# Start of active code.
299 299
#
300
exit_status=0
300 301

  
301 302
# Invoke the local dhcp client enter hooks, if they exist.
302 303
if [ -f /etc/dhclient-enter-hooks ]; then
303 304
	$LOGGER "dhclient-enter-hooks"
304
	exit_status=0
305 305
	. /etc/dhclient-enter-hooks
306 306
	# allow the local script to abort processing of this state
307 307
	# local script must set exit_status variable to nonzero.
......
370 370
	;;
371 371

  
372 372
TIMEOUT)
373
	# This case must exit zero only if the cached address
374
	# is considered valid. See dhclient-script(8).
375
	exit_status=1
373 376
	delete_old_alias
374 377
	add_new_address
375 378
	/bin/sleep 1
......
384 387
			if add_new_resolv_conf; then
385 388
				notify_rc_newwanip
386 389
			fi
390
			exit_status=0
387 391
		fi
388 392
	fi
389
	$IFCONFIG $interface inet -alias $new_ip_address $medium
390
	delete_old_routes
393
	if [ $exit_status -ne 0 ]; then
394
		$IFCONFIG $interface inet -alias $new_ip_address $medium
395
		delete_old_routes
396
	fi
391 397
	;;
392 398
esac
393 399

  
394 400
# Invoke the local dhcp client exit hooks, if they exist.
395 401
if [ -f /etc/dhclient-exit-hooks ]; then
396 402
	$LOGGER "dhclient-exit-hooks"
397
	exit_status=0
398 403
	. /etc/dhclient-exit-hooks
399 404
	# allow the local script to abort processing of this state
400 405
	# local script must set exit_status variable to nonzero.
401
	exit $exit_status
402 406
fi
407
exit $exit_status

Also available in: Unified diff