From sanpei@sanpei.org Fri Mar 12 20:34:27 1999
Return-Path: <sanpei@sanpei.org>
Received: from titanium.yy.ics.keio.ac.jp (titanium.yy.ics.keio.ac.jp [131.113.47.73])
	by hub.freebsd.org (Postfix) with ESMTP id 3226414E32
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 12 Mar 1999 20:34:17 -0800 (PST)
	(envelope-from sanpei@sanpei.org)
Received: from lavender.sanpei.org (u4157.seaple.icc.ne.jp [203.140.32.157])
	by titanium.yy.ics.keio.ac.jp (8.8.8+3.0Wbeta13/3.7W) with ESMTP id NAA16233;
	Sat, 13 Mar 1999 13:33:26 +0900 (JST)
Received: (from sanpei@localhost)
	by lavender.sanpei.org (8.9.2/3.7W) id NAA74076;
	Sat, 13 Mar 1999 13:33:37 +0900 (JST)
Message-Id: <199903130433.NAA74076@lavender.sanpei.org>
Date: Sat, 13 Mar 1999 13:33:37 +0900 (JST)
From: sanpei@sanpei.org
Reply-To: sanpei@sanpei.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: fix dhcpc problem on /etc/pccard_ether
X-Send-Pr-Version: 3.2

>Number:         10566
>Category:       misc
>Synopsis:       patch dhcpc problem on /etc/pccard_ether
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 12 20:40:00 PST 1999
>Closed-Date:    Fri Nov 10 09:17:51 PST 2000
>Last-Modified:  Fri Nov 10 09:18:20 PST 2000
>Originator:     MIHIRA Yoshiro
>Release:        FreeBSD 3.1-RELEASE i386
>Organization:
Keio Univ.
>Environment:

	3.1-RELEASE + PCCARD + wide-dhcp client

>Description:

	When reload PCCARD ethernet card, /etc/pccard_ether kill
	old dhcpc process and restart dhcpc.
	But current /etc/pccard_ether code can't kill dhcpc process.
	
	Because
		pccard_ether use /var/run/dhcpc.pid file for
		process ID.
	   but, latest wide-dhcp creates /var/run/dhcpc.[interfacename].pid.
		This change was from Apr,4,1997.
		See ports/net/wide-dhcp/patches/patch-as rev.1.2.
		and now this patch is imported to original WIDE-dhcp source.

	So I hope to change /etc/pccard_ether as below.

>How-To-Repeat:


>Fix:
	
apply to src/etc/pccard_ether or /etc/pccard_ether

--- pccard_ether.org	Sat Mar 13 13:06:26 1999
+++ pccard_ether	Sat Mar 13 13:07:52 1999
@@ -23,9 +23,9 @@
 		    fi
 		    /usr/local/sbin/dhclient
 		elif [ -f /usr/local/sbin/dhcpc ] ; then
-		    if [ -s /var/run/dhcpc.pid ] ; then
-		        kill `cat /var/run/dhcpc.pid`
-		        rm /var/run/dhcpc.pid
+		    if [ -s /var/run/dhcpc.$*.pid ]; then
+			kill `cat /var/run/dhcpc.$*.pid`
+			rm /var/run/dhcpc.$*.pid
 		    fi
 		    /usr/local/sbin/dhcpc $* 
 		else

>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@iafrica.com>
To: MIHIRA Yoshiro <sanpei@sanpei.org>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: misc/10566: patch dhcpc problem on /etc/pccard_ether
Date: Fri, 26 Mar 1999 03:04:59 +0200

 Thanks for the report.
 
 It occurs to me that a more useful and lasting fix would be to add an
 rc.conf option called something like dhcp_pid_file that could be used
 from within pccard_ether.
 
 Wanna take a crack at it and submit diffs? :-)
 
 Ciao,
 Sheldon.
 

From: MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>
To: sheldonh@iafrica.com
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: misc/10566: patch dhcpc problem on /etc/pccard_ether
Date: Fri, 26 Mar 1999 11:18:19 +0900

 OK.
 
   I create new patch for pccard_ether and defaults/rc.conf, yes,
 its' experimental.
 
 MIHIRA Yoshiro.
 
 --- sys/etc/pccard_ether.org	Fri Mar 26 10:47:26 1999
 +++ sys/etc/pccard_ether	Fri Mar 26 10:58:50 1999
 @@ -16,20 +16,14 @@
  
  if [ "x$pccard_ifconfig" != "xNO" ] ; then
  	if [ "x$pccard_ifconfig" = "xDHCP" ] ; then
 -		if [ -f /sbin/dhclient ] ; then
 -		    if [ -s /var/run/dhclient.pid ] ; then
 -			kill `cat /var/run/dhclient.pid`
 -			rm /var/run/dhclient.pid
 -		    fi
 -		    /sbin/dhclient
 -		elif [ -f /usr/local/sbin/dhcpc ] ; then
 -		    if [ -s /var/run/dhcpc.pid ] ; then
 -		        kill `cat /var/run/dhcpc.pid`
 -		        rm /var/run/dhcpc.pid
 -		    fi
 -		    /usr/local/sbin/dhcpc $* 
 +		if [ -s $dhcp_pid_file ] ; then
 +		    kill `cat $dhcp_pid_file`
 +		    rm $dhcp_pid_file
 +		fi
 +		if [ -f $dhcp_client ] ; then
 +		    $dhcp_client $dhcp_client_flags
  		else
 -		    echo "DHCP client software not available (isc-dhcp2)"
 +		    echo "DHCP client software not available"
  		fi
  	else
  		interface=$1
 ----------
 --- sys/etc/defaults/rc.conf.org	Fri Mar 26 11:06:23 1999
 +++ sys/etc/defaults/rc.conf	Fri Mar 26 11:12:56 1999
 @@ -42,6 +42,14 @@
  network_interfaces="lo0"	# List of network interfaces (lo0 is loopback).
  ifconfig_lo0="inet 127.0.0.1"	# default loopback device configuration.
  #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
 +dhcp_client="/sbin/dhclient"	# Name of dhcp client daemon to use if enabled.
 +dhcp_client_flags=""		# Flags to dhcp client (if enabled).
 +dhcp_pid_file="/var/run/dhclient.pid"	# pid filename of dhcp client
 +#
 +# If you use wide-dhcp (ports/net/wide-dhcp), you might also want to set.
 +#dhcp_client="/usr/local/sbin/dhcpc"
 +#dhcp_client_flags="$*"
 +#dhcp_pid_file="/var/run/dhcpc.$*.pid"
  #
  # If you have any sppp(4) interfaces above, you might also want to set
  # the following parameters.  Refer to spppcontrol(8) for their meaning.
 

From: MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>
To: sheldonh@iafrica.com, freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: misc/10566: patch dhcpc problem on /etc/pccard_ether
Date: Thu, 01 Apr 1999 20:32:09 +0900

 >  I create new patch for pccard_ether and defaults/rc.conf, yes,
 >its' experimental.
 >
 >--- sys/etc/pccard_ether.org	Fri Mar 26 10:47:26 1999
 >+++ sys/etc/pccard_ether	Fri Mar 26 10:58:50 1999
      ~~~
   Sorry I mistake previous patch, not ``sys/etc'', correct one is
 ``src/etc.''  I added directory name by hand.  I fix it.
 
 MIHIRA Yoshiro
 
 --- src/etc/pccard_ether.org	Fri Mar 26 10:47:26 1999
 +++ src/etc/pccard_ether	Fri Mar 26 10:58:50 1999
 @@ -16,20 +16,14 @@
  
  if [ "x$pccard_ifconfig" != "xNO" ] ; then
  	if [ "x$pccard_ifconfig" = "xDHCP" ] ; then
 -		if [ -f /sbin/dhclient ] ; then
 -		    if [ -s /var/run/dhclient.pid ] ; then
 -			kill `cat /var/run/dhclient.pid`
 -			rm /var/run/dhclient.pid
 -		    fi
 -		    /sbin/dhclient
 -		elif [ -f /usr/local/sbin/dhcpc ] ; then
 -		    if [ -s /var/run/dhcpc.pid ] ; then
 -		        kill `cat /var/run/dhcpc.pid`
 -		        rm /var/run/dhcpc.pid
 -		    fi
 -		    /usr/local/sbin/dhcpc $* 
 +		if [ -s $dhcp_pid_file ] ; then
 +		    kill `cat $dhcp_pid_file`
 +		    rm $dhcp_pid_file
 +		fi
 +		if [ -f $dhcp_client ] ; then
 +		    $dhcp_client $dhcp_client_flags
  		else
 -		    echo "DHCP client software not available (isc-dhcp2)"
 +		    echo "DHCP client software not available"
  		fi
  	else
  		interface=$1
 ----------
 --- src/etc/defaults/rc.conf.org	Fri Mar 26 11:06:23 1999
 +++ src/etc/defaults/rc.conf	Fri Mar 26 11:12:56 1999
 @@ -42,6 +42,14 @@
  network_interfaces="lo0"	# List of network interfaces (lo0 is loopback).
  ifconfig_lo0="inet 127.0.0.1"	# default loopback device configuration.
  #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
 +dhcp_client="/sbin/dhclient"	# Name of dhcp client daemon to use if enabled.
 +dhcp_client_flags=""		# Flags to dhcp client (if enabled).
 +dhcp_pid_file="/var/run/dhclient.pid"	# pid filename of dhcp client
 +#
 +# If you use wide-dhcp (ports/net/wide-dhcp), you might also want to set.
 +#dhcp_client="/usr/local/sbin/dhcpc"
 +#dhcp_client_flags="$*"
 +#dhcp_pid_file="/var/run/dhcpc.$*.pid"
  #
  # If you have any sppp(4) interfaces above, you might also want to set
  # the following parameters.  Refer to spppcontrol(8) for their meaning.
 
Responsible-Changed-From-To: freebsd-bugs->obrien 
Responsible-Changed-By: obrien 
Responsible-Changed-When: Mon Apr 19 15:30:42 PDT 1999 
Responsible-Changed-Why:  
I'm mr. dhcp I guess. 

From: MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>
To: freebsd-gnats-submit@freebsd.org
Cc: sanpei@sanpei.org
Subject: Re: misc/10566: patch dhcpc problem on /etc/pccard_ether
Date: Tue, 11 May 1999 15:35:54 +0900

   I posted patch for /etc/pccard_ether.
 
   Do you commit my changes before 3.2-RELEASE?
 
 	http://www.freebsd.org/cgi/query-pr.cgi?pr=10566
 
 Cheers
 MIHIRA Yoshiro
 

From: MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>
To: freebsd-gnats-submit@freebsd.org
Cc: Jun Kuriyama <kuriyama@sky.rim.or.jp>
Subject: Re: misc/10566: patch dhcpc problem on /etc/pccard_ether
Date: Thu, 20 May 1999 01:40:16 +0900

   I fix and do not use $* argument.
 
 Cheers
 MIHIRA Sanpei Yoshiro
 
 ----------cuthere----------
 --- rc.conf.org	Fri Mar 26 11:06:23 1999
 +++ rc.conf	Thu May 20 01:34:30 1999
 @@ -42,6 +42,14 @@
  network_interfaces="lo0"	# List of network interfaces (lo0 is loopback).
  ifconfig_lo0="inet 127.0.0.1"	# default loopback device configuration.
  #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
 +dhcp_client="/sbin/dhclient"	# Name of dhcp client daemon to use if enabled.
 +dhcp_client_flags=""		# Flags to dhcp client (if enabled).
 +dhcp_pid_file="/var/run/dhclient.pid"	# pid filename of dhcp client
 +#
 +# If you use wide-dhcp (ports/net/wide-dhcp), you might also want to set.
 +#dhcp_client="/usr/local/sbin/dhcpc"
 +#dhcp_client_flags="\$interface"
 +#dhcp_pid_file="/var/run/dhcpc.\$interface.pid"
  #
  # If you have any sppp(4) interfaces above, you might also want to set
  # the following parameters.  Refer to spppcontrol(8) for their meaning.
 ----------cuthere----------
 --- pccard_ether.org	Fri Mar 26 10:47:26 1999
 +++ pccard_ether	Thu May 20 01:33:40 1999
 @@ -15,24 +15,19 @@
  fi
  
  if [ "x$pccard_ifconfig" != "xNO" ] ; then
 +	interface=$1
  	if [ "x$pccard_ifconfig" = "xDHCP" ] ; then
 -		if [ -f /sbin/dhclient ] ; then
 -		    if [ -s /var/run/dhclient.pid ] ; then
 -			kill `cat /var/run/dhclient.pid`
 -			rm /var/run/dhclient.pid
 -		    fi
 -		    /sbin/dhclient
 -		elif [ -f /usr/local/sbin/dhcpc ] ; then
 -		    if [ -s /var/run/dhcpc.pid ] ; then
 -		        kill `cat /var/run/dhcpc.pid`
 -		        rm /var/run/dhcpc.pid
 -		    fi
 -		    /usr/local/sbin/dhcpc $* 
 +		dhcp_pid_realfile=`eval echo ${dhcp_pid_file}`
 +		if [ -s $dhcp_pid_realfile ] ; then
 +		    kill `cat $dhcp_pid_realfile`
 +		    rm $dhcp_pid_realfile
 +		fi
 +		if [ -f $dhcp_client ] ; then
 +		    $dhcp_client `eval echo ${dhcp_client_flags}`
  		else
 -		    echo "DHCP client software not available (isc-dhcp2)"
 +		    echo "DHCP client software not available"
  		fi
  	else
 -		interface=$1
  		shift
  		ifconfig $interface $pccard_ifconfig $*
  	fi
 
 
State-Changed-From-To: open->closed 
State-Changed-By: obrien 
State-Changed-When: Fri Nov 10 09:17:51 PST 2000 
State-Changed-Why:  
Others have reworked the whole PCCARD Ethernet + DHCP issue. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=10566 
>Unformatted:
