*** From dhcp-client -- To unsubscribe, see the end of this message. ***

> > What would you think of using this technique (in the client script)?
> > Is it non-compliant in some way?
>
> It's fine to do that.

Following patch implements it in the linux client script using
your make_resolv_conf() technique. I don't dare to patch all the
other scripts. Would be a good idea to combine all the different
scripts to one via using functions for different logical steps?
So this change would be needed in one place only.

And as I still use linux 2.0.x this patch implements "TIMEOUT needs
routing setup *before* ping'ing" and a "ping -w 1" replacement.
  louis

--- ../orig/client/scripts/linux
+++ ./client/scripts/linux
@@ -15,12 +15,18 @@
 # I'm just going by the doc of modern Linux ip aliasing, which uses
 # notations like eth0:0, eth0:1, for each alias.

-# 3. I have to calculate the network address, and calculate the broadcast
-# address if it is not supplied. This might be much more easily done
-# by the dhclient C code, and passed on.
-
-# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious
-# of the $1 in its args.
+make_resolv_conf() {
+  domain=$new_domain_name
+  search=$new_domain_name
+  while [ :"${domain%.*.*}" != :"$domain" ]; do
+    domain="${domain#*.}"
+    search="$search $domain"
+  done
+  echo search $search >/etc/resolv.conf
+  for nameserver in $new_domain_name_servers; do
+    echo nameserver $nameserver >>/etc/resolv.conf
+  done
+}

 # Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
 function exit_with_hooks() {
@@ -127,10 +133,7 @@
     ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
     route add -host $alias_ip_address $interface:0
   fi
-  echo search $new_domain_name >/etc/resolv.conf
-  for nameserver in $new_domain_name_servers; do
-    echo nameserver $nameserver >>/etc/resolv.conf
-  done
+  make_resolv_conf
   exit_with_hooks 0
 fi

@@ -156,29 +165,22 @@
   fi
   ifconfig $interface inet $new_ip_address $new_subnet_arg \
                                        $new_broadcast_arg
+  if [ $relmajor -lt 2 ] || ([ $relmajor -eq 2 ] && [ $relminor -eq 0 ]); then
+    route add -net $new_network_number
+  fi
   set $new_routers
-  ############## what is -w in ping?
-  if ping -q -c 1 $1; then
+  ping -q -c 1 $1 >/dev/null & ping=$!
+  (sleep 1; kill $ping 2>/dev/null) &
+  if wait $ping 2>/dev/null; then
     if [ x$new_ip_address != x$alias_ip_address ] && \
                        [ x$alias_ip_address != x ]; then
       ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
       route add -host $alias_ip_address dev $interface:0
     fi
-    if [ $relmajor -lt 2 ] || \
-               ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
-      route add -net $new_network_number
-    fi
     for router in $new_routers; do
       route add default gw $router
     done
-    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 ]; then
-      rm -f /etc/resolv.conf
-      ln /etc/resolv.conf.std /etc/resolv.conf
-    fi
+    make_resolv_conf
     exit_with_hooks 0
   fi
   ifconfig $interface inet down
--
J�rgen Fluk
marco Systemanalyse und Entwicklung GmbH    Tel   +49 8131 5161-42
Hans-B�ckler-Str. 2, D 85221 Dachau         Fax   +49 8131 5161-66
http://www.marco.de/                        Email [EMAIL PROTECTED]


------------------------------------------------------------------------------
To unsubscribe from this list, please visit http://www.fugue.com/dhcp/lists
If you are without web access, or if you are having trouble with the web page,
please send mail to [EMAIL PROTECTED]   Please try to use the web
page first - it will take a long time for your request to be processed by hand.

Archives for this mailing list are available at 
http://www.webnology.com/list-archives/dhcp/dhcp-client

------------------------------------------------------------------------------

Reply via email to