Module Name:    src
Committed By:   roy
Date:           Thu May 14 15:33:36 UTC 2009

Modified Files:
        src/etc/rc.d: network

Log Message:
Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/4030


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/etc/rc.d/network

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.d/network
diff -u src/etc/rc.d/network:1.57 src/etc/rc.d/network:1.58
--- src/etc/rc.d/network:1.57	Sat Oct 11 17:28:03 2008
+++ src/etc/rc.d/network	Thu May 14 15:33:36 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.57 2008/10/11 17:28:03 christos Exp $
+# $NetBSD: network,v 1.58 2009/05/14 15:33:36 roy Exp $
 #
 
 # PROVIDE: network
@@ -36,7 +36,9 @@
 		# DHCP later, as we will probably get the
 		# hostname at that time.
 		#
-		if ! checkyesno dhclient && [ -z "$(hostname)" ]; then
+		if ! checkyesno dhclient && ! checkyesno dhcpcd && \
+			[ -z "$(hostname)" ]
+		then
 			warn "\$hostname not set."
 		fi
 	fi
@@ -266,7 +268,10 @@
 					( eval "${args#*!}" )
 					;;
 				dhcp)
-					/sbin/dhcpcd -n ${dhcpcd_flags} $int
+					if ! checkyesno dhcpcd; then
+						/sbin/dhcpcd -n \
+							${dhcpcd_flags} $int
+					fi
 					;;
 				*)
 					# Pass args to ifconfig.  Note
@@ -442,7 +447,9 @@
 			eval args=\$ifconfig_$int
 			if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
 				echo -n " $int"
-				/sbin/dhcpcd -k $int 2> /dev/null
+				if [ -f /var/run/dhcpcd-$int.pid ]; then
+					/sbin/dhcpcd -k $int 2> /dev/null
+				fi
 				/sbin/ifconfig $int down
 				if /sbin/ifconfig $int destroy 2>/dev/null && \
 				   checkyesno ipfilter; then
@@ -462,5 +469,6 @@
 
 load_rc_config $name
 load_rc_config_var dhclient dhclient
+load_rc_config_var dhcpcd dhcpcd
 load_rc_config_var ipfilter ipfilter
 run_rc_command "$1"

Reply via email to