[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#328646: netcfg: Does not use manually entered domain name in /etc/resolv.conf



Hi Frans ;)

Here is the promised follow-up:

On Fri, Sep 16, 2005 at 05:24:21PM +0200, Frans Pop wrote:
> During a vmware installation after DHCP configuration, netcfg proposes
> "localhost" as domain name. If I delete that and enter my own domain
> name, that new name does not get used. Instead the "search" line in
> /etc/resolv.conf refers to localhost.
 
I tried to understand the flow of control in netcfg. Here is what I
turned up (or think I did ;)):

a) netcfg-static.c and netcfg-dhcp.c both contain main functions with 
   a subset of the functionality of netcfg.c. Why are those still in the 
   archive?

b) If using the DHCP method, control goes to netcfg_activate_dhcp. The
   state "DOMAIN" checks if the DHCP server returned a domain name. 
   If none was given, it calls netcfg_get_domain to retrieve a domain 
   name.

c) After figuring out the domain name it is only passed to the
   netcfg_write_common function which uses it solely for the generation
   of /etc/hosts. 

The /etc/resolv.conf is not written in the DHCP configuration. Which is
why it still has line

	search localdomain

after installation. 


I'd like to suggest to implement editing /etc/resolv.conf in case we got
a domain name during dhcp configuration. Normally the dhcp client will
update /etc/resolv.conf but if it does not get a domain name the search
instruction stays unchanged in the current implementation. 

As a minor nit-pick I suggest applying the following patch - there is no
much point in using a macro for the path of the resolv.conf if it is not
used consistently.


Index: dhcp.c
===================================================================
--- dhcp.c	(revision 30817)
+++ dhcp.c	(working copy)
@@ -568,7 +568,7 @@
 	FILE *f;
 	int count = 0;
 
-	if ((f = fopen("/etc/resolv.conf", "r")) != NULL)
+	if ((f = fopen(RESOLV_FILE, "r")) != NULL)
 	{
 		char buf[256];
 

Greetings

	Torsten

Attachment: signature.asc
Description: Digital signature


Reply to: