From nobody@FreeBSD.org  Sun Jun 13 08:57:03 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 5852B1065680
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Jun 2010 08:57:03 +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 466938FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Jun 2010 08:57:03 +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 o5D8v2O8032096
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Jun 2010 08:57:02 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o5D8v2MA032083;
	Sun, 13 Jun 2010 08:57:02 GMT
	(envelope-from nobody)
Message-Id: <201006130857.o5D8v2MA032083@www.freebsd.org>
Date: Sun, 13 Jun 2010 08:57:02 GMT
From: Olivier Cochard-Labb <olivier@cochard.me>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Improved ucarp startup script: multiple VHID and FIB support
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         147829
>Category:       ports
>Synopsis:       Improved net/ucarp startup script: multiple VHID and FIB support
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 13 09:00:08 UTC 2010
>Closed-Date:    Wed Dec 07 14:52:22 UTC 2011
>Last-Modified:  Wed Dec 07 14:52:22 UTC 2011
>Originator:     Olivier Cochard-Labb
>Release:        8.0-STABLE
>Organization:
BSD Router Project
>Environment:
FreeBSD d630.bsdrp.net 8.0-STABLE FreeBSD 8.0-STABLE #70: Wed May 12 13:00:32 CEST 2010     root@d630.bsdrp.net:/usr/obj/usr/src/sys/DellD630  amd64

>Description:
This proposal for a new ucarp rc script permit to start multiple ucarp for supporting multiple VHID and add FIB support.

The rc.conf file should be configured like that:

# uCarp
# Virtual IP identifier range is 1-255 (ucarp_1 to ucarp_255)
ucarp_enable="NO"                       # Enable ucarp
# Here are an exemple for VHID number 1:
ucarp_1_if="em0"                        # Set interface to use for ucarp checks
ucarp_1_src="192.168.1.2"       # Set source (real) IP address of that host
ucarp_1_pass="passcarp"         # Set password
ucarp_1_preempt="NO"        # Set it to "YES" to become a master as soon as possible
ucarp_1_addr="192.168.1.1"  # Set virtual shared IP address
# ucarp_1_advbase:          # Set advertisement frequency (seconds)
# ucarp_1_advskew:          # Set advertisement skew (0-255)
# ucarp_1_upscript:         # Run <file> to become a master
# ucarp_1_downscript:       # Run <file> to become a backup
# ucarp_1_deadratio:        # Set ratio to consider a host as dead
ucarp_1_shutdown="NO"       # Set it to "YES"  to call shutdown script at exit
ucarp_1_facility="daemon"   # Set syslog facility
ucarp_1_broadcast="NO"      # Set it to "YES"  to use broadcast in place of multicast
ucarp_1_fib="NONE"       # set the alternative routing table id that ucarp should use


>How-To-Repeat:

>Fix:


Patch attached with submission follows:

#!/bin/sh
#
# BSD Router Project:	ucarp Init script with multiple VHID and FIB support 
# http://bsdrp.net
#
# Based on the FreeBSD ucarp script from Nico <nico@rottenbytes.info>
#
# Copyright (c) 2010, The BSDRP Development Team 
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE PROJECT ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# PROVIDE: ucarp
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable & configure ucarp:
#
# ucarp_enable (bool):		Set it to "YES" to enable ucarp
#		Default is "NO".
# For all others variable, VHID is the Virtual IP identifier number (1-255)
# ucarp_VHID_if:			Set interface to use for ucarp checks
#		Default is "eth0"
# ucarp_VHID_src:			Set source (real) IP address of that host
# ucarp_VHID_pass:			Set password
#		Default is "dumbp4ss"
# ucarp_VHID_preempt (bool):		Set it to "YES" to become a master as soon as possible
#		Default is "NO"
# ucarp_VHID_addr:			Set virtual shared IP address
# ucarp_VHID_advbase:		Set advertisement frequency (seconds)
# ucarp_VHID_advskew:		Set advertisement skew (0-255)
# ucarp_VHID_upscript:		Run <file> to become a master
# ucarp_VHID_downscript:		Run <file> to become a backup
# ucarp_VHID_deadratio:		Set ratio to consider a host as dead
# ucarp_VHID_shutdown (bool):	Set it to "YES"  to call shutdown script at exit
#		Default is "YES"
# ucarp_VHID_facility:		Set syslog facility
#		Default is "daemon"
# ucarp_VHID_broadcast (bool):   Set it to "YES" to use Broadcast in place of multicast
#       Default is "NO"
# ucarp_VHID_fib:    		The alternative routing table id that ucarp should use
#       Default is "NONE"


. /etc/rc.subr

name="ucarp"
rcvar=`set_rcvar`
command="/usr/local/sbin/$name"

load_rc_config $name

start_cmd="${name}_start"

ucarp_start ()
{

for i in `jot - 1 255`; do
	# Now we need to use a variable-variable name :-(
	# eval will help us, but all:
	# -  non-variable-variable name
	# - " 
	# must be escaped with \

	eval "
		if ! [ -z \$ucarp_${i}_if ]; then
			# override these variables in /etc/rc.conf
			ucarp_${i}_pass=\${ucarp_${i}_pass:-\"dumbp4ss\"}
			ucarp_${i}_preempt=\${ucarp_${i}_preempt:-\"NO\"}
           	ucarp_${i}_shutdown=\${ucarp_${i}_shutdown:-\"NO\"}
           	ucarp_${i}_facility=\${ucarp_${i}_facility:-\"daemon\"}
            ucarp_${i}_broadcast=\${ucarp_${i}_broadcast:-\"NO\"}
			ucarp_${i}_fib=\${ucarp_${i}_fib:-\"NONE\"}

    		if [ \"\${ucarp_${i}_fib}\" != \"NONE\" ]; then
				if ! [ `sysctl net.fibs >/dev/null 2>&1` ]; then
        			command=\"setfib -F \${ucarp_${i}_fib} /usr/local/sbin/$name\"
    			else
					echo \"FIB configured for VHID $i but FIB not enabled ! please enable it\"
                	exit 1
    			fi
			fi
			
			command_args=\"-i \$ucarp_${i}_if -v $i -p \$ucarp_${i}_pass -f \$ucarp_${i}_facility -B \"

			if [ \$ucarp_${i}_preempt = \"YES\" ]; then
        		command_args=\${command_args}\"-P \"
    		fi

			if [ \$ucarp_${i}_shutdown = \"YES\" ]; then
           		command_args=\${command_args}\"-z \"
           	fi

			if [ \$ucarp_${i}_broadcast = \"YES\" ]; then
                command_args=\${command_args}\"-M \"
            fi

			# Mandatory arguments
    		if [ -z \$ucarp_${i}_src ]; then
        		echo \"source address is not set for VHID $i ! please set it\"
        		exit 1
    		fi

    		if [ -z \$ucarp_${i}_addr ]; then
        		echo \"virtual address is not set for VHID $i ! please set it\"
        		exit 1
    		fi
	
			command_args=\${command_args}\"-s \$ucarp_${i}_src -a \$ucarp_${i}_addr \"
	
			# Optional args
			if ! [ -z \$ucarp_${i}_upscript ]; then
				command_args=\${command_args}\"-u \$ucarp_${i}_upscript \"
			fi
			if ! [ -z \$ucarp_${i}_downscript ]; then
				command_args=\${command_args}\"-d \$ucarp_${i}_downscript \"
			fi
			if ! [ -z \$ucarp_${i}_deadratio ]; then
				command_args=\${command_args}\"-r \$ucarp_${i}_deadratio \"
			fi
			if ! [ -z \$ucarp_${i}_advbase ]; then
				command_args=\${command_args}\"-b \$ucarp_${i}_advbase \"
			fi
			if ! [ -z \$ucarp_${i}_advskew ]; then
				command_args=\${command_args}\"-k \$ucarp_${i}_advskew \"
			fi
			\$command \$command_args
		fi
	"
done
}

run_rc_command "$1"


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: stefan 
State-Changed-When: Thu Jul 1 11:59:17 UTC 2010 
State-Changed-Why:  
Awaiting maintainer's feedback. 

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

From: Stefan Walter <stefan@freebsd.org>
To: "Alexey V.Degtyarev" <alexey@renatasystems.org>
Cc: GNATS <FreeBSD-gnats-submit@FreeBSD.org>
Subject: Re: ports/147829: Improved net/ucarp startup script: multiple VHID
 and FIB support
Date: Thu, 1 Jul 2010 13:59:03 +0200

 Dear maintainer of net/ucarp,
 
 a problem report has been submitted for your port for which your 
 feedback might be required; its contents can be found at [1]. If it 
 contains a patch or suggestions for a change, please send a followup to 
 the PR explaining whether or not you approve it and want it to be 
 committed.
 
 Regards,
 Stefan
 
 [1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/147829

From: "Alexey V. Degtyarev" <alexey@renatasystems.org>
To: Stefan Walter <stefan@freebsd.org>
Cc: GNATS <FreeBSD-gnats-submit@FreeBSD.org>
Subject: Re: ports/147829: Improved net/ucarp startup script: multiple VHID
 and FIB support
Date: Thu, 1 Jul 2010 17:15:42 +0400

 --4dPuo10YNMwpRGtG
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hi Stefan,
 
 On 13:59 Thu 01 Jul, Stefan Walter wrote:
 
 > a problem report has been submitted for your port for which your=20
 > feedback might be required; its contents can be found at [1]. If it=20
 > contains a patch or suggestions for a change, please send a followup to=
 =20
 > the PR explaining whether or not you approve it and want it to be=20
 > committed.
 >
 > [1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dports/147829
 
 Recently I just thought about implementing a support for multiple
 VHIDs with UCARP. I'll try to find a way to do it with "profiles" like
 it in www/apache22 or www/nginx rc-scripts done. Would it be acceptable
 for you?
 
 Next, I'll check for FIB support.
 
 All the best,
 --=20
 Alexey V. Degtyarev
 
 --4dPuo10YNMwpRGtG
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.9 (FreeBSD)
 
 iQEcBAEBAgAGBQJMLJT+AAoJEBltwwVHB+frfKcH/Aw/Q44/JIYXTe7VXHbGHAd8
 95i9SLDQFNBW98pmuMtb6ZahD7/TMC69JoGEBIH2TrdtuCDDZvVA+IT4p1ueXBRw
 M2976St2f9+a8tYNryZW8VR9RomNZuhXR2+gDKhCUyXN0XTBKiZH/PfdGaOi9qpo
 PugYEYiZKIk+H7OqWDCRZZjd/Sel0u9CXO+yANej0BPow/vfNstAtM4FRMCwPbVJ
 YWVJ2eljwe2CbCoGoZE/e1P9WKp80Dr+HjuynJGwhTgNNhl2ugqYDl7suDU8us9p
 U1hbuWKeqidmKUGtabjQ7+tv4mBnUaOCGf/W865t4OiTW2qV2tdS/MF3FGTvvz0=
 =QY22
 -----END PGP SIGNATURE-----
 
 --4dPuo10YNMwpRGtG--

From: Stefan Walter <stefan@freebsd.org>
To: "Alexey V. Degtyarev" <alexey@renatasystems.org>,
	Olivier =?iso-8859-1?Q?Cochard-Labb=E9?= <olivier@cochard.me>
Cc: GNATS <FreeBSD-gnats-submit@FreeBSD.org>
Subject: Re: ports/147829: Improved net/ucarp startup script: multiple VHID
 and FIB support
Date: Sat, 3 Jul 2010 13:53:55 +0200

 Hi Alexey,
 
 Alexey V. Degtyarev, 01.07.10, 15:15h CEST:
 
 > Hi Stefan,
 > 
 > On 13:59 Thu 01 Jul, Stefan Walter wrote:
 > 
 > > a problem report has been submitted for your port for which your 
 > > feedback might be required; its contents can be found at [1]. If it 
 > > contains a patch or suggestions for a change, please send a followup to 
 > > the PR explaining whether or not you approve it and want it to be 
 > > committed.
 > >
 > > [1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/147829
 > 
 > Recently I just thought about implementing a support for multiple
 > VHIDs with UCARP. I'll try to find a way to do it with "profiles" like
 > it in www/apache22 or www/nginx rc-scripts done. Would it be acceptable
 > for you?
 
 I don't know - I don't use this port. ;-) I merely wanted to draw your
 attention to this PR. It was Olivier who sent the proposal. Since you're
 the maintainer of the port, it's up to you how to handle this. I would
 encourage you two to find a way acceptable for both, though, since you
 both seem to be interested in this port.
 
 In case something should be committed, please send a followup to this PR
 so a committer can pick it up.
 
 Best regards,
 Stefan

From: "Alexey V. Degtyarev" <alexey@renatasystems.org>
To: Stefan Walter <stefan@freebsd.org>
Cc: Olivier =?iso-8859-1?Q?Cochard-Labb=E9?= <olivier@cochard.me>,
  GNATS <FreeBSD-gnats-submit@FreeBSD.org>
Subject: Re: ports/147829: Improved net/ucarp startup script: multiple VHID
 and FIB support
Date: Fri, 9 Jul 2010 18:00:38 +0400

 --WIyZ46R2i8wDzkSu
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Stefan, Oliver,
 
 On 13:53 Sat 03 Jul, Stefan Walter wrote:
 
 > > On 13:59 Thu 01 Jul, Stefan Walter wrote:
 > >=20
 > > > a problem report has been submitted for your port for which your
 > > > feedback might be required; its contents can be found at [1]. If
 > > > it contains a patch or suggestions for a change, please send a
 > > > followup to the PR explaining whether or not you approve it and
 > > > want it to be committed.
 > > >
 > > > [1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dports/147829
 > >=20
 > > Recently I just thought about implementing a support for multiple
 > > VHIDs with UCARP. I'll try to find a way to do it with "profiles"
 > > like it in www/apache22 or www/nginx rc-scripts done. Would it be
 > > acceptable for you?
 >=20
 > I don't know - I don't use this port. ;-) I merely wanted to draw your
 > attention to this PR. It was Olivier who sent the proposal. Since
 > you're the maintainer of the port, it's up to you how to handle this.
 > I would encourage you two to find a way acceptable for both, though,
 > since you both seem to be interested in this port.
 >=20
 > In case something should be committed, please send a followup to this
 > PR so a committer can pick it up.
 
 well, I was confused because have never received pr-followup of "waiting
 for maintainer to approve" from a real, alive person. So I thought you are
 interested somehow it that particular pr/functionality.
 
 As for that pr, it is blocked by ports/148012 maintainer-update which is
 still waiting for commit (just for Oliver's info).
 
 Best regards,
 --=20
 Alexey V. Degtyarev
 
 --WIyZ46R2i8wDzkSu
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.9 (FreeBSD)
 
 iQEcBAEBAgAGBQJMNyuGAAoJEBltwwVHB+frwNEH/RrsOrlPwFkbucq8c4DfBJij
 SGTWTPjaj2O1Ih5/5yvzNk4k6yIQfl5S7pdz8+oBs4wKLek1qmBv/nQOTGJVVvrm
 rY8/eO30bd8Z71P3PKMYpofnYPu103iyk5DtKkq+6Kz8OW5U2Nm2p/58WfKZg8mC
 xK0fZn+CxlaAzE7mdU6Z0Vg2fuR53Yv29GvxURNj8GoqPwP2mTGDW8sw7vw2UKVt
 nso23pfY6I+Xu99h5bG7qS3iR7X3k/VHBjrYYyyqao2RmDfm9k1GVO1Dyr6orCU4
 scRl7m1XX0pZzMy+emgUFWjRpQlbnf4t2ynMIx9MPccAKnQHMf19jL6oLiAeKo4=
 =Wnz9
 -----END PGP SIGNATURE-----
 
 --WIyZ46R2i8wDzkSu--
Responsible-Changed-From-To: freebsd-ports-bugs->bapt 
Responsible-Changed-By: bapt 
Responsible-Changed-When: Wed Aug 18 15:16:44 UTC 2010 
Responsible-Changed-Why:  
I'll take it. 

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

From: Bapt <bapt@FreeBSD.org>
To: alexey@renatasystems.org
Cc: olivier@cochard.me, bug-followup@FreeBSD.org
Subject: Re: ports/147829: Improved net/ucarp startup script: multiple VHID
 and FIB support
Date: Wed, 18 Aug 2010 17:23:17 +0200

 --Vy1A5eXR7jld12ZH
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Now that ports/148012 is committed what about this one?
 
 regards,
 Bapt
 
 --Vy1A5eXR7jld12ZH
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.16 (FreeBSD)
 
 iEYEARECAAYFAkxr+uUACgkQ8kTtMUmk6Ez2fgCghHiwJYrB0wjtAeU5POe2NgVA
 pL4AoIJnye3WqU8y8dVNFfkSTYetTlZA
 =LZf+
 -----END PGP SIGNATURE-----
 
 --Vy1A5eXR7jld12ZH--

From: "Alexey V. Degtyarev" <alexey@renatasystems.org>
To: Bapt <bapt@FreeBSD.org>
Cc: olivier@cochard.me, bug-followup@FreeBSD.org
Subject: Re: ports/147829: Improved net/ucarp startup script: multiple VHID
 and FIB support
Date: Wed, 18 Aug 2010 19:53:06 +0400

 --9l24NVCWtSuIVIod
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hi Bart, hi Oliver,
 
 On 17:23 Wed 18 Aug, Bapt wrote:
 
 > Now that ports/148012 is committed what about this one?
 
 Sorry Oliver, seems that I completely forgot about this PR.
 
 I think this one should be closed. I'll split task on two: firstly, I'll
 create profiles functionality. Secondly, I'll implement FID support.
 
 I think both PRs will be submitted on this week or at least on the next
 one. Suggestions are welcome as well.
 
 Cheers,
 --=20
 Alexey V. Degtyarev
 
 --9l24NVCWtSuIVIod
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.9 (FreeBSD)
 
 iQEcBAEBAgAGBQJMbAHiAAoJEBltwwVHB+frRtUH/AqTe07aprxesxgHk/FmjIaf
 SgvCGhhWIGXy1gIop1EENeaCQooe3kSF7UlWRYYHlwOC28J05nkt+o7CsohmuaCG
 SkB6k5dmB5OueIw7izhqENTzTVwDDWiG9paudehLqD349ue0rgbFFX5KAK9UdRcs
 ya6vhL43TdHINFe+mmiF5H2MeZxo4PYOFgEl9rAtv60IsGMG3hXxkvuwfTecUJYp
 WKTgfNr1qK0TVVL5pigVxnr74iYMNP0TxUf/smJS8HqKeM9dhfIv2HMJo9FaSz78
 KH7MFoSwWj2KKs5gMGPExA8Ou3laz9n+m/ghRXO+ggal/DgiWmdDEQimp0X3YOc=
 =MQqo
 -----END PGP SIGNATURE-----
 
 --9l24NVCWtSuIVIod--
State-Changed-From-To: feedback->suspended 
State-Changed-By: bapt 
State-Changed-When: Fri Sep 3 18:08:11 UTC 2010 
State-Changed-Why:  
Maintainer is working on a new patches 


http://www.freebsd.org/cgi/query-pr.cgi?pr=147829 
Responsible-Changed-From-To: bapt->freebsd-ports-bugs 
Responsible-Changed-By: bapt 
Responsible-Changed-When: Fri Sep 3 18:09:35 UTC 2010 
Responsible-Changed-Why:  
Back to the pool 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147829 
State-Changed-From-To: suspended->closed  
State-Changed-By: scheidell 
State-Changed-When: Wed Dec 7 14:51:47 UTC 2011 
State-Changed-Why:  
Closed at submitter's request 

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