Bug 102394

Summary: [dhclient] resolv.conf issue
Product: [Retired] Red Hat Linux Reporter: Dan Morrill <morrildl>
Component: dhcpAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-22 19:07:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Morrill 2003-08-14 18:20:49 UTC
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:
Always

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
     fi

Comment 1 Daniel Walsh 2003-08-22 19:07:25 UTC
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 19:42:20 UTC
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.

http://rhn.redhat.com/errata/RHBA-2004-566.html