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

My solution for a dhcp client.



I have attached a patch for my changes to /etc/rc.conf and
/etc/netstart.  I just put rc.conf back to what it was before removing
dhcp_client and I changed /etc/netstart to evaluate a new flag in
/etc/hostname.*.

For my interface that is configure via dhcp I have made the file
/etc/hostname.ep0 which looks like
---
dhcp foo
---

I don't know if this is a 'correct' format for this file but its rather
trivial to change for now.

This patch correctly sets up ep0 (my dhcp interface) and configures my
other interface via hostname.ed0.

I am still unsure of what to put in /etc/hosts for the hostname that is
configure via dhclient, I am currently just using 127.0.0.1.

Jason
jbi130_(_at_)_mail_(_dot_)_usask_(_dot_)_ca

Index: src/etc/netstart
===================================================================
RCS file: /cvs/src/etc/netstart,v
retrieving revision 1.41
diff -u -r1.41 netstart
--- netstart	1998/09/08 20:26:41	1.41
+++ netstart	1998/09/08 23:48:18
@@ -38,10 +38,6 @@
 route -n add -host $hostname localhost
 route -n add -net 127 127.0.0.1 -reject
 
-if [ "X${dhcp_client}" != X"NO" ]; then
-# Do DHCP discovery
-      dhclient ${dhcp_client}
-else
 # configure all of the non-loopback interfaces which we know about.
 # do this by reading /etc/hostname.* files, where * is the name
 # of a given interface.
@@ -65,7 +61,7 @@
 # the only required contents of the file are the addr_family field
 # and the hostname.
 
-    (
+(
     tmp="$IFS"
     IFS="$IFS."
     set -- `echo /etc/hostname*`
@@ -78,34 +74,38 @@
             read af name mask bcaddr extras
             read dt dtaddr
 
+	    # check to see if device should be configure by dhcp
             if [ ! -n "$name" ]; then
                 echo "/etc/hostname.$1: invalid network configuration file"
                 exit
             fi
 
-	    cmd="ifconfig $1 $af $name "
-	    if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
-	    if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
-	    if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
-		cmd="$cmd broadcast $bcaddr";
+	    if [ "$af" = "dhcp" ]; then cmd="/sbin/dhclient $1";
+	    else
+
+	      cmd="ifconfig $1 $af $name "
+	      if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
+	      if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
+	      if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
+ 		  cmd="$cmd broadcast $bcaddr";
+ 	      fi
+	      cmd="$cmd $extras";
 	    fi
-	    cmd="$cmd $extras"
 
 	    $cmd
         ) < /etc/hostname.$1
         shift
     done
-    )
+)
 
 # /etc/mygate, if it exists, contains the name of my gateway host
 # that name must be in /etc/hosts.
-    if [ -f /etc/mygate ]; then
+if [ -f /etc/mygate ]; then
 	route -n add -host default `cat /etc/mygate`
 
 	# default multicast route for hosts with a gateway
 	route -n add -net 224.0.0.0 -interface default
-    else
+else
 	# default multicast route
 	route -n add -net 224.0.0.0 -interface $hostname
-    fi
 fi
Index: src/etc/rc.conf
===================================================================
RCS file: /cvs/src/etc/rc.conf,v
retrieving revision 1.28
diff -u -r1.28 rc.conf
--- rc.conf	1998/09/08 20:26:42	1.28
+++ rc.conf	1998/09/08 23:48:18
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$OpenBSD: rc.conf,v 1.27 1998/08/25 18:19:41 marc Exp $
+#	$OpenBSD: rc.conf,v 1.28 1998/09/08 20:26:42 marc Exp $
 
 # set these to "NO" to turn them off.  otherwise, they're used as flags
 routed_flags=NO		# for 'normal' use: routed_flags="-q"
@@ -17,7 +17,6 @@
 httpd_flags=NO		# for 'normal' use: httpd_flags=""
 apmd_flags=NO		# for 'normal' use: apmd_flags=""
 dhcpd_flags=NO		# for 'normal' use: dhcpd_flags="-q"
-dhcp_client=NO		# for 'normal' use: dhcp_client=""
 
 # On some architectures, you must also disable console getty in /etc/ttys
 xdm_flags=NO		# for 'normal' use: xdm_flags=""

Visit your host, monkey.org