>From 26d6503c3bae52492d64827b3d6f7d8be7040d87 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Thu, 24 Apr 2008 14:28:51 +0400 Subject: [PATCH] Add FreeBSD-specific cleanup for the dhclient. This code unsets the kenv values and calls /etc/rc.d/resolv to perform the actual job. It is now called for the EXPIRE, FAIL and TIMEOUT cases. It seems to be enough even to catch the exit of the dhclient and clean after itself. Signed-off-by: Eygene Ryabinkin --- sbin/dhclient/dhclient-script | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script index 9b14962..1ef3dbc 100644 --- a/sbin/dhclient/dhclient-script +++ b/sbin/dhclient/dhclient-script @@ -263,6 +263,14 @@ fbsd_resolv () { /etc/rc.d/resolv restart } +# This is the FreeBSD-specific implementation of the resolver cleanup +# routine. +fbsd_resolv_cleanup () { + "$KENV" -u dhclient.domain-name 2>/dev/null + "$KENV" -u dhclient.domain-name-servers 2>/dev/null + /etc/rc.d/resolv restart +} + # Must be used on exit. Invokes the local dhcp client exit hooks, if any. exit_with_hooks() { exit_status=$1 @@ -367,9 +375,11 @@ EXPIRE|FAIL) # XXX Why add alias we just deleted above? add_new_alias if is_default_interface; then - if [ -f /etc/resolv.conf.save ]; then - cat /etc/resolv.conf.save > /etc/resolv.conf - fi +# ORIGINAL CODE: +# if [ -f /etc/resolv.conf.save ]; then +# cat /etc/resolv.conf.save > /etc/resolv.conf +# fi + fbsd_resolv_cleanup fi ;; @@ -396,6 +406,7 @@ TIMEOUT) fi eval "$IFCONFIG $interface inet -alias $new_ip_address $medium" delete_old_routes + fbsd_resolv_cleanup exit_with_hooks 1 ;; esac -- 1.5.3.8