Date: Wed, 30 Jan 2002 10:12:04 -0700 From: "brian j. peterson" <rbw@myplace.org> To: FreeBSD-gnats-submit@freebsd.org Cc: "brian j. peterson" <rbw@myplace.org> Subject: misc/34455: [PATCH] /sbin/dhclient-script overwrites /etc/resolv.conf without any relevant information Message-ID: <20020130101203.A551@malkavian.org>
next in thread | raw e-mail | index | archive | help
>Number: 34455 >Category: misc >Synopsis: [PATCH] /sbin/dhclient-script overwrites /etc/resolv.conf without any relevant information >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jan 30 09:20:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: "brian j. peterson" <rbw@myplace.org> >Release: FreeBSD 4.5-PRERELEASE alpha >Organization: >Environment: System: FreeBSD nikita 4.5-PRERELEASE FreeBSD 4.5-PRERELEASE #7: Sun Jan 6 17:14:40 MST 2002 root@nikita:/usr/obj/usr/src/sys/HARLOT alpha >Description: With the following /etc/dhclient.conf, I am not requesting a domain-name or domain-name-servers, but '/sbin/dhclient de0' still overwrites my /etc/resolv.conf. root@nikita% cat /etc/dhclient.conf interface "de0" { send host-name "nikita"; request subnet-mask, broadcast-address, routers; } root@nikita% cat /etc/resolv.conf search root@nikita% Basically, the make_resolv_conf() portion of /sbin/dhclient-conf is overwriting /etc/resolv.conf despite the fact that it has no useful information to write to it. >How-To-Repeat: 1) define a custom /etc/resolv.conf 2) start /sbin/dhclient on an interface configured without any 'domain-name' or 'domain-name-servers' options defined in any 'require' or 'request' statements. 3) observe that /etc/resolv.conf has been overwritten >Fix: Modify the make_resolv_conf() portion of /sbin/dhclient like so: root@nikita% diff -u /sbin/dhclient-script_1.9.2.4 /sbin/dhclient-script_new --- /sbin/dhclient-script_1.9.2.4 Mon Jan 7 17:29:01 2002 +++ /sbin/dhclient-script_new Tue Jan 29 18:54:04 2002 @@ -9,10 +9,12 @@ fi make_resolv_conf() { - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ x$new_domain_name != x ]; then + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + fi } # Must be used on exit. Invokes the local dhcp client exit hooks, if any. The above diff is based on $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.9.2.4 2001/03/05 10:09:32 obrien Exp $ but can easily be applied to -CURRENT (v 1.19) and then MFC'd at a later date. >Release-Note: >Audit-Trail: >Unformatted: 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?20020130101203.A551>