Date: Thu, 24 Apr 2008 14:33:42 +0400 From: Eygene Ryabinkin <rea-fbsd@codelabs.ru> To: Brooks Davis <brooks@freebsd.org>, Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: Zaphod Beeblebrox <zbeeble@gmail.com>, freebsd-current@freebsd.org Subject: Re: [RFC] Automated generation of /etc/resolv.conf from the rc.d script Message-ID: <1c//E09PwcrmYHrh0OAiDbxOxqg@EEu6nkWAZTlxOp7ENdKMY8AImHg> In-Reply-To: <//LLogkgEnHGVznhJnwikQVgeSo@skZTTMr9CXpka0xr7hHsh%2Bc5lEU> References: <5f67a8c40804141026s27672065sb11a7f327572c0f2@mail.gmail.com> <H5MGge8Nl5z81vYo/6CbS41wm2w@BBB3ZKOzjjN0cxeKaWhgH87x7VY> <5f67a8c40804141044v69557b92w7db0b272d6b9b848@mail.gmail.com> <3BdnONI1bT08mgV1Is%2BvnPQaMNw@OG4t%2B/sM8WGI7cjjTW4/N4fcF6w> <bQ7Kv28g8j5/M0RtG5zJuY9QcZY@eQI4H8/UJdAjemYIic%2B%2BkxoAYfE> <20080421162612.GA19629@lor.one-eyed-alien.net> <zelmr/%2B4w7jJ6i0JlwWDAK5xDxU@EEu6nkWAZTlxOp7ENdKMY8AImHg> <20080422204510.GB34198@lor.one-eyed-alien.net> <%2BrkPaEJgDwWM%2BWmNdLneOfPN6Ps@sTlCVUsSEVReKIVdz1gJKNXWeKE> <//LLogkgEnHGVznhJnwikQVgeSo@skZTTMr9CXpka0xr7hHsh%2Bc5lEU>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <rea-fbsd@codelabs.ru> 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 <rea-fbsd@codelabs.ru> --- 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1c//E09PwcrmYHrh0OAiDbxOxqg>