Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2002 22:06:04 +0000
From:      Ceri <setantae@submonkey.net>
To:        "brian j. peterson" <rbw@myplace.org>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/34455: [PATCH] /sbin/dhclient-script overwrites /etc/resolv.conf without any relevant information
Message-ID:  <20020130220604.GA1174@rhadamanth>
In-Reply-To: <200201302110.g0ULA2394068@freefall.freebsd.org>
References:  <200201302110.g0ULA2394068@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 30, 2002 at 01:10:02PM -0800, brian j. peterson wrote:
> 
>  On Wed, Jan 30, 2002 at 06:28:07PM +0000, Ceri wrote:
>  > Strikes me as pilot error to be honest.
>  > If the DCHP server doesn't provide nameservers, and you're not overriding them,
>  > then you'll end up with nothing there.
>  > 
>  > If you wish to insert some information into /etc/resolv.conf,
>  > that's what the supersede statement in dhclient.conf is for, viz.
>  > 
>  > # cat /etc/dhclient.conf
>  > interface "ed0" {
>  > 	supersede domain-name "private.submonkey.net";
>  > 	prepend domain-name-servers 192.168.10.1;
>  > }
>  
>  admittedly, there are ways around this problem, but the fact is that
>  dhclient-script is overwriting /etc/resolv.conf regardless of whether
>  or not it has useful data to write to it.

I can't think of one, but it's feasible that administrators would want this
to happen in certain situations.

DHCP could be used as a method of rolling out changes, and while I can't
think why anybody would want to do this, that doesn't mean that nobody does.

>  my trivial patch solves this
>  problem by not writing to /etc/resolv.conf if there's no reason to.

No, it doesn't write to /etc/resolv.conf if there are no nameservers.
That's not quite the same thing.

>  i prefer, at this point, to create my own /etc/resolv.conf, and since i'm
>  not requesting any domain-name or domaina-name-servers information,

If your machine needs DNS servers to function on the network, then you should
probably request them, or use the supersede modifier.

>  i
>  don't think dhclient-script has any business overwriting /etc/resolv.conf
>  with "search \n".
>  
>  am i wrong to expect this script to not clobber important files with
>  useless information?

I don't know.
I think a modification like this should really be done locally in
/etc/dhclient-enter-hooks, as per dhclient-script.5 :

       When  it  starts,  the client script first defines a shell
       function, make_resolv_conf , which is later used to create
       the  /etc/resolv.conf  file.    To  override  the  default
       behaviour,  redefine  this  function  in  the  enter  hook
       script.

This opinion is mainly formed due to the difference in our perceptions of
what the patch actually does.  It suits your position, but it's not friendly
to anyone who might want to roll out empty /etc/resolv.conf's for whatever
reason.

Ceri

-- 
keep a mild groove on

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020130220604.GA1174>