From leres@ee.lbl.gov  Mon Apr 17 03:59:59 2006
Return-Path: <leres@ee.lbl.gov>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 107CB16A405
	for <freebsd-gnats-submit@freebsd.org>; Mon, 17 Apr 2006 03:59:59 +0000 (UTC)
	(envelope-from leres@ee.lbl.gov)
Received: from fun.ee.lbl.gov (fun.ee.lbl.gov [131.243.1.81])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 86AC543D48
	for <freebsd-gnats-submit@freebsd.org>; Mon, 17 Apr 2006 03:59:58 +0000 (GMT)
	(envelope-from leres@ee.lbl.gov)
Received: from fun.ee.lbl.gov (localhost [127.0.0.1])
	by fun.ee.lbl.gov (8.13.6/8.13.6) with ESMTP id k3H3xwv9016954
	for <freebsd-gnats-submit@freebsd.org>; Sun, 16 Apr 2006 20:59:58 -0700 (PDT)
Received: from fun.ee.lbl.gov (leres@localhost)
	by fun.ee.lbl.gov (8.13.6/8.13.6/Submit) with ESMTP id k3H3xwcG016951
	for <freebsd-gnats-submit@freebsd.org>; Sun, 16 Apr 2006 20:59:58 -0700 (PDT)
Message-Id: <200604170359.k3H3xwcG016951@fun.ee.lbl.gov>
Date: Sun, 16 Apr 2006 20:59:58 -0700
From: leres@ee.lbl.gov (Craig Leres)
To: freebsd-gnats-submit@freebsd.org
Subject: [PATCH] /etc/rc.d/dhclient doesn't interact well with the ports isc dhcp client
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         95905
>Category:       conf
>Synopsis:       [PATCH] /etc/rc.d/dhclient doesn't interact well with the ports isc dhcp client
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    brooks
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 17 04:00:31 GMT 2006
>Closed-Date:    Thu May 15 01:56:01 UTC 2008
>Last-Modified:  Thu May 15 02:00:14 UTC 2008
>Originator:     Craig Leres
>Release:        FreeBSD 6.1-BETA4 i386
>Organization:
Lawrence Berkeley National Laboratory
>Environment:
	fox 15 % uname -a
	FreeBSD fox.ee.lbl.gov 6.1-BETA4 FreeBSD 6.1-BETA4 #1: Fri Apr 14 01:03:21 PDT 2006     leres@fox.ee.lbl.gov:/usr/src/6.1-BETA4/sys/i386/compile/LBLSMP  i386
	fox 16 % pkg_info | grep isc-dhcp3-client
	isc-dhcp3-client-3.0.3_1 The ISC Dynamic Host Configuration Protocol client

>Description:
	The test in /etc/rc.d/dhclient that is supposed to prevent
	dhclient from being launched if one is already running
	doesn't work with the ports version of dhclient. If you
	have an interface configured for dhcp in /etc/rc.conf,
	dhclient runs and gets a lease normally but then is run
	again later at which point it sets the interface address
	to 0.0.0.0, ending network access via that NIC.

>How-To-Repeat:
	Install the isc-dhcp3-client and configure a NIC to use it:

	    ifconfig_em0="dhcp"

	Then reboot. The interface will come up when dhclient runs.
	Later when it's run again, you'll see this message:

	    Internet Systems Consortium DHCP Client V3.0.3 
	    Copyright 2004-2005 Internet Systems Consortium.
	    All rights reserved.
	    For info, please visit http://www.isc.org/products/DHCP
	    Listening on BPF/em0/00:30:48:00:00:01
	    Sending on   BPF/em0/00:30:48:00:00:01
	    Can't bind to dhcp address: Address already in use
	    Please make sure there is no other dhcp server
	    running and that there's no entry for dhcp or
	    bootp in /etc/inetd.conf.   Also make sure you
	    are not running HP JetAdmin software, which
	    includes a bootp server.

	At this point the original dhclient is still running but
	the interface is misconfigured and you're hosed.

>Fix:
	The simplest solution is to check /var/run/dhclient.pid in
	addition doing the pgrep test that's already in the rc
	script. The appended patch implements this.

	A more complete solution would be to also change the base
	version of dhclient to manage the /var/run/dhclient.pid
	file and remove the pgrep test from the rc.d script.

	(If there is interest in that, I'd be happy to generate the
	diffs.)

	
*** dhclient	2006/04/17 02:59:17	1.1
--- dhclient	2006/04/17 03:35:20
***************
*** 27,32 ****
--- 27,42 ----
  		fi
  	fi
  
+ 	# deal with isc dhclient too
+ 	f="/var/run/dhclient.pid"
+ 	if [ -s ${f} ]; then
+ 		pid="`cat ${f}`"
+ 		kill -0 "${pid}" >/dev/null 2>&1
+ 		if [ $? -eq 0 ]; then
+ 			exit 0
+ 		fi
+ 	fi
+ 
  	if checkyesno background_dhclient; then
  		rc_flags="${rc_flags} -b"
  	fi
>Release-Note:
>Audit-Trail:
Adding to audit trail from misfiled PR conf/95911:

Date: Mon, 17 Apr 2006 01:07:39 -0700
From: leres@xse.com (Craig Leres)

 ------- =_aaaaaaaaaa0
 Content-Type: text/plain; charset="us-ascii"
 Content-ID: <20403.1145261088.1@fun.ee.lbl.gov>
 
 Let me see if I can get mh to mime that patch a better way...
 
 		Craig
 
 ------- =_aaaaaaaaaa0
 Content-Type: application/text; name="patchbase-Makefile.in"; charset="us-ascii"
 Content-ID: <20403.1145261088.2@fun.ee.lbl.gov>
 Content-Transfer-Encoding: quoted-printable
 
 --- Makefile.in.orig	Sun Apr 16 17:17:57 2006
 +++ Makefile.in	Sun Apr 16 17:18:08 2006
 @@ -97,22 +97,18 @@
  =
 
  CLEANFILES =3D $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
  =
 
 -all: libpcap.a
 +all: libpcap.a libpcap.so.2
  =
 
  libpcap.a: $(OBJ)
  	@rm -f $@
  	ar rc $@ $(OBJ) $(LIBS)
  	$(RANLIB) $@
  =
 
 -shared: libpcap.$(DYEXT)
 +#shared: libpcap.$(DYEXT)
  =
 
 -#
 -# XXX - this works with GNU ld, but won't necessarily work with native
 -# ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
 -#
 -libpcap.so: $(OBJ)
 +libpcap.so.2: $(OBJ)
  	@rm -f $@
 -	ld -shared -o $@.`cat VERSION` $(OBJ)
 +	$(CC) -shared -Wl,-x  -o libpcap.so.2 -Wl,-soname,libpcap.so.2  `lorder =
 *.o | tsort -q`
  =
 
  # the following rule succeeds, but the result is untested.
  libpcap.dylib: $(OBJ)
 @@ -173,6 +169,8 @@
  install: libpcap.a =
 
  	[ -d $(DESTDIR)$(libdir) ] || \
  	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
 +	$(INSTALL_DATA) libpcap.so.2 $(DESTDIR)$(libdir)/libpcap.so.2
 +	ln -fs $(DESTDIR)$(libdir)/libpcap.so.2 $(DESTDIR)$(libdir)/libpcap.so
  	$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
  	$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
  	[ -d $(DESTDIR)$(includedir) ] || \
 
 ------- =_aaaaaaaaaa0--

From: leres@xse.com (Craig Leres)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/95905: [PATCH] /etc/rc.d/dhclient doesn't interact well with the ports isc dhcp client
Date: Mon, 17 Apr 2006 12:00:08 -0700

 (Sorry, I managed to send that last followup with the wrong pr id
 -- please disregard.)
Responsible-Changed-From-To: freebsd-bugs->brooks 
Responsible-Changed-By: brooks 
Responsible-Changed-When: Sat May 13 04:16:28 UTC 2006 
Responsible-Changed-Why:  
I'm the dhclient maintainer. 

If possible I'd like to have this work by setting the $pidfile 
variable rather than the current logic because I plan to add 
pidfile support to the in tree dhclient. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=95905 
State-Changed-From-To: open->patched 
State-Changed-By: brooks 
State-Changed-When: Tue Apr 15 23:03:48 UTC 2008 
State-Changed-Why:  
Finally committed a patch to HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=95905 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/95905: commit references a PR
Date: Tue, 15 Apr 2008 23:03:45 +0000 (UTC)

 brooks      2008-04-15 23:03:35 UTC
 
   FreeBSD src repository
 
   Modified files:
     etc/rc.d             dhclient 
   Log:
   Add very limited support for the isc-dhclient.  It will almostly certaintly
   only work if there's just one interface doing dhcp.  This version implements
   the same logic as the version in the PR, but uses pgrep to be less verbose.
   
   PR:             conf/95905
   MFC after:      1 week
   
   Revision  Changes    Path
   1.32      +4 -0      src/etc/rc.d/dhclient
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: brooks 
State-Changed-When: Thu May 15 01:55:24 UTC 2008 
State-Changed-Why:  
Merged to 6 and 7. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=95905 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/95905: commit references a PR
Date: Thu, 15 May 2008 01:53:17 +0000 (UTC)

 brooks      2008-05-15 01:53:09 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     etc/rc.d             dhclient 
   Log:
   MFC: Add very limited support for the isc-dhclient. It will almostly certaintly
   only work if there's just one interface doing dhcp. This version implements
   the same logic as the version in the PR, but uses pgrep to be less verbose.
   
   PR:             conf/95905
   
   Revision  Changes    Path
   1.28.2.3  +4 -0      src/etc/rc.d/dhclient
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/95905: commit references a PR
Date: Thu, 15 May 2008 01:53:51 +0000 (UTC)

 brooks      2008-05-15 01:53:46 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     etc/rc.d             dhclient 
   Log:
   MFC: Add very limited support for the isc-dhclient. It will almostly certaintly
   only work if there's just one interface doing dhcp. This version implements
   the same logic as the version in the PR, but uses pgrep to be less verbose.
   
   PR:             conf/95905
   
   Revision  Changes    Path
   1.20.2.7  +4 -0      src/etc/rc.d/dhclient
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
