From owner-freebsd-bugs@FreeBSD.ORG Thu Nov 16 09:30:08 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA1B016A40F for ; Thu, 16 Nov 2006 09:30:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A2D1643D79 for ; Thu, 16 Nov 2006 09:30:07 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kAG9U2Mn023012 for ; Thu, 16 Nov 2006 09:30:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kAG9U22m023011; Thu, 16 Nov 2006 09:30:02 GMT (envelope-from gnats) Resent-Date: Thu, 16 Nov 2006 09:30:02 GMT Resent-Message-Id: <200611160930.kAG9U22m023011@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, Nicolas Szalay Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 713D216A407 for ; Thu, 16 Nov 2006 09:20:50 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 42E4943D4C for ; Thu, 16 Nov 2006 09:20:50 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kAG9KnMv077591 for ; Thu, 16 Nov 2006 09:20:49 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id kAG9Kned077590; Thu, 16 Nov 2006 09:20:49 GMT (envelope-from nobody) Message-Id: <200611160920.kAG9Kned077590@www.freebsd.org> Date: Thu, 16 Nov 2006 09:20:49 GMT From: Nicolas Szalay To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: misc/105601: ucarp port miss a startup script 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: Thu, 16 Nov 2006 09:30:08 -0000 >Number: 105601 >Category: misc >Synopsis: ucarp port miss a startup script >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 16 09:30:01 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Nicolas Szalay >Release: 6.1-RELEASE >Organization: >Environment: FreeBSD aragorn.qualigaz-int 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:42:56 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP i386 >Description: I decided to use ucarp to make redundant firewalls, and I noticed that there was no startup script included. You have to start by hand, and it cannot start at boot. >How-To-Repeat: portinstall ucarp ;) >Fix: The provided patch is a rc.d script (this is my first one for a BSD) the ucarp stuff I use in rc.conf : ~> grep ucarp /etc/rc.conf # ucarp stuff ucarp_enable="YES" ucarp_src="192.168.30.228" ucarp_addr="192.168.30.231" ucarp_if="bge0" ucarp_upscript="/home/nico/ip-up.sh" ucarp_downscript="/home/nico/ip-down.sh" But there is a bit more possible (due to the fact that ucarp has no configuration file) Patch attached with submission follows: --- ucarp.empty 2006-11-16 10:20:02.000000000 +0100 +++ ucarp 2006-11-16 10:18:59.000000000 +0100 @@ -0,0 +1,103 @@ +#!/bin/sh +# +# Init script : ucarp for FreeBSD +# By Nico +# +# 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". +# ucarp_if: Set interface to use for ucarp checks +# Default is "eth0" +# ucarp_src: Set source (real) IP address of that host +# ucarp_vhid: Set virtual IP identifier (1-255) +# Default is "1" +# ucarp_pass: Set password +# Default is "dumbp4ss" +# ucarp_preempt (bool): Set it to "YES" to become a master as soon as possible +# Default is "NO" +# ucarp_addr: Set virtual shared IP address +# ucarp_advbase: Set advertisement frequency (seconds) +# ucarp_advskew: Set advertisement skew (0-255) +# ucarp_upscript: Run to become a master +# ucarp_downscript: Run to become a backup +# ucarp_deadratio: Set ratio to consider a host as dead +# ucarp_shutdown (bool): Set it to "YES" to call shutdown script at exit +# Default is "YES" +# ucarp_facility: Set syslog facility +# Default is "daemon" + +. /etc/rc.subr + +name="ucarp" +rcvar=`set_rcvar` + +load_rc_config $name + +: ${ucarp_enable="NO"} +: ${ucarp_if="eth0"} +: ${ucarp_vhid="1"} +: ${ucarp_pass="dumbp4ss"} +: ${ucarp_preempt="NO"} +: ${ucarp_shutdown="YES"} +: ${ucarp_facility="daemon"} + +command=/usr/local/sbin/ucarp +command_args="-i ${ucarp_if} -v ${ucarp_vhid} -p ${ucarp_pass} -f ${ucarp_facility} -B " +start_precmd="build_command_args" + +build_command_args() +{ + if [ ${ucarp_preempt} = "YES" ] + then + command_args=${command_args}"-P " + fi + + if [ ${ucarp_shutdown} = "YES" ] + then + command_args=${command_args}"-z " + fi + + # Mandatory arguments + if [ -z ${ucarp_src} ] + then + echo "source address is not set ! please set it" + exit 1 + fi + + if [ -z ${ucarp_addr} ] + then + echo "virtual address is not set ! please set it" + exit 1 + fi + + command_args=${command_args}"-s ${ucarp_src} -a ${ucarp_addr} " + + # Optional args + if ! [ -z ${ucarp_upscript} ] + then + command_args=${command_args}"-u ${ucarp_upscript} " + fi + if ! [ -z ${ucarp_downscript} ] + then + command_args=${command_args}"-d ${ucarp_downscript} " + fi + if ! [ -z ${ucarp_deadratio} ] + then + command_args=${command_args}"-r ${ucarp_deadratio} " + fi + if ! [ -z ${ucarp_advbase} ] + then + command_args=${command_args}"-b ${ucarp_advbase} " + fi + if ! [ -z ${ucarp_advskew} ] + then + command_args=${command_args}"-k ${ucarp_advskew} " + fi +} + +run_rc_command "$1" >Release-Note: >Audit-Trail: >Unformatted: