OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Michael Schloh
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   02-Nov-2004 18:58:32
  Branch: HEAD                             Handle: 2004110217583000

  Added files:
    openpkg-src/ucarp       ucarp.patch
  Modified files:
    openpkg-src/ucarp       rc.ucarp ucarp.spec vip-down.sh vip-up.sh

  Log:
    allow fine grained control over runtime configuration, correct mode of
    and expand syntax of up and down scripts, improve description, patch
    to correctly find and use network devices either implicitly or
    explicitly, and unfortunately remove all short option forms because
    they are horribly implemented (segfault most of the time)

  Summary:
    Revision    Changes     Path
    1.4         +12 -2      openpkg-src/ucarp/rc.ucarp
    1.1         +74 -0      openpkg-src/ucarp/ucarp.patch
    1.6         +5  -3      openpkg-src/ucarp/ucarp.spec
    1.3         +19 -1      openpkg-src/ucarp/vip-down.sh
    1.3         +19 -1      openpkg-src/ucarp/vip-up.sh
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/rc.ucarp
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 rc.ucarp
  --- openpkg-src/ucarp/rc.ucarp        29 Aug 2004 10:07:47 -0000      1.3
  +++ openpkg-src/ucarp/rc.ucarp        2 Nov 2004 17:58:30 -0000       1.4
  @@ -5,7 +5,13 @@
   
   %config
       ucarp_enable="$openpkg_rc_def"
  -    ucarp_flags=""
  +    ucarp_nic="eth0"
  +    ucarp_pass="fong"
  +    ucarp_vhid="64"
  +    ucarp_realip="127.0.0.1"
  +    ucarp_fakeip="127.0.0.2"
  +    ucarp_upscript="@l_prefix@/etc/ucarp/vip-up.sh"
  +    ucarp_dnscript="@l_prefix@/etc/ucarp/vip-down.sh"
       ucarp_log_prolog="true"
       ucarp_log_epilog="true"
       ucarp_log_numfiles="10"
  @@ -30,7 +36,11 @@
   %start -u @l_susr@
       rcService ucarp enable yes || exit 0
       rcService ucarp active yes && exit 0
  -    @l_prefix@/sbin/ucarp ${ucarp_flags} >/dev/null 2>&1 &
  +    @l_prefix@/sbin/ucarp --interface=${ucarp_nic} \
  +        --pass=${ucarp_pass} --vhid=${ucarp_vhid} \
  +        --srcip=${ucarp_realip} --addr=${ucarp_fakeip} \
  +        --upscript=${ucarp_upscript} --downscript=${ucarp_dnscript} \
  +        >/dev/null 2>&1 &
       echo $! >$ucarp_pidfile
   
   %stop -u @l_susr@
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/ucarp.patch
  ============================================================================
  $ cvs diff -u -r0 -r1.1 ucarp.patch
  --- /dev/null 2004-11-02 18:58:31 +0100
  +++ ucarp.patch       2004-11-02 18:58:31 +0100
  @@ -0,0 +1,74 @@
  +Index: src/fillmac.c
  +diff -Nau src/fillmac.c.orig src/fillmac.c
  +--- src/fillmac.c.orig       2004-11-02 13:44:05.332518385 +0100
  ++++ src/fillmac.c    2004-11-02 14:19:17.771423871 +0100
  +@@ -130,13 +130,13 @@
  +             return -1;
  +         }        
  +         lifr = lifc.lifc_req;
  +-        while (--lifn.lifn_count > 0) {
  ++        while (lifn.lifn_count-- > 0) {
  +             if (strcmp(lifr->lifr_name, interface) == 0) {
  +                 break;
  +             }          
  +             lifr++;
  +         }
  +-        if (lifn.lifn_count <= 0) {
  ++        if (lifn.lifn_count < 0) {
  +             logfile(LOG_ERR, _("Interface [%s] not found"), interface);
  +             ALLOCA_FREE(lifrspace);
  +             return -1;            
  +Index: src/ucarp_p.h
  +diff -Nau src/ucarp_p.h.orig src/ucarp_p.h
  +--- src/ucarp_p.h.orig       2004-11-02 15:46:51.076457056 +0100
  ++++ src/ucarp_p.h    2004-11-02 16:06:45.548484801 +0100
  +@@ -1,7 +1,7 @@
  + #ifndef __CARP_P_H__
  + #define __CARP_P_H__ 1
  + 
  +-static const char *GETOPT_OPTIONS = "i:s:v:p:Pa:hb:k:u:d:r:zf:B";
  ++static const char *GETOPT_OPTIONS = "";
  + 
  + static struct option long_options[] = {
  +     { "interface", 1, NULL, 'i' },
  +Index: src/ucarp.c
  +diff -Nau src/ucarp.c.orig src/ucarp.c
  +--- src/ucarp.c.orig 2004-08-28 18:04:05.000000000 +0200
  ++++ src/ucarp.c      2004-11-02 16:10:59.801007425 +0100
  +@@ -23,21 +23,21 @@
  + {
  +     puts("\n" PACKAGE_STRING " - " __DATE__ "\n");
  +     fputs(_(
  +-           "--interface=<if> (-i <if>): bind interface <if>\n"
  +-           "--srcip=<ip> (-s <ip>): source (real) IP address of that host\n"
  +-           "--vhid=<id> (-v <id>): virtual IP identifier (1-255)\n"
  +-           "--pass=<pass> (-p <pass>): password\n"
  +-           "--preempt (-P): becomes a master as soon as possible\n"
  +-           "--addr=<ip> (-a <ip>): virtual shared IP address\n"
  +-           "--help (-h): summary of command-line options\n"
  +-           "--advbase=<seconds> (-b <seconds>): advertisement frequency\n"
  +-           "--advskew=<skew> (-k <skew>): advertisement skew (0-255)\n"
  +-           "--upscript=<file> (-u <file>): run <file> to become a master\n"
  +-           "--downscript=<file> (-d <file>): run <file> to become a backup\n"
  +-           "--deadratio=<ratio> (-r <ratio>): ratio to consider a host as dead\n"
  +-           "--shutdown (-z): call shutdown script at exit\n"
  +-           "--daemonize (-B): run in background\n"
  +-           "--facility=<facility> (-f): set syslog facility (default=daemon)\n"
  ++           "--interface=<if>: bind interface <if>\n"
  ++           "--srcip=<ip>: source (real) IP address of that host\n"
  ++           "--vhid=<id>: virtual IP identifier (1-255)\n"
  ++           "--pass=<pass>: password\n"
  ++           "--preempt: becomes a master as soon as possible\n"
  ++           "--addr=<ip>: virtual shared IP address\n"
  ++           "--help: summary of command-line options\n"
  ++           "--advbase=<seconds>: advertisement frequency\n"
  ++           "--advskew=<skew>: advertisement skew (0-255)\n"
  ++           "--upscript=<file>: run <file> to become a master\n"
  ++           "--downscript=<file>: run <file> to become a backup\n"
  ++           "--deadratio=<ratio>: ratio to consider a host as dead\n"
  ++           "--shutdown: call shutdown script at exit\n"
  ++           "--daemonize: run in background\n"
  ++           "--facility=<facility>: set syslog facility (default=daemon)\n"
  +            "\n"
  +            "Sample usage:\n"
  +            "\n"
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/ucarp.spec
  ============================================================================
  $ cvs diff -u -r1.5 -r1.6 ucarp.spec
  --- openpkg-src/ucarp/ucarp.spec      3 Sep 2004 14:02:07 -0000       1.5
  +++ openpkg-src/ucarp/ucarp.spec      2 Nov 2004 17:58:30 -0000       1.6
  @@ -34,7 +34,7 @@
   Group:        Network
   License:      Specific
   Version:      1.1
  -Release:      20040903
  +Release:      20041102
   
   #   package options
   %option       with_fsl  yes
  @@ -45,6 +45,7 @@
   Source2:      fsl.ucarp
   Source3:      vip-up.sh
   Source4:      vip-down.sh
  +Patch0:       ucarp.patch
   
   #   build information
   Prefix:       %{l_prefix}
  @@ -65,7 +66,7 @@
       free Common Address Redundancy Protocol (CARP, OpenBSD's
       alternative to the VRRP).
   
  -    Strong points of the CARP protocol are: very low overhead,
  +    Strong points of the CARP protocol are very low overhead,
       cryptographically signed messages, interoperability between
       different operating systems, and no need for any dedicated
       extra network link between redundant hosts.
  @@ -79,6 +80,7 @@
   
   %prep
       %setup -q
  +    %patch -p0
       %{l_shtool} subst \
           -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
           src/ip_carp.h \
  @@ -135,7 +137,7 @@
           $RPM_BUILD_ROOT%{l_prefix}/var/ucarp
   
       #   install default configuration
  -    %{l_shtool} install -c -m 644 \
  +    %{l_shtool} install -c -m 755 \
           %{SOURCE vip-down.sh} \
           %{SOURCE vip-up.sh} \
           $RPM_BUILD_ROOT%{l_prefix}/etc/ucarp/
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/vip-down.sh
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 vip-down.sh
  --- openpkg-src/ucarp/vip-down.sh     29 Aug 2004 10:07:47 -0000      1.2
  +++ openpkg-src/ucarp/vip-down.sh     2 Nov 2004 17:58:30 -0000       1.3
  @@ -1,4 +1,22 @@
   #!/bin/sh
   
  -#route delete 127.0.0.2 127.0.0.1 $1
  +#Solaris virtual network interface manipulation
  +#/sbin/ifconfig $1:48 >/dev/null 2>&1 && \
  +#    /usr/sbin/ifconfig $1:48 down && \
  +#    /sbin/ifconfig $1:48 unplumb
   
  +# Solaris IP routing
  +#/usr/sbin/route delete 127.0.0.2 127.0.0.1
  +
  +# BSD virtual network interface manipulation
  +#/sbin/ifconfig $1 >/dev/null 2>&1 && \
  +#    /sbin/ifconfig $1 -alias 127.0.0.2
  +
  +# BSD IP routing
  +#/sbin/route delete 127.0.0.2 127.0.0.1 $1
  +
  +# Linux virtual network interface manipulation
  +#/sbin/ip addr del 127.0.0.2/24 dev $1
  +
  +# Linux IP routing
  +#/sbin/route delete 127.0.0.2 127.0.0.1 $1
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/vip-up.sh
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 vip-up.sh
  --- openpkg-src/ucarp/vip-up.sh       29 Aug 2004 10:07:47 -0000      1.2
  +++ openpkg-src/ucarp/vip-up.sh       2 Nov 2004 17:58:30 -0000       1.3
  @@ -1,4 +1,22 @@
   #!/bin/sh
   
  -#route add 127.0.0.2 127.0.0.1 $1
  +# Solaris virtual network interface manipulation
  +#/sbin/ifconfig $1:48 >/dev/null 2>&1 || \
  +#    /usr/sbin/ifconfig $1:48 plumb && \
  +#    /sbin/ifconfig $1:48 127.0.0.2 netmask 255.255.255.0 up
   
  +# Solaris IP routing
  +#/usr/sbin/route add 127.0.0.2 127.0.0.1
  +
  +# BSD virtual network interface manipulation
  +#/sbin/ifconfig $1 >/dev/null 2>&1 || \
  +#    /sbin/ifconfig $1 alias 127.0.0.2 netmask 255.255.255.255
  +
  +# BSD IP routing
  +#/sbin/route add 127.0.0.2 127.0.0.1 $1
  +
  +# Linux virtual network interface manipulation
  +#/sbin/ip addr add 127.0.0.2/24 dev $1
  +
  +# Linux IP routing
  +#/sbin/route add 127.0.0.2 127.0.0.1 $1
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to