Bug 102394 - [dhclient] resolv.conf issue
[dhclient] resolv.conf issue
Product: Red Hat Linux
Classification: Retired
Component: dhcp (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Walsh
: FutureFeature
Depends On:
  Show dependency treegraph
Reported: 2003-08-14 14:20 EDT by Dan Morrill
Modified: 2007-04-18 12:56 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-22 15:07:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dan Morrill 2003-08-14 14:20:49 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030625
Mozilla Firebird/0.6

Description of problem:
*Note: this is not a bug in dhcp, this is a bug in dhclient. However,
there appears to be no dhclient package in the Bugzilla list, so I
chose this as a best guess.*

When dhclient updates /etc/resolv.conf, it overwrites whatever is there
with no opportunity to include or preserve any of its contents. In
some cases, network admins set up DHCP systems to exist in a separate
subdomain:  e.g. if the organization's domain is "somedomain.tld",
then they might use "foo.somedomain.tld" for static IP addresses, and
"foo.dhcp.somedomain.tld" for DHCP-assigned addresses.  In this case,
/etc/resolv.conf should include "search" entries for both
"somedomain.tld" and "dhcp.somedomain.tld".  However,
/sbin/dhclient-script will only add "somedomain.tld".

See the attached patch, which is a trivial modification to
/sbin/dhclient-script to include the contents of
/etc/sysconfig/resolv.conf in /etc/resolv.conf, if and only if the
file in sysconfig exists.  Please include this patch or another like
it in the next build of dhclient RPM.

Thanks! - Dan Morrill

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. echo "search dhcp.somedomain.tld" >> /etc/resolv.conf
2. ifdown eth0; ifup eth0 # if eth0 is a DHCP interface
3. observe that dhcp.somedomain.tld is no longer in resolv.conf

Actual Results:  /sbin/dhclient-script overwrites /etc/resolv.conf w/ no
mechanism to include arbitrary lines in it.

Expected Results:  There needs to be a way to include persistent lines in
/etc/resolv.conf (esp. "search" entries.)

Additional info:

--- dhclient-script     2003-08-14 13:55:42.000000000 -0400
+++ /sbin/dhclient-script       2003-08-14 13:56:34.000000000 -0400
@@ -24,6 +24,9 @@
 function make_resolv_conf() {
   if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
     echo '; generated by /sbin/dhclient-script' > /etc/resolv.conf
+    if [ -f /etc/sysconfig/resolv.conf ]; then
+       cat /etc/sysconfig/resolv.conf >> /etc/resolv.conf
+    fi
     if [ -n "$new_domain_name" ]; then
        echo search $new_domain_name >> /etc/resolv.conf
Comment 1 Daniel Walsh 2003-08-22 15:07:25 EDT
Instead of adding your patch I added a variable SEARCH that can be set in the
ifcfg-* file.  If this is set then it will be added to the /etc/resolv.conf, 
otherwise it will work as it currently does.

So if you were using eth0 you could add the following to it
SEARCH="somedomain.tld foo.dhcp.somedomain.tld"

Available in dhcp-3.0pl2-6.13.src.rpm.
Comment 2 John Flanagan 2004-12-21 14:42:20 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.