From owner-freebsd-bugs@FreeBSD.ORG Fri Jan 22 16:00:10 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F30A2106566C for ; Fri, 22 Jan 2010 16:00:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B775B8FC19 for ; Fri, 22 Jan 2010 16:00:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o0MG093R012528 for ; Fri, 22 Jan 2010 16:00:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o0MG09Dt012527; Fri, 22 Jan 2010 16:00:09 GMT (envelope-from gnats) Resent-Date: Fri, 22 Jan 2010 16:00:09 GMT Resent-Message-Id: <201001221600.o0MG09Dt012527@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Marcelo Rossi Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E4C41065672 for ; Fri, 22 Jan 2010 15:54:39 +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 6E3838FC13 for ; Fri, 22 Jan 2010 15:54:39 +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 o0MFsd59014764 for ; Fri, 22 Jan 2010 15:54:39 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o0MFsdHJ014743; Fri, 22 Jan 2010 15:54:39 GMT (envelope-from nobody) Message-Id: <201001221554.o0MFsdHJ014743@www.freebsd.org> Date: Fri, 22 Jan 2010 15:54:39 GMT From: Marcelo Rossi To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: conf/143085: ftp-proxy(8) rc(8) with multiple instances X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2010 16:00:10 -0000 >Number: 143085 >Category: conf >Synopsis: ftp-proxy(8) rc(8) with multiple instances >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Fri Jan 22 16:00:09 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Marcelo Rossi >Release: 7.2 >Organization: >Environment: FreeBSD mt.mii.com.br 7.2-STABLE FreeBSD 7.2-STABLE #0: Tue Jan 19 07:21:37 BRST 2010 prisma@mt.mii.com.br:/usr/obj/usr/src/sys/KERNEL.MT i386 >Description: We can do inbound or outbound proxy of ftp connections with ftp-proxy(8). But the /etc/rc.d/ftp-proxy just allow one instance of the proxy. If we need to run an inbound **AND** outbound proxy, we need two instances of ftp-proxy. So I have modified the /etc/rc.d/ftpproxy and /etc/rc.conf to allow more than one instance. We can add at /etc/rc.conf some variables: ftpproxy_exec="exec1 exec2 execN" ftpproxy_exec1="" ftpproxy_exec2=-p8010 -R ftpserverhost ftpproxy_execN="-p8020" The var 'ftpproxy_exec' is a list with the instance names, the script (/etc/rc.d/ftp-proxy) will search for the vars 'ftpproxy_{LIST_ITEM}' The 'ftpproxy_{LIST_ITEM}' will contain the same thing that normally contains the 'ftpproxy_flags' var, or a empty string. >How-To-Repeat: >Fix: Patch attached with submission follows: --- /etc/rc.d/ftp-proxy 2010-01-22 12:32:52.000000000 -0200 +++ /etc/rc.d/ftp-proxy 2010-01-22 13:16:01.000000000 -0200 @@ -14,4 +14,20 @@ command="/usr/sbin/ftp-proxy" load_rc_config $name + +start_cmd=start_func + +start_func() +{ + if [ ${#ftpproxy_exec} = "0" ] + then + $command $ftpproxy_flags + else + for exec in $ftpproxy_exec ; do + eval args_exec=\$ftpproxy_$exec + $command $args_exec + done + fi +} + run_rc_command "$1" --- /etc/defaults/rc.conf 2010-01-22 12:34:49.000000000 -0200 +++ /etc/defaults/rc.conf 2010-01-22 13:12:03.000000000 -0200 @@ -174,6 +174,9 @@ pflog_flags="" # additional flags for pflogd ftpproxy_enable="NO" # Set to YES to enable ftp-proxy(8) for pf ftpproxy_flags="" # additional flags for ftp-proxy(8) +#ftpproxy_exec="exec1 exec2" # multiple instances of ftp-proxy. +#ftpproxy_exec1="" # first instance +#ftpproxy_exec2="-p8010 -R host"# second instance pfsync_enable="NO" # Expose pf state to other hosts for syncing pfsync_syncdev="" # Interface for pfsync to work through pfsync_syncpeer="" # IP address of pfsync peer host >Release-Note: >Audit-Trail: >Unformatted: