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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
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
[-- Attachment #2 --]
--- 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
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030812143805.S2686>
