Date: Thu, 16 Nov 2006 09:20:49 GMT From: Nicolas Szalay<nico@rottenbytes.info> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/105601: ucarp port miss a startup script Message-ID: <200611160920.kAG9Kned077590@www.freebsd.org> Resent-Message-ID: <200611160930.kAG9U22m023011@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <nico@rottenbytes.info> +# +# 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 <file> to become a master +# ucarp_downscript: Run <file> 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611160920.kAG9Kned077590>