Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

system/3135: dhclient-script doesn't update resolv.conf

From: <janj+openbsd(at)wenf.org>
Date: Sat Mar 08 2003 - 13:07:06 EST


>Number: 3135
net
>Environment:
        

	System      : OpenBSD 3.3
	Architecture: OpenBSD.i386
	Machine     : i386

>Description:
        
        When a DHCP server gives nameserver but no domain (like my ISP Telia) no
        resolv.conf is created.

>How-To-Repeat:
        

        Use dhclient to get a IP from a server that does not give a domain.
>Fix:
        

        Fix resolv.conf by hand or apply the following patch to dhclient-script
        which makes the nameserver list the important part.

Index: dhclient-script



RCS file: /cvs/src/usr.sbin/dhcp/dhclient/scripts/dhclient-script,v retrieving revision 1.11
diff -u -r1.11 dhclient-script
--- dhclient-script	2000/10/18 23:42:56	1.11
+++ dhclient-script	2003/03/08 17:54:13
@@ -76,19 +76,19 @@
     ifconfig $interface inet alias $alias_ip_address netmask $alias_subnet_mask
     route add $alias_ip_address 127.0.0.1
   fi
- if [ "x$new_domain_name" != "x" ];
+ if [ -n "$new_domain_name_servers" ];

    then
- if [ -n "$new_domain_name_servers" ]; + 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
-      if [ -f /etc/resolv.conf.tail ]; then
-	cat /etc/resolv.conf.tail >>/etc/resolv.conf
-      fi
-      exit 0
     fi
+    for nameserver in $new_domain_name_servers; do
+      echo nameserver $nameserver >>/etc/resolv.conf
+    done
+    if [ -f /etc/resolv.conf.tail ]; then
+      cat /etc/resolv.conf.tail >>/etc/resolv.conf
+ fi
+ exit 0

   fi
 fi  

@@ -147,21 +147,21 @@

 	  shift; shift
         done
       fi
-      if [ "$new_domain_name" != "" ]; then
-        if [ -n "$new_domain_name_servers" ]; then
+      if [ -n "$new_domain_name_servers" ]; then
+        if [ "$new_domain_name" != "" ]; then
           echo "search $new_domain_name" >/etc/resolv.conf.std
-          for nameserver in $new_domain_name_servers; do
-  	    echo "nameserver $nameserver" >>/etc/resolv.conf.std
-          done
-          if [ -f /etc/resolv.conf.tail ]; then
-	    cat /etc/resolv.conf.tail >>/etc/resolv.conf.std
-      	  fi
-          if [ -f /etc/resolv.conf ]; then
-	    rm -f /etc/resolv.conf
-          fi
-          mv /etc/resolv.conf.std /etc/resolv.conf
-          exit 0
         fi
+        for nameserver in $new_domain_name_servers; do
+  	  echo "nameserver $nameserver" >>/etc/resolv.conf.std
Do you need help?X
+ done + if [ -f /etc/resolv.conf.tail ]; then + cat /etc/resolv.conf.tail >>/etc/resolv.conf.std + fi + if [ -f /etc/resolv.conf ]; then + rm -f /etc/resolv.conf + fi + mv /etc/resolv.conf.std /etc/resolv.conf + exit 0 fi fi

   fi

>Release-Note:
Received on Sat Mar 8 13:16:21 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:51 EDT

Do you need more help?X

Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library