PERFORCE change 66272 for review

Sam Leffler sam at FreeBSD.org
Thu Dec 2 12:35:41 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=66272

Change 66272 by sam at sam_ebb on 2004/12/02 20:34:48

	revamp for new world order

Affected files ...

.. //depot/projects/wifi/etc/rc.d/dhclient#2 edit

Differences ...

==== //depot/projects/wifi/etc/rc.d/dhclient#2 (text+ko) ====

@@ -1,13 +1,13 @@
 #!/bin/sh
 #
 # $NetBSD: dhclient,v 1.8 2002/03/22 04:33:58 thorpej Exp $
-# $FreeBSD: src/etc/rc.d/dhclient,v 1.17 2004/10/07 13:55:25 mtm Exp $
+# $FreeBSD: src/etc/rc.d/dhclient,v 1.16 2004/05/20 14:16:04 mtm Exp $
 #
 
 # PROVIDE: dhclient
 # REQUIRE: netif ipfw ipfilter mountcritlocal
 # BEFORE:  NETWORKING
-# KEYWORD: nojail
+# KEYWORD: FreeBSD nojail
 #
 #	Note that there no syslog logging of dhclient messages at boot because
 #	dhclient needs to start before services that syslog depends upon do.
@@ -20,9 +20,8 @@
 rcvar=
 pidfile="/var/run/${name}.pid"
 start_precmd="dhclient_prestart"
-start_postcmd="dhclient_poststart"
-stop_precmd="dhclient_prestop"
-stop_postcmd="dhclient_poststop"
+start_cmd="dhclient_start"
+stop_cmd="dhclient_stop"
 
 dhclient_common()
 {
@@ -47,67 +46,45 @@
 	if [ $dhclient_common_error -eq 1 ]; then
 		return 1
 	fi
-	for ifn in ${_cooked_list}; do
-		ifscript_up ${ifn}
-	done
 
 	if checkyesno background_dhclient; then
-		rc_flags="${rc_flags} -nw"
+		rc_flags="${rc_flags} -b"
 	fi
 
-	rc_flags="${rc_flags} ${_cooked_list}"
 	return 0
 }
 
-dhclient_poststart()
+dhclient_start()
 {
 	for ifn in ${_cooked_list}; do
+		ifscript_up ${ifn}
+
+		${dhclient_program} ${rc_flags} $ifn > /dev/null 2>&1
+
 		ifalias_up ${ifn}
 		ipx_up ${ifn}
-		ifconfig ${ifn}
+
+		checkyesno background_dhclient || ifconfig ${ifn}
 	done
 }
 
-dhclient_prestop()
+dhclient_stop()
 {
 	if [ $dhclient_common_error -eq 1 ]; then
 		return 1
 	fi
 	for ifn in ${_cooked_list}; do
+		ifconfig $ifn down		# signal dhclient
+
 		ipx_down ${ifn}
 		ifalias_down ${ifn}
-	done
-	echo -n "Releasing DHCP leases:"
-	for ifn in $_cooked_list ; do
-		${command} -r $ifn
-		if [ $? -eq 0 ]; then
-			echo -n " $ifn"
-		else
-			_fail="$_fail $ifn"
-		fi
-	done
-	echo '.'
-	debug "The following leases failed to release: $_fail"
-}
+		ifconfig_down ${ifn}
 
-dhclient_poststop()
-{
-	for ifn in ${_cooked_list}; do
 		ifscript_down ${ifn}
 	done
 }
 
-if [ -n "$2" ]; then
-	_cmdifn="$2"
-	stop_cmd=":"
-fi
-
 load_rc_config $name
 dhclient_common_error=0
 dhclient_common || dhclient_common_error=1;
-if [ -n "$_cooked_list" ]; then
-	if [ -s $pidfile ]; then
-		stop_cmd=":"
-	fi
-fi
 run_rc_command "$1"


More information about the p4-projects mailing list