From tom@claimlynx.com  Wed Jun 22 17:07:06 2011
Return-Path: <tom@claimlynx.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 24104106566B
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Jun 2011 17:07:06 +0000 (UTC)
	(envelope-from tom@claimlynx.com)
Received: from alcatraz.claimlynx.com (alcatraz.claimlynx.com [216.17.83.245])
	by mx1.freebsd.org (Postfix) with ESMTP id C95408FC18
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Jun 2011 17:07:05 +0000 (UTC)
Received: from leopard.claimlynx.com (leopard.claimlynx.com [216.17.68.149])
	by alcatraz.claimlynx.com (Postfix) with ESMTP id 047311CC1F;
	Wed, 22 Jun 2011 11:47:25 -0500 (CDT)
Received: by leopard.claimlynx.com (Postfix, from userid 127)
	id 3FB3F358CA2; Wed, 22 Jun 2011 11:47:24 -0500 (CDT)
Message-Id: <20110622164724.3FB3F358CA2@leopard.claimlynx.com>
Date: Wed, 22 Jun 2011 11:47:24 -0500 (CDT)
From: tom@claimlynx.com
Reply-To: tom@claimlynx.com
To: FreeBSD-gnats-submit@freebsd.org
Cc: root@claimlynx.com, josh@ixsystems.com
Subject: [patch] Modify rc scripts for ftp-proxy and pflog to start multiple instances
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         158171
>Category:       conf
>Synopsis:       [patch] Modify rc scripts for ftp-proxy and pflog to start multiple instances
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jpaetzel
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 22 17:10:10 UTC 2011
>Closed-Date:    Wed Nov 13 03:51:17 UTC 2013
>Last-Modified:  Wed Nov 13 04:00:00 UTC 2013
>Originator:     Thomas Johnson
>Release:        FreeBSD 8.2-RELEASE amd64
>Organization:
ClaimLynx, Inc.
>Environment:
System: FreeBSD leopard.claimlynx.com 8.2-RELEASE FreeBSD 8.2-RELEASE #8: Thu Mar 10 11:40:00 CST 2011 root@leopard.claimlynx.com:/usr/obj/usr/src/sys/GENERIC amd64


	
>Description:
	The ftp-proxy and pflogd daemons both allow for multiple instances to be run simultaneously. However, the rc scripts that control the startup of these daemons have no concept of multiple instances.

	ftp-proxy requires a seperate instance for each "type" of proxying that you would like to perform. For example, two instances are required to allow operation through NAT for a group of internal servers connecting out, and an external server connecting inbound using active-mode FTP.

	pf allows logging to different target pflog interfaces, for more granular logging of traffic. This requires multiple pflogd instances, one to read each pflog interface.
>How-To-Repeat:
	
>Fix:

	The attached patch allows both startup scripts to handle multiple instances in a similar manner as the "static_routes" variable. If the optional <service>_instances list is defined in rc.conf, the scripts search for corresponding configuration for each "instance" listed in the _instances string. I have endeavored to maintain the previous functionality of the rc scripts, since it is likely that most users will not need the added functionality (for pflog in particular). My patch also includes updates to rc.conf(5) explaining the function of variables I have added. The patches below are run against HEAD, updated shortly before this PR.


--- patch.diff begins here ---
--- /usr/src/etc/rc.d/ftp-proxy	2008-07-16 14:50:29.000000000 -0500
+++ ftp-proxy	2011-06-22 08:51:26.000000000 -0500
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/ftp-proxy,v 1.3 2008/07/16 19:50:29 dougb Exp $
+# $FreeBSD: src/etc/rc.d/ftp-proxy,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $
 #
 
 # PROVIDE: ftp-proxy
@@ -14,4 +14,62 @@
 command="/usr/sbin/ftp-proxy"
 
 load_rc_config $name
-run_rc_command "$1"
+
+#
+# manage_pid argument
+#	Create or remove a pidfile manually, for daemons that can't be bothered
+#	to do it themselves. Takes one argument, which is the argument provided
+#	to the rc script. The pidfile will be named /var/run/<$name>.pid,
+#	unless $pidfile is defined.
+#
+#	The method used to determine the pid is rather hacky; grep ps output to
+#	find '$procname|$command', then grep for ${name}_flags. If at all
+#	possible, use another method if at all possible, to avoid that dirty-
+#	code feeling.
+#
+manage_pid() {
+	local search_string ps_pid
+	case $1 in
+		*start)
+			cmd_string=`basename ${procname:-${command}}`
+			eval flag_string=\"\$${name}_flags\"
+			# Determine the pid.
+			ps_pid=`ps ax -o pid= -o command= | grep $cmd_string | grep -e "$flag_string" | grep -v grep | awk '{ print $1 }'`
+			# Write the pidfile depending on $pidfile status.
+			echo $ps_pid > ${pidfile:-"/var/run/$name.pid"}
+	       		;;
+		stop)
+	       		rm $pidfile
+	       		;;
+	esac
+}
+
+# Allow ftp-proxy to start up in two different ways. The typical behavior
+# is to start up one instance of ftp-proxy by setting ftpproxy_enable and
+# ftpproxy_flags. The alternate behavior allows multiple instances of ftp-
+# proxy to be started, allowing different types of proxy behavior. To use the
+# new behavior, a list of instances must be defined, and a list of flags for
+# each instance. For example, if we want to start two instances of ftp-proxy,
+# foo and bar, we would set the following vars.
+#	ftpproxy_enable="YES"
+#	ftpproxy_instances="foo bar"
+#	ftpproxy_foo="<arguments for foo>"
+#	ftpproxy_bar="<arguments for bar>"
+#
+# Starting more than one ftp-proxy?
+if [ "$ftpproxy_instances" ] && [ -n "${ftpproxy_instances}" ]; then
+	# Iterate through instance list.
+	for i in $ftpproxy_instances; do
+		#eval ftpproxy_${i}_flags=\$ftpproxy_${i}
+		#eval name=ftpproxy_${i}
+		# Set flags for this instance.
+		eval ftpproxy_flags=\$ftpproxy_${i}
+		# Define a unique pid file name.
+		pidfile="/var/run/ftp-proxy.$i.pid"
+		run_rc_command "$1"
+		manage_pid $1
+	done
+else
+	# Traditional single-instance behavior
+	run_rc_command "$1"
+fi
--- /usr/src/etc/rc.d/pflog	2009-06-25 20:04:50.000000000 -0500
+++ pflog	2011-06-22 08:52:27.000000000 -0500
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/pflog,v 1.14 2009/06/26 01:04:50 dougb Exp $
+# $FreeBSD: src/etc/rc.d/pflog,v 1.14.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $
 #
 
 # PROVIDE: pflog
@@ -24,25 +24,41 @@
 {
 	load_kld pflog || return 1
 
-	# set pflog0 interface to up state
-	if ! ifconfig pflog0 up; then
-		warn 'could not bring up pflog0.'
+	# set pflog_dev interface to up state
+	if ! ifconfig $pflog_dev up; then
+		warn "could not bring up $pflog_dev."
 		return 1
 	fi
 
 	# prepare the command line for pflogd
-	rc_flags="-f $pflog_logfile $rc_flags"
+	rc_flags="-f $pflog_logfile -i $pflog_dev $rc_flags"
 
 	# report we're ready to run pflogd
 	return 0
 }
 
+pflog_poststart() {
+	# Allow child pflogd to settle
+	sleep 0.10
+	# More elegant(?) method for getting a unique pid
+	if [ -f /var/run/pflogd.pid ]; then
+		mv /var/run/pflogd.pid $pidfile
+	else
+		warn "/var/run/pflogd.pid does not exist. Too fast."
+	fi
+}
+
 pflog_poststop()
 {
-	if ! ifconfig pflog0 down; then
-		warn 'could not bring down pflog0.'
+	if ! ifconfig $pflog_dev down; then
+		warn "could not bring down $pflog_dev."
 		return 1
 	fi
+
+	if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
+		rm $pidfile
+	fi
+
 	return 0
 }
 
@@ -53,4 +69,33 @@
 }
 
 load_rc_config $name
-run_rc_command "$1"
+
+# Check if spawning multiple pflogd
+echo "Starting pflogd: $pflog_instances"
+if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
+	start_postcmd="pflog_poststart"
+	# Interate through requested instances.
+	for i in $pflog_instances; do
+		# Set required variables
+		eval pflog_dev=\$pflog_${i}_dev
+		eval pflog_logfile=\$pflog_${i}_logfile
+		eval pflog_flags=\$pflog_${i}_flags
+		# Check that required vars have non-zero length, warn if not.
+		if [ -z $pflog_dev ]; then
+			warn "pflog_dev not set"
+			continue
+		fi
+		if [ -z $pflog_logfile ]; then
+			warn "pflog_logfile not set"
+			continue
+		fi
+		# pflogd sets a pidfile, but the name is hardcoded. Concoct a
+		# unique pidfile name.
+		pidfile="/var/run/pflogd.$i.pid"
+		run_rc_command "$1"
+	done
+else
+	# Typical case, spawn single instance only.
+	pflog_dev=${pflog_dev:-"pflog0"}
+	run_rc_command "$1"
+fi
--- /usr/src/share/man/man5/rc.conf.5	2011-05-17 05:38:44.000000000 -0500
+++ rc.conf.5	2011-06-22 08:19:17.000000000 -0500
@@ -872,6 +872,33 @@
 This variable contains additional flags passed to the
 .Xr pflogd 8
 program.
+.It Va pflog_instances
+.Pq Vt str
+If logging to more than one 
+.Xr pflog 4
+interface is desired, 
+.Va pflog_instances
+is set to the list of
+.Xr pflogd 8
+instances that should be started at system boot time. If 
+.Va pflog_instances
+is set, for each whitespace-seperated
+.Ar element
+in the list,
+.Ao Ar element Ac Ns Va _dev
+and
+.Ao Ar element Ac Ns Va _logfile
+elements are assumed to exist.
+.Ao Ar element Ac Ns Va _dev
+must contain the
+.Xr pflog 4
+interface to be watched by the named
+.Xr pflogd 8
+instance.
+.Ao Ar element Ac Ns Va _logfile
+must contain the name of the logfile that will be used by the
+.Xr pflogd 8
+instance.
 .It Va ftpproxy_enable
 .Pq Vt bool
 Set to
@@ -890,6 +917,19 @@
 This variable contains additional flags passed to the
 .Xr ftp-proxy 8
 program.
+.It Va ftpproxy_instances
+.Pq Vt str
+Empty by default. If multiple instances of
+.Xr ftp-proxy 8
+are desired at boot time, 
+.Va ftpproxy_instances
+should contain a whitespace-seperated list of instance names. For each
+.Ar element
+in the list, a variable named
+.Ao Ar element Ac Ns Va _flags
+should be defined, containing the command-line flags to be passed to the
+.Xr ftp-proxy 8
+instance.
 .It Va pfsync_enable
 .Pq Vt bool
 Set to
--- patch.diff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jpaetzel 
Responsible-Changed-By: jpaetzel 
Responsible-Changed-When: Fri Jul 1 14:27:52 UTC 2011 
Responsible-Changed-Why:  
I'll take it. 

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

From: Rainer Duffner <rainer@ultra-secure.de>
To: bug-followup@FreeBSD.org, tom@claimlynx.com
Cc:  
Subject: Re: conf/158171: [patch] Modify rc scripts for ftp-proxy and pflog
 to start multiple instances
Date: Fri, 13 Jul 2012 16:01:52 +0200

 Hi,
 
 what's the status of this RFE?
 
 
 
 Will this be included at some point?
 

From: Thomas Johnson <tom@claimlynx.com>
To: Rainer Duffner <rainer@ultra-secure.de>
Cc: bug-followup@freebsd.org
Subject: Re: conf/158171: [patch] Modify rc scripts for ftp-proxy and pflog to
 start multiple instances
Date: Fri, 13 Jul 2012 09:50:50 -0500

 --14dae9cdc47dc64f4f04c4b734ff
 Content-Type: text/plain; charset=ISO-8859-1
 
 It was kicked back to me with suggested changes, and it has sat in my
 inbox, flagged "Priority" ever since. We're using it in production as-is.
 But if there is interest, I can try to make it an actual priority.
 
 -- 
 Thomas Johnson
 ClaimLynx, Inc.
 952-593-5969 x2302
 
 --14dae9cdc47dc64f4f04c4b734ff
 Content-Type: text/html; charset=ISO-8859-1
 
 It was kicked back to me with suggested changes, and it has sat in my inbox, flagged &quot;Priority&quot; ever since. We&#39;re using it in production as-is. But if there is interest, I can try to make it an actual priority.<br>
 <br>-- <br>Thomas Johnson<br>ClaimLynx, Inc.<br>952-593-5969 x2302<br>
 
 --14dae9cdc47dc64f4f04c4b734ff--

From: Rainer Duffner <rainer@ultra-secure.de>
To: bug-followup@FreeBSD.org, tom@claimlynx.com
Cc:  
Subject: Re: conf/158171: [patch] Modify rc scripts for ftp-proxy and pflog
 to start multiple instances
Date: Mon, 16 Jul 2012 10:17:09 +0200

 Hi,
 
 
 I think it would be good to have this in the base tree.
 I might need it in production too and I really hate having "special"
 systems around that can't be upgraded straightforward.
 I *do* have enough of these already ;-)
 
 It's probably too late to have in included for 9.1, and I need it on
 8.3 anyway...
 
 

From: Jeremy Phillippe <jeremy.phillippe@me.com>
To: bug-followup@FreeBSD.org, tom@claimlynx.com
Cc:  
Subject: Re: conf/158171: [patch] Modify rc scripts for ftp-proxy and pflog to
 start multiple instances
Date: Thu, 24 Jan 2013 15:58:35 -0700

 This also appears to be an updated solution to the same sort of fix as suggested in PR 143085
 
 I too would love to see this included, as I have need of this as well. 

From: Claudiu Vasadi <c.vasadi@myphotobook.de>
To: bug-followup@FreeBSD.org, tom@claimlynx.com
Cc:  
Subject: Re: conf/158171: [patch] Modify rc scripts for ftp-proxy and pflog
 to start multiple instances
Date: Fri, 26 Apr 2013 11:43:38 +0200

 I second that.
 

From: Claudiu Vasadi <c.vasadi@myphotobook.de>
To: bug-followup@FreeBSD.org, tom@claimlynx.com
Cc:  
Subject: Re: conf/158171: [patch] Modify rc scripts for ftp-proxy and pflog
 to start multiple instances
Date: Fri, 26 Apr 2013 15:54:50 +0200

 PS: Tested and works under 9.1-STABLE r246451.

From: Eric Crist <ecrist@claimlynx.com>
To: bug-followup@FreeBSD.org,
 Thomas Johnson <tom@claimlynx.com>
Cc:  
Subject: Re: conf/158171: [patch] Modify rc scripts for ftp-proxy and pflog to start multiple instances
Date: Tue, 12 Nov 2013 14:22:40 -0600

 --047d7bdc109ee1a97c04eb009cda
 Content-Type: text/plain; charset=US-ASCII
 
 Requesting this gets committed as-is to the tree.
 
 
 
 
 -- 
 This e-mail and any files transmitted with it are confidential and are 
 intended solely for the use of the individual or entity to whom they are 
 addressed. If you are not the intended recipient or the individual 
 responsible for delivering the e-mail to the intended recipient, please be 
 advised that you have received this e-mail in error and that any use, 
 dissemination, forwarding, printing, or copying of this e-mail is strictly 
 prohibited.
 
 If you have received this communication in error, please return it to the 
 sender immediately and delete the original message and any copy of it from 
 your computer system. If you have any questions concerning this message, 
 please contact the sender or call ClaimLynx at (952) 593-5969.
 
 --047d7bdc109ee1a97c04eb009cda
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP using GPGMail
 
 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org
 
 iQEcBAEBAgAGBQJSgo4RAAoJEHKWQhk5DQ0OyvwIAM577zSMFTvIpaAU8lQ4e6no
 5+gVjl3TnJkSHkQfPbEQtUhct5wu/+WdvsOUP0+K5UOcp5tDCFABcBeBoUhSoQEd
 GFKBXx4/Sk6Z/33o8CX/v/BF9fDrlSRf1sD/bDFfJEaszYZ6JLqGk/gHqrLjhoBU
 oxsD66fAjm5/U46454x9rTeb3w75F8yyVw7z7OhW/2PXpL/bkanXnsCaJJML4/7i
 xKIyAha8sGDWggahICwky2bZLAqCEu8O1gH+oIM+UJd5lyhjY9WJmz9rVa3qTT2P
 ab1uih1+7XTOi2LFMVK6CjxTEoN4zocgajd+CPD+nMOq/iiasCfrBxbOJ20nYw4=
 =WrDn
 -----END PGP SIGNATURE-----
 
 --047d7bdc109ee1a97c04eb009cda--
State-Changed-From-To: open->closed 
State-Changed-By: jpaetzel 
State-Changed-When: Wed Nov 13 03:50:54 UTC 2013 
State-Changed-Why:  
Committed, thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/158171: commit references a PR
Date: Wed, 13 Nov 2013 03:50:39 +0000 (UTC)

 Author: jpaetzel
 Date: Wed Nov 13 03:50:31 2013
 New Revision: 258080
 URL: http://svnweb.freebsd.org/changeset/base/258080
 
 Log:
   Add support for multiple instances of ftp-proxy
   and pflog devices.
   
   PR:	conf/158171
   Submitted by:	Thomas Johnson <tom@claimlynx.com>
 
 Modified:
   head/etc/rc.d/ftp-proxy
   head/etc/rc.d/pflog
   head/share/man/man5/rc.conf.5
 
 Modified: head/etc/rc.d/ftp-proxy
 ==============================================================================
 --- head/etc/rc.d/ftp-proxy	Wed Nov 13 01:51:40 2013	(r258079)
 +++ head/etc/rc.d/ftp-proxy	Wed Nov 13 03:50:31 2013	(r258080)
 @@ -14,4 +14,62 @@ rcvar="ftpproxy_enable"
  command="/usr/sbin/ftp-proxy"
  
  load_rc_config $name
 -run_rc_command "$1"
 +
 +#
 +# manage_pid argument
 +#	Create or remove a pidfile manually, for daemons that can't be bothered
 +#	to do it themselves. Takes one argument, which is the argument provided
 +#	to the rc script. The pidfile will be named /var/run/<$name>.pid,
 +#	unless $pidfile is defined.
 +#
 +#	The method used to determine the pid is rather hacky; grep ps output to
 +#	find '$procname|$command', then grep for ${name}_flags. If at all
 +#	possible, use another method if at all possible, to avoid that dirty-
 +#	code feeling.
 +#
 +manage_pid() {
 +	local search_string ps_pid
 +	case $1 in
 +		*start)
 +			cmd_string=`basename ${procname:-${command}}`
 +			eval flag_string=\"\$${name}_flags\"
 +			# Determine the pid.
 +			ps_pid=`ps ax -o pid= -o command= | grep $cmd_string | grep -e "$flag_string" | grep -v grep | awk '{ print $1 }'`
 +			# Write the pidfile depending on $pidfile status.
 +			echo $ps_pid > ${pidfile:-"/var/run/$name.pid"}
 +	       		;;
 +		stop)
 +	       		rm $pidfile
 +	       		;;
 +	esac
 +}
 +
 +# Allow ftp-proxy to start up in two different ways. The typical behavior
 +# is to start up one instance of ftp-proxy by setting ftpproxy_enable and
 +# ftpproxy_flags. The alternate behavior allows multiple instances of ftp-
 +# proxy to be started, allowing different types of proxy behavior. To use the
 +# new behavior, a list of instances must be defined, and a list of flags for
 +# each instance. For example, if we want to start two instances of ftp-proxy,
 +# foo and bar, we would set the following vars.
 +#	ftpproxy_enable="YES"
 +#	ftpproxy_instances="foo bar"
 +#	ftpproxy_foo="<arguments for foo>"
 +#	ftpproxy_bar="<arguments for bar>"
 +#
 +# Starting more than one ftp-proxy?
 +if [ "$ftpproxy_instances" ] && [ -n "${ftpproxy_instances}" ]; then
 +	# Iterate through instance list.
 +	for i in $ftpproxy_instances; do
 +		#eval ftpproxy_${i}_flags=\$ftpproxy_${i}
 +		#eval name=ftpproxy_${i}
 +		# Set flags for this instance.
 +		eval ftpproxy_flags=\$ftpproxy_${i}
 +		# Define a unique pid file name.
 +		pidfile="/var/run/ftp-proxy.$i.pid"
 +		run_rc_command "$1"
 +		manage_pid $1
 +	done
 +else
 +	# Traditional single-instance behavior
 +	run_rc_command "$1"
 +fi
 
 Modified: head/etc/rc.d/pflog
 ==============================================================================
 --- head/etc/rc.d/pflog	Wed Nov 13 01:51:40 2013	(r258079)
 +++ head/etc/rc.d/pflog	Wed Nov 13 03:50:31 2013	(r258080)
 @@ -24,25 +24,41 @@ pflog_prestart()
  {
  	load_kld pflog || return 1
  
 -	# set pflog0 interface to up state
 -	if ! ifconfig pflog0 up; then
 -		warn 'could not bring up pflog0.'
 +	# set pflog_dev interface to up state
 +	if ! ifconfig $pflog_dev up; then
 +		warn "could not bring up $pflog_dev."
  		return 1
  	fi
  
  	# prepare the command line for pflogd
 -	rc_flags="-f $pflog_logfile $rc_flags"
 +	rc_flags="-f $pflog_logfile -i $pflog_dev $rc_flags"
  
  	# report we're ready to run pflogd
  	return 0
  }
  
 +pflog_poststart() {
 +	# Allow child pflogd to settle
 +	sleep 0.10
 +	# More elegant(?) method for getting a unique pid
 +	if [ -f /var/run/pflogd.pid ]; then
 +		mv /var/run/pflogd.pid $pidfile
 +	else
 +		warn "/var/run/pflogd.pid does not exist. Too fast."
 +	fi
 +}
 +
  pflog_poststop()
  {
 -	if ! ifconfig pflog0 down; then
 -		warn 'could not bring down pflog0.'
 +	if ! ifconfig $pflog_dev down; then
 +		warn "could not bring down $pflog_dev."
  		return 1
  	fi
 +
 +	if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
 +		rm $pidfile
 +	fi
 +
  	return 0
  }
  
 @@ -53,4 +69,33 @@ pflog_resync()
  }
  
  load_rc_config $name
 -run_rc_command "$1"
 +
 +# Check if spawning multiple pflogd
 +echo "Starting pflogd: $pflog_instances"
 +if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
 +	start_postcmd="pflog_poststart"
 +	# Interate through requested instances.
 +	for i in $pflog_instances; do
 +		# Set required variables
 +		eval pflog_dev=\$pflog_${i}_dev
 +		eval pflog_logfile=\$pflog_${i}_logfile
 +		eval pflog_flags=\$pflog_${i}_flags
 +		# Check that required vars have non-zero length, warn if not.
 +		if [ -z $pflog_dev ]; then
 +			warn "pflog_dev not set"
 +			continue
 +		fi
 +		if [ -z $pflog_logfile ]; then
 +			warn "pflog_logfile not set"
 +			continue
 +		fi
 +		# pflogd sets a pidfile, but the name is hardcoded. Concoct a
 +		# unique pidfile name.
 +		pidfile="/var/run/pflogd.$i.pid"
 +		run_rc_command "$1"
 +	done
 +else
 +	# Typical case, spawn single instance only.
 +	pflog_dev=${pflog_dev:-"pflog0"}
 +	run_rc_command "$1"
 +fi
 
 Modified: head/share/man/man5/rc.conf.5
 ==============================================================================
 --- head/share/man/man5/rc.conf.5	Wed Nov 13 01:51:40 2013	(r258079)
 +++ head/share/man/man5/rc.conf.5	Wed Nov 13 03:50:31 2013	(r258080)
 @@ -917,6 +917,33 @@ Empty by default.
  This variable contains additional flags passed to the
  .Xr pflogd 8
  program.
 +.It Va pflog_instances
 +.Pq Vt str
 +If logging to more than one 
 +.Xr pflog 4
 +interface is desired, 
 +.Va pflog_instances
 +is set to the list of
 +.Xr pflogd 8
 +instances that should be started at system boot time. If 
 +.Va pflog_instances
 +is set, for each whitespace-seperated
 +.Ar element
 +in the list,
 +.Ao Ar element Ac Ns Va _dev
 +and
 +.Ao Ar element Ac Ns Va _logfile
 +elements are assumed to exist.
 +.Ao Ar element Ac Ns Va _dev
 +must contain the
 +.Xr pflog 4
 +interface to be watched by the named
 +.Xr pflogd 8
 +instance.
 +.Ao Ar element Ac Ns Va _logfile
 +must contain the name of the logfile that will be used by the
 +.Xr pflogd 8
 +instance.
  .It Va ftpproxy_enable
  .Pq Vt bool
  Set to
 @@ -935,6 +962,19 @@ Empty by default.
  This variable contains additional flags passed to the
  .Xr ftp-proxy 8
  program.
 +.It Va ftpproxy_instances
 +.Pq Vt str
 +Empty by default. If multiple instances of
 +.Xr ftp-proxy 8
 +are desired at boot time, 
 +.Va ftpproxy_instances
 +should contain a whitespace-seperated list of instance names. For each
 +.Ar element
 +in the list, a variable named
 +.Ao Ar element Ac Ns Va _flags
 +should be defined, containing the command-line flags to be passed to the
 +.Xr ftp-proxy 8
 +instance.
  .It Va pfsync_enable
  .Pq Vt bool
  Set to
 _______________________________________________
 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:
