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
--- 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
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to