From owner-freebsd-current@FreeBSD.ORG Thu Apr 24 10:33:31 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3CFB1065675; Thu, 24 Apr 2008 10:33:31 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5DA8FC1C; Thu, 24 Apr 2008 10:33:31 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Message-ID:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender:X-Spam-Status:Subject; b=QXU3pZNPvAlaa5brD8WxBxUixxovD8uUXnioDX7OuAJYf01VDb31CB0uF5EiUC3x1wE4fmMbOzvOXwwvV6sp801vBq+Nf8n2e52NUgDnE4MsmhI+A3SWPvCYu4tOmT0T4XLd8mpWwhfK4zi7ZX0DuWpPJdjZj1dbM9SmIKo6Ypo=; Received: from amnesiac.at.no.dns ([144.206.182.200]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1Joyld-000HE4-PY; Thu, 24 Apr 2008 14:33:30 +0400 Date: Thu, 24 Apr 2008 14:33:42 +0400 From: Eygene Ryabinkin To: Brooks Davis , Poul-Henning Kamp Message-ID: <1c//E09PwcrmYHrh0OAiDbxOxqg@EEu6nkWAZTlxOp7ENdKMY8AImHg> References: <5f67a8c40804141026s27672065sb11a7f327572c0f2@mail.gmail.com> <5f67a8c40804141044v69557b92w7db0b272d6b9b848@mail.gmail.com> <3BdnONI1bT08mgV1Is+vnPQaMNw@OG4t+/sM8WGI7cjjTW4/N4fcF6w> <20080421162612.GA19629@lor.one-eyed-alien.net> <20080422204510.GB34198@lor.one-eyed-alien.net> <+rkPaEJgDwWM+WmNdLneOfPN6Ps@sTlCVUsSEVReKIVdz1gJKNXWeKE> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="jy6Sn24JjFx/iggw" Content-Disposition: inline In-Reply-To: Sender: rea-fbsd@codelabs.ru X-Spam-Status: No, score=-1.8 required=4.0 tests=ALL_TRUSTED,AWL,BAYES_40 Cc: Zaphod Beeblebrox , freebsd-current@freebsd.org Subject: Re: [RFC] Automated generation of /etc/resolv.conf from the rc.d script X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Apr 2008 10:33:31 -0000 --jy6Sn24JjFx/iggw Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Brooks, good day. Wed, Apr 23, 2008 at 07:03:26PM +0400, Eygene Ryabinkin wrote: > Wed, Apr 23, 2008 at 06:36:17PM +0400, Eygene Ryabinkin wrote: > > > This looks like useful functionality to me. I have't had time to dig in > > > in detail. Could you please submit it as a PR so it doesn't get lost? > > > > OK, will do. > > Submitted, http://www.freebsd.org/cgi/query-pr.cgi?pr=123015 I had added some FreeBSD-specific cleanup hooks. The patch is attached. I am not currently putting it to the PR, since it is just newbord and needs some testing. Opinions are more than welcome! -- Eygene --jy6Sn24JjFx/iggw Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="resolv.4.patch" >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 --jy6Sn24JjFx/iggw--