From rea@codelabs.ru  Mon Oct 17 05:54:20 2011
Return-Path: <rea@codelabs.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B036C1065676;
	Mon, 17 Oct 2011 05:54:20 +0000 (UTC)
	(envelope-from rea@codelabs.ru)
Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45])
	by mx1.freebsd.org (Postfix) with ESMTP id 625FF8FC0C;
	Mon, 17 Oct 2011 05:54:20 +0000 (UTC)
Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25])
	by 0.mx.codelabs.ru with esmtps (TLSv1:CAMELLIA256-SHA:256)
	id 1RFfvB-0003xU-LI; Mon, 17 Oct 2011 09:39:33 +0400
Message-Id: <20111017053932.6B331DA820@void.codelabs.ru>
Date: Mon, 17 Oct 2011 09:39:32 +0400 (MSD)
From: Eygene Ryabinkin <rea@freebsd.org>
Reply-To: Eygene Ryabinkin <rea@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: des@freebsd.org
Subject: [patch] fix rc_force check in /etc/rc.d/dhclient
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         161733
>Category:       bin
>Synopsis:       [patch] fix rc_force check in /etc/rc.d/dhclient
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 17 06:00:24 UTC 2011
>Closed-Date:    Tue Oct 18 07:02:55 UTC 2011
>Last-Modified:  Tue Oct 18 07:02:55 UTC 2011
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
Code Labs
>Environment:

System: FreeBSD 10.0-CURRENT amd64

>Description:

Revision 226345 of /etc/rc.d/dhclient introduced the number of
sanity checks, but the condition '[ -n "${rc_force}" ]' must be
inversed, because the script should exit if it was _not_ forced
to run and this is not the DHCP interface.  'it was not forced' ==
'[ -z "${rc_force}" ]' and not the other way round.

>How-To-Repeat:

Build and boot FreeBSD 10-CURRENT after 226345 and watch how your
non-DHCP-enabled interfaces are trying to acquire the address via
DHCP (dhclient in my case was invoked from the devd hooks for the
"interface up" event).

>Fix:

Apply patch at
  http://codelabs.ru/fbsd/patches/dhclient/dhclient-properly-check-rc_force.diff

It works both for my DHCP-enabled laptop and non-DHCP-enabled workstation.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: rea 
Responsible-Changed-When: Mon Oct 17 06:06:57 UTC 2011 
Responsible-Changed-Why:  
Assign to Dag-Erling, the author of r226345. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/161733: commit references a PR
Date: Mon, 17 Oct 2011 13:06:11 +0000 (UTC)

 Author: des
 Date: Mon Oct 17 13:05:57 2011
 New Revision: 226464
 URL: http://svn.freebsd.org/changeset/base/226464
 
 Log:
   The rc_force test was inverted in the previous commit, so that dhclient ran
   for interfaces which were not configured for DHCP *unless* rc_force was set;
   the correct logic is to run dhclient for those interfaces *only if* rc_force
   is set.
   
   Broken by:	des@
   Noticed by:	everybody and his dog
   Submitted by:	rea@
   PR:		bin/161733
 
 Modified:
   head/etc/rc.d/dhclient
 
 Modified: head/etc/rc.d/dhclient
 ==============================================================================
 --- head/etc/rc.d/dhclient	Mon Oct 17 12:22:09 2011	(r226463)
 +++ head/etc/rc.d/dhclient	Mon Oct 17 13:05:57 2011	(r226464)
 @@ -41,7 +41,7 @@ if [ -z $ifn ] ; then
  		echo 1>&2 "$0: no interface specified"
  		return 1
  	fi
 -elif [ -n "${rc_force}" ] && ! dhcpif $ifn; then
 +elif [ -z "${rc_force}" ] && ! dhcpif $ifn; then
  	return 1
  fi
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Tue Oct 18 07:02:53 UTC 2011 
State-Changed-Why:  
fixed 

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