SVN: rc-scripts/trunk/sysconfig/network-scripts: functions.network ifdown ifup

glen glen at pld-linux.org
Mon Jan 22 20:10:06 CET 2007


Author: glen
Date: Mon Jan 22 20:10:05 2007
New Revision: 8192

Modified:
   rc-scripts/trunk/sysconfig/network-scripts/functions.network
   rc-scripts/trunk/sysconfig/network-scripts/ifdown
   rc-scripts/trunk/sysconfig/network-scripts/ifup
Log:
- be sure that dhcp client detection is same for ifup and ifdown

Modified: rc-scripts/trunk/sysconfig/network-scripts/functions.network
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/functions.network	(original)
+++ rc-scripts/trunk/sysconfig/network-scripts/functions.network	Mon Jan 22 20:10:05 2007
@@ -75,6 +75,28 @@
 	fi
 }
 
+set_dhcpclient()
+{
+	if [ "$BOOTPROTO" = "bootp" -o "$BOOTPROTO" = "pump" ]; then
+		DHCP_CLIENT=/sbin/pump
+	fi
+
+	if [ -z "$DHCP_CLIENT" ]; then
+		if [ -x /sbin/dhcpcd ]; then
+			DHCP_CLIENT=/sbin/dhcpcd
+		elif [ -x /sbin/dhclient ]; then
+			DHCP_CLIENT=/sbin/dhclient
+		elif [ -x /sbin/dhcpxd ]; then
+			DHCP_CLIENT=/sbin/dhcpxd
+		elif [ -x /sbin/pump ]; then
+			DHCP_CLIENT=/sbin/pump
+		else
+			nls "Can't find a dhcp client."
+			exit 1
+		fi
+	fi
+}
+
 # Setup Network Address Translation (NAT)
 setup_nat()
 {

Modified: rc-scripts/trunk/sysconfig/network-scripts/ifdown
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/ifdown	(original)
+++ rc-scripts/trunk/sysconfig/network-scripts/ifdown	Mon Jan 22 20:10:05 2007
@@ -59,31 +59,36 @@
 	fi
 fi
 
-if [ "$BOOTPROTO" = "bootp" -o "$BOOTPROTO" = "pump" ]; then
-	/sbin/pump -r -i ${DEVICE}
-	RESULT=$?
-fi
-
-if [ "$BOOTPROTO" = "dhcp" ]; then
-	if [ -x /sbin/dhcpcd ];then
-		/sbin/dhcpcd -k ${DEVICE}
-		RESULT=$?
-	elif [ -x /sbin/dhclient ];then
-		if [ -f /var/run/dhclient.pid ];then
-			PID=$(cat /var/run/dhclient.pid)
-			if ps ax --no-header|grep -q $PID;then
-				kill $PID
-				RESULT=$?
+if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; then
+	if is_yes "$IPV4_NETWORKING"; then
+		set_dhcpclient
+
+		case ${DHCP_CLIENT##*/} in
+		  pump)
+			/sbin/pump -r -i ${DEVICE}
+			RESULT=$?
+			;;
+		  dhcpcd)
+			/sbin/dhcpcd -k ${DEVICE}
+			RESULT=$?
+			;;
+		  dhcpxd)
+			/sbin/dhcpxd -k ${DEVICE}
+			RESULT=$?
+			;;
+		  dhclient)
+			if [ -f /var/run/dhclient.pid ];then
+				PID=$(cat /var/run/dhclient.pid)
+				if ps ax --no-header | grep -q $PID; then
+					kill $PID
+					RESULT=$?
+				fi
 			fi
-		fi
-	elif [ -x /sbin/dhcpxd ];then
-		/sbin/dhcpxd -k ${DEVICE}
-		RESULT=$?
-	elif [ -x /sbin/pump ];then
-		pump -r -i ${DEVICE}
-		RESULT=$?
+			;;
+		esac
+
+		sleep 1 # WHY?
 	fi
-	sleep 1
 fi
 
 if is_wireless_device "${DEVICE}"; then

Modified: rc-scripts/trunk/sysconfig/network-scripts/ifup
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/ifup	(original)
+++ rc-scripts/trunk/sysconfig/network-scripts/ifup	Mon Jan 22 20:10:05 2007
@@ -119,24 +119,7 @@
 
 if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; then
 	if is_yes "$IPV4_NETWORKING"; then
-		if [ "$BOOTPROTO" = "bootp" -o "$BOOTPROTO" = "pump" ]; then
-			DHCP_CLIENT=/sbin/pump
-		fi
-
-		if [ -z "$DHCP_CLIENT" ]; then
-			if [ -x /sbin/dhcpcd ]; then
-				DHCP_CLIENT=/sbin/dhcpcd
-			elif [ -x /sbin/dhclient ]; then
-				DHCP_CLIENT=/sbin/dhclient
-			elif [ -x /sbin/dhcpxd ]; then
-				DHCP_CLIENT=/sbin/dhcpxd
-			elif [ -x /sbin/pump ]; then
-				DHCP_CLIENT=/sbin/pump
-			else
-				nls "Can't find a dhcp client."
-				exit 1
-			fi
-		fi
+		set_dhcpclient
 
 		DHCP_ARGS=
 		if [ -n "$DHCP_CLIENT" ]; then


More information about the pld-cvs-commit mailing list