Make pccard.ether working if there is already a dhclient running

Martin Blapp mb at imp.ch
Sat Aug 9 01:35:33 PDT 2003


Here is a simplified patch. It should work too if dhclient
has been manually started, or if more than one pccard device
has been used.

--- /etc/pccard_ether	Thu Jun 26 04:44:08 2003
+++ /etc/pccard_ether	Sat Aug  9 10:29:52 2003
@@ -10,13 +10,23 @@
 stop_dhcp() {
 	if [ -s /var/run/dhclient.${interface}.pid ]; then
 		pidfile="/var/run/dhclient.${interface}.pid"
+		restart="/etc/rc.d/dhclient start"
 	elif [ -s /var/run/dhcpc.${interface}.pid ]; then
 		pidfile="/var/run/dhcpc.${interface}.pid"
+		restart="/etc/rc.d/dhclient start"
+	elif [ -s /var/run/dhclient.pid ]; then
+		eval _cooked_list=\"`/bin/ps -xwwww | \
+			/usr/bin/grep dhclient | \
+			/usr/bin/grep -v grep | \
+			/usr/bin/sed -e 's|^.*dhclient||'`\"
+		pidfile="/var/run/dhclient.pid"
+		restart=""
 	else
 		return
 	fi
 	kill `cat ${pidfile}`
 	rm -f ${pidfile}
+	sh `$restart`
 }

 start_dhcp() {
@@ -35,7 +44,7 @@
 			pidfile="/var/run/dhclient.${interface}.pid"
 			dhclient_flags="${dhclient_flags} -pf ${pidfile}"
 		fi
-		${dhclient_program} ${dhclient_flags} ${interface}
+		${dhclient_program} ${dhclient_flags} $_cooked_list ${interface}
 	else
 		echo "${dhclient_program}: DHCP client software not available"
 	fi


More information about the freebsd-mobile mailing list