From nobody@FreeBSD.org  Wed Jul 28 14:51:45 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D622E1065673
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 28 Jul 2010 14:51:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id C5B218FC23
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 28 Jul 2010 14:51:45 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o6SEpjkT055399
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 28 Jul 2010 14:51:45 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o6SEpjIr055398;
	Wed, 28 Jul 2010 14:51:45 GMT
	(envelope-from nobody)
Message-Id: <201007281451.o6SEpjIr055398@www.freebsd.org>
Date: Wed, 28 Jul 2010 14:51:45 GMT
From: pluknet <pluknet@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [rc.d] [patch] Mixed/misuse of AND-OR list operators in rc.d/ipmon
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         149036
>Category:       conf
>Synopsis:       [rc.d] [patch] Mixed/misuse of AND-OR list operators in rc.d/ipmon
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jilles
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 28 15:00:08 UTC 2010
>Closed-Date:    Sun Aug 08 14:18:40 UTC 2010
>Last-Modified:  Sun Aug  8 14:20:08 UTC 2010
>Originator:     pluknet
>Release:        6.4-RELEASE-p9
>Organization:
>Environment:
>Description:
src/etc/rc.d/ipmon#rev1.5 added the next check:

	o In ipmon and ipnat show a warning if neither ipfilter nor
	  ipnat is enabled [..], and exit

1) this check mixes /bin/test and /bin/sh syntax of AND-OR list operators.
2) it checks for AND, while it should check for OR
(also see comment for cvs rev1.5 above).
>How-To-Repeat:
Place to /etc/rc.conf:
ipnat_enable="YES"
ipmon_enable="YES"

Try to launch ipmon:
# /etc/rc.d/ipmon start
/etc/rc.d/ipmon: ERROR: ipmon requires either ipfilter or ipnat enabled

>Fix:
1) Correct the combined check as done in attached patch.
2) profit
# /etc/rc.d/ipmon start
Starting ipmon.


Patch attached with submission follows:

Index: etc/rc.d/ipmon
===================================================================
--- etc/rc.d/ipmon	(revision 207204)
+++ etc/rc.d/ipmon	(working copy)
@@ -20,7 +20,7 @@
 	# Continue only if ipfilter or ipnat is enabled and the
 	# ipfilter module is loaded.
 	#
-	if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
+	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then
 		err 1  "${name} requires either ipfilter or ipnat enabled"
 	fi
 	if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Jul 29 01:39:02 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=149036 
State-Changed-From-To: open->patched 
State-Changed-By: jilles 
State-Changed-When: Sun Aug 1 15:44:25 UTC 2010 
State-Changed-Why:  
Applied in -CURRENT, thanks! 


Responsible-Changed-From-To: freebsd-rc->jilles 
Responsible-Changed-By: jilles 
Responsible-Changed-When: Sun Aug 1 15:44:25 UTC 2010 
Responsible-Changed-Why:  
Take. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/149036: commit references a PR
Date: Sun,  1 Aug 2010 15:41:12 +0000 (UTC)

 Author: jilles
 Date: Sun Aug  1 15:41:00 2010
 New Revision: 210734
 URL: http://svn.freebsd.org/changeset/base/210734
 
 Log:
   Allow starting /etc/rc.d/ipmon if ipnat is enabled but ipfilter is not
   (in /etc/rc.conf).
   
   This fixes an apparent confusion between test(1) and sh(1) syntax for
   AND/OR.
   
   PR:		conf/149036
   Submitted by:	pluknet
   MFC after:	1 week
 
 Modified:
   head/etc/rc.d/ipmon
 
 Modified: head/etc/rc.d/ipmon
 ==============================================================================
 --- head/etc/rc.d/ipmon	Sun Aug  1 15:34:29 2010	(r210733)
 +++ head/etc/rc.d/ipmon	Sun Aug  1 15:41:00 2010	(r210734)
 @@ -20,7 +20,7 @@ ipmon_precmd()
  	# Continue only if ipfilter or ipnat is enabled and the
  	# ipfilter module is loaded.
  	#
 -	if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
 +	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then
  		err 1  "${name} requires either ipfilter or ipnat enabled"
  	fi
  	if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
 _______________________________________________
 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"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/149036: commit references a PR
Date: Sun,  8 Aug 2010 13:43:30 +0000 (UTC)

 Author: jilles
 Date: Sun Aug  8 13:43:20 2010
 New Revision: 211069
 URL: http://svn.freebsd.org/changeset/base/211069
 
 Log:
   MFC r210734: Allow starting ipmon if ipnat is enabled but ipfilter is not
   (in /etc/rc.conf).
   
   This fixes an apparent confusion between test(1) and sh(1) syntax for
   AND/OR.
   
   PR:		conf/149036
   Submitted by:	pluknet
 
 Modified:
   stable/8/etc/rc.d/ipmon
 Directory Properties:
   stable/8/etc/   (props changed)
 
 Modified: stable/8/etc/rc.d/ipmon
 ==============================================================================
 --- stable/8/etc/rc.d/ipmon	Sun Aug  8 12:23:02 2010	(r211068)
 +++ stable/8/etc/rc.d/ipmon	Sun Aug  8 13:43:20 2010	(r211069)
 @@ -20,7 +20,7 @@ ipmon_precmd()
  	# Continue only if ipfilter or ipnat is enabled and the
  	# ipfilter module is loaded.
  	#
 -	if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
 +	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then
  		err 1  "${name} requires either ipfilter or ipnat enabled"
  	fi
  	if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
 _______________________________________________
 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"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/149036: commit references a PR
Date: Sun,  8 Aug 2010 13:46:05 +0000 (UTC)

 Author: jilles
 Date: Sun Aug  8 13:45:47 2010
 New Revision: 211070
 URL: http://svn.freebsd.org/changeset/base/211070
 
 Log:
   MFC r210734: Allow starting ipmon if ipnat is enabled but ipfilter is not
   (in /etc/rc.conf).
   
   This fixes an apparent confusion between test(1) and sh(1) syntax for
   AND/OR.
   
   PR:		conf/149036
   Submitted by:	pluknet
 
 Modified:
   stable/7/etc/rc.d/ipmon
 Directory Properties:
   stable/7/etc/   (props changed)
 
 Modified: stable/7/etc/rc.d/ipmon
 ==============================================================================
 --- stable/7/etc/rc.d/ipmon	Sun Aug  8 13:43:20 2010	(r211069)
 +++ stable/7/etc/rc.d/ipmon	Sun Aug  8 13:45:47 2010	(r211070)
 @@ -20,7 +20,7 @@ ipmon_precmd()
  	# Continue only if ipfilter or ipnat is enabled and the
  	# ipfilter module is loaded.
  	#
 -	if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
 +	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then
  		err 1  "${name} requires either ipfilter or ipnat enabled"
  	fi
  	if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
 _______________________________________________
 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: patched->closed 
State-Changed-By: jilles 
State-Changed-When: Sun Aug 8 14:18:39 UTC 2010 
State-Changed-Why:  
Fixed in 6/7/8/9, thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/149036: commit references a PR
Date: Sun,  8 Aug 2010 14:13:25 +0000 (UTC)

 Author: jilles
 Date: Sun Aug  8 14:13:10 2010
 New Revision: 211072
 URL: http://svn.freebsd.org/changeset/base/211072
 
 Log:
   MFC r210734: Allow starting ipmon if ipnat is enabled but ipfilter is not
   (in /etc/rc.conf).
   
   This fixes an apparent confusion between test(1) and sh(1) syntax for
   AND/OR.
   
   PR:		conf/149036
   Submitted by:	pluknet
 
 Modified:
   stable/6/etc/rc.d/ipmon
 Directory Properties:
   stable/6/etc/   (props changed)
 
 Modified: stable/6/etc/rc.d/ipmon
 ==============================================================================
 --- stable/6/etc/rc.d/ipmon	Sun Aug  8 14:00:21 2010	(r211071)
 +++ stable/6/etc/rc.d/ipmon	Sun Aug  8 14:13:10 2010	(r211072)
 @@ -20,7 +20,7 @@ ipmon_precmd()
  	# Continue only if ipfilter or ipnat is enabled and the
  	# ipfilter module is loaded.
  	#
 -	if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
 +	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then
  		err 1  "${name} requires either ipfilter or ipnat enabled"
  	fi
  	if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
 _______________________________________________
 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"
 
>Unformatted:
