Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 2003 14:50:22 +0200 (CEST)
From:      Martin Blapp <mb@imp.ch>
To:        Mark Sergeant <msergeant@snsonline.net>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Problem with dhclient & wi0 on resume.
Message-ID:  <20030812143805.S2686@cvs.imp.ch>
In-Reply-To: <1060689669.912.18.camel@xyzzy.wireless.snsonline.net>
References:  <20030812104605.G2686@cvs.imp.ch> <1060684879.912.2.camel@xyzzy.wireless.snsonline.net> <1060689669.912.18.camel@xyzzy.wireless.snsonline.net>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-1172550694-1060692622=:2686
Content-Type: TEXT/PLAIN; charset=US-ASCII


Hi,

Can you please try the attached patch ? There was one mayor
typo ...

- for _if in _active_list ; do
+ for _if in ${_active_list} ; do

I also found two other bugs. And there is still one
if we get 2 pccards at the same time configured with dhcp.
But I think this setting is used very rarly.

Martin

--- etc/pccard_ether	Tue Aug 12 14:14:13 2003
+++ etc/pccard_ether	Tue Aug 12 14:43:31 2003
@@ -8,48 +8,55 @@
 #

 stop_dhcp() {
+	# If dhclient is already running, record
+	# it's interfaces.
+	if [ -x /usr/bin/grep ]; then
+		eval _active_list=\"`/bin/ps -axwww | \
+			/usr/bin/grep dhclient | \
+			/usr/bin/grep -v grep | \
+			/usr/bin/sed -e 's|^.*dhclient||' | \
+			/usr/bin/awk '{for (i=1;i<=NF;i++) \
+				{ if ($i~/[a-zA-Z].[0-9]$/) \
+				{ printf(" %s",$i) } }}'` \
+			\"
+	fi
+
+	_aprefix=
+	for _if in ${_active_list} ; do
+		_test_if=`ifconfig ${_if} 2>&1`
+		case "$_test_if" in
+		"ifconfig: interface $_if does not exist")
+			;;
+		${interface})
+			# Don't record the same device twice.
+			;;
+		*)
+			_dhcplist="${_dhcplist}${_aprefix}${_if}"
+			[ -z "$_aprefix" ] && _aprefix=' '
+			;;
+		esac
+	done
 	if [ -s /var/run/dhclient.${interface}.pid ]; then
 		pidfile="/var/run/dhclient.${interface}.pid"
 	elif [ -s /var/run/dhcpc.${interface}.pid ]; then
 		pidfile="/var/run/dhcpc.${interface}.pid"
 	elif [ -s /var/run/dhclient.pid ]; then
-		# If dhclient is already running, record
-		# it's interfaces.
-		if [ -x /usr/bin/grep ]; then
-			eval _active_list=\"`/bin/ps -axwww | \
-				/usr/bin/grep dhclient | \
-				/usr/bin/grep -v grep | \
-				/usr/bin/sed -e 's|^.*dhclient||' | \
-				/usr/bin/awk '{for (i=1;i<=NF;i++) \
-					{ if ($i~/[a-zA-Z].[0-9]$/) \
-					{ printf(" %s",$i) } }}'` \
-				\"
-		fi
-
-		_aprefix=
-		for _if in _active_list ; do
-			_test_if=`ifconfig ${_if} 2>&1`
-			case "$_test_if" in
-			"ifconfig: interface $_if does not exist")
-				;;
-			*)
-				_dhcplist="${_dhcplist}${_aprefix}${_if}"
-				[ -z "$_aprefix" ] && _aprefix=' '
-				;;
-			esac
-		done
-
 		pidfile="/var/run/dhclient.pid"
 	else
 		return
 	fi
 	kill `cat ${pidfile}`
 	rm -f ${pidfile}
-	sh `/etc/rc.d/dhclient start`
+	case ${startstop} in
+	[Ss][Tt][Oo][Pp])
+		sh `/etc/rc.d/dhclient start`
+		;;
+	*)
+		;;
+	esac
 }

 start_dhcp() {
-	stop_dhcp
 	case ${pccard_ether_delay} in
 	[Nn][Oo])
 		;;
@@ -57,6 +64,7 @@
 		sleep ${pccard_ether_delay}
 		;;
         esac
+	stop_dhcp
 	[ -n "$dhcp_program" ] && dhclient_program="$dhcp_program"
 	[ -n "$dhcp_flags" ] && dhclient_flags="$dhcp_flags"
 	if [ -x "${dhclient_program}" ]; then
--0-1172550694-1060692622=:2686
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=patch3
Content-Transfer-Encoding: BASE64
Content-ID: <20030812145022.O2686@cvs.imp.ch>
Content-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