keepalived-1.1.6 v1.1.6
authorAlexandre Cassen <acassen@freebox.fr>
Sun, 22 Feb 2004 22:18:04 +0000 (23:18 +0100)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:58:59 +0000 (10:58 +0200)
* keepalived-1.1.6 released.
* VRRP : Fixed scheduling timer update. Global scheduling timer is
  updated before each thread registering and after scheduling I/O MUX.
  Since is needed to take care of scheduling jitter introduced by
  overhead (VRRP is using low low timer so more sensitive to overhead).
  Thanks to Nathan Neulinger, <nneul@umr.edu> for his quick feedback
  debugging time.
* VRRP : Nathan Neulinger, <nneul@umr.edu> updated vrrp dropping
  strategy to not reply to incoming bogus adverts. Since this can
  introduce flooding loop, bogus adverts are now simply silently
  dropped.
* VRRP : Fixed a linkbeat issue while polling NIC flags.
* Updated autoconf and Makefile to support 2.6 kernel IPVS code. For
  code readability, created 2 differents libipvs for 2.4 and 2.6 kernel
  . Fixed autoconf generated warning.
* Extended ipvswrapper to support shared buffer user rule. This
  increase performances by limiting memory allocation. OTOH, created
  two new ipvs helpers ipvs_start & ipvs_stop to initialize ipvs
  subsystem.
* Andres Salomon, <dilinger@voxel.net> made some cosmetics update
  in Makefiles to support $(DESTDIR) and $(BIN)/$(EXEC) path split.
  export CPPFLAGS="-I/usr/kerberos/include" && ./configure

116 files changed:
ChangeLog
Makefile.in
VERSION
configure
configure.in
genhash/Makefile.in
genhash/http.c
genhash/http.h
genhash/layer4.c
genhash/layer4.h
genhash/main.c
genhash/main.h
genhash/sock.c
genhash/sock.h
genhash/ssl.c
genhash/ssl.h
keepalived.spec
keepalived/Makefile.in
keepalived/check/Makefile.in
keepalived/check/check_api.c
keepalived/check/check_daemon.c
keepalived/check/check_data.c
keepalived/check/check_http.c
keepalived/check/check_misc.c
keepalived/check/check_parser.c
keepalived/check/check_ssl.c
keepalived/check/check_tcp.c
keepalived/check/ipfwwrapper.c
keepalived/check/ipvswrapper.c
keepalived/check/ipwrapper.c
keepalived/core/Makefile.in
keepalived/core/daemon.c
keepalived/core/global_data.c
keepalived/core/global_parser.c
keepalived/core/layer4.c
keepalived/core/main.c
keepalived/core/pidfile.c
keepalived/core/smtp.c
keepalived/include/check_api.h
keepalived/include/check_daemon.h
keepalived/include/check_data.h
keepalived/include/check_http.h
keepalived/include/check_misc.h
keepalived/include/check_parser.h
keepalived/include/check_ssl.h
keepalived/include/check_tcp.h
keepalived/include/daemon.h
keepalived/include/global_data.h
keepalived/include/global_parser.h
keepalived/include/ipfwwrapper.h
keepalived/include/ipvswrapper.h
keepalived/include/ipwrapper.h
keepalived/include/layer4.h
keepalived/include/main.h
keepalived/include/pidfile.h
keepalived/include/smtp.h
keepalived/include/vrrp.h
keepalived/include/vrrp_arp.h
keepalived/include/vrrp_daemon.h
keepalived/include/vrrp_data.h
keepalived/include/vrrp_if.h
keepalived/include/vrrp_index.h
keepalived/include/vrrp_ipaddress.h
keepalived/include/vrrp_iproute.h
keepalived/include/vrrp_ipsecah.h
keepalived/include/vrrp_netlink.h
keepalived/include/vrrp_notify.h
keepalived/include/vrrp_parser.h
keepalived/include/vrrp_scheduler.h
keepalived/include/vrrp_sync.h
keepalived/include/vrrp_track.h
keepalived/libipfwc/Makefile [new file with mode: 0644]
keepalived/libipvs-2.4/Makefile [new file with mode: 0644]
keepalived/libipvs-2.4/Makefile.in [moved from keepalived/libipvs/Makefile.in with 100% similarity]
keepalived/libipvs-2.4/libipvs.c [moved from keepalived/libipvs/libipvs.c with 100% similarity]
keepalived/libipvs-2.4/libipvs.h [moved from keepalived/libipvs/libipvs.h with 100% similarity]
keepalived/libipvs-2.6/Makefile.in [new file with mode: 0644]
keepalived/libipvs-2.6/libipvs.c [new file with mode: 0644]
keepalived/libipvs-2.6/libipvs.h [new file with mode: 0644]
keepalived/vrrp/Makefile.in
keepalived/vrrp/vrrp.c
keepalived/vrrp/vrrp_arp.c
keepalived/vrrp/vrrp_daemon.c
keepalived/vrrp/vrrp_data.c
keepalived/vrrp/vrrp_if.c
keepalived/vrrp/vrrp_index.c
keepalived/vrrp/vrrp_ipaddress.c
keepalived/vrrp/vrrp_iproute.c
keepalived/vrrp/vrrp_ipsecah.c
keepalived/vrrp/vrrp_netlink.c
keepalived/vrrp/vrrp_notify.c
keepalived/vrrp/vrrp_parser.c
keepalived/vrrp/vrrp_scheduler.c
keepalived/vrrp/vrrp_sync.c
keepalived/vrrp/vrrp_track.c
lib/Makefile.in
lib/html.c
lib/html.h
lib/list.c
lib/list.h
lib/memory.c
lib/memory.h
lib/notify.c
lib/notify.h
lib/parser.c
lib/parser.h
lib/scheduler.c
lib/scheduler.h
lib/timer.c
lib/timer.h
lib/utils.c
lib/utils.h
lib/vector.c
lib/vector.h
lib/watchdog.c
lib/watchdog.h

index 3035a20..0fdcc9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2004-02-23  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-1.1.6 released.
+       * VRRP : Fixed scheduling timer update. Global scheduling timer is
+         updated before each thread registering and after scheduling I/O MUX.
+         Since is needed to take care of scheduling jitter introduced by
+         overhead (VRRP is using low low timer so more sensitive to overhead).
+         Thanks to Nathan Neulinger, <nneul@umr.edu> for his quick feedback
+         debugging time.
+       * VRRP : Nathan Neulinger, <nneul@umr.edu> updated vrrp dropping
+         strategy to not reply to incoming bogus adverts. Since this can
+         introduce flooding loop, bogus adverts are now simply silently
+         dropped.
+       * VRRP : Fixed a linkbeat issue while polling NIC flags.
+       * Updated autoconf and Makefile to support 2.6 kernel IPVS code. For
+         code readability, created 2 differents libipvs for 2.4 and 2.6 kernel
+         . Fixed autoconf generated warning.
+       * Extended ipvswrapper to support shared buffer user rule. This
+         increase performances by limiting memory allocation. OTOH, created
+         two new ipvs helpers ipvs_start & ipvs_stop to initialize ipvs
+         subsystem.
+       * Andres Salomon, <dilinger@voxel.net> made some cosmetics update
+         in Makefiles to support $(DESTDIR) and $(BIN)/$(EXEC) path split.
+
 2004-01-25  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-1.1.5 released.
        * Joseph Mack, <mack.joseph@epa.gov> wrote keeplived manpages
@@ -22,7 +45,7 @@
          autoconf and Makefile prototypes to support dependencies
          libs like kerberos for RedHat/Fedora distro. To compile
          keepalived properly on redhat 9 box, for example, run :
-         CPPFLAGS="-I/usr/kerberos/include" && ./configure
+         export CPPFLAGS="-I/usr/kerberos/include" && ./configure
          Renamed keywords lb_kind to lvs_method and ld_algo to
          lvs_sched. For compatibility reasons, old keywords are still
          available.
index a0890d3..5804b95 100644 (file)
@@ -35,7 +35,6 @@ distclean:
        rm -f Makefile
 
 mrproper: distclean
-       rm -f bin/*
        rm -f config.*
 
 uninstall:
diff --git a/VERSION b/VERSION
index e25d8d9..0664a8f 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.5
+1.1.6
index 96ab3a1..33fabeb 100755 (executable)
--- a/configure
+++ b/configure
@@ -308,7 +308,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP LINKWATCH_SUPPORT KERN DFLAGS IPVS_SUPPORT VRRP_SUPPORT IPVS_SYNCD LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP LINKWATCH_SUPPORT KERN IPVS_SYNCD DFLAGS IPVS_SUPPORT VRRP_SUPPORT LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -2957,149 +2957,6 @@ done
 
 
 
-for ac_header in linux/netlink.h linux/rtnetlink.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-  no:yes )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
 
 for ac_header in openssl/ssl.h openssl/md5.h openssl/err.h
 do
@@ -3457,13 +3314,13 @@ fi
 
 
 CPPFLAGS="$CPPFLAGS -I$kernelinc"
-echo "$as_me:$LINENO: checking for kernel >= 2.4.0" >&5
-echo $ECHO_N "checking for kernel >= 2.4.0... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for kernel version" >&5
+echo $ECHO_N "checking for kernel version... $ECHO_C" >&6
 if test "$cross_compiling" = yes; then
 
-    KERN="_KRNL_2_2_"
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    LINUX_MAJOR="0"
+    LINUX_MINOR="0"
+    LINUX_PATCH="0"
 
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -3474,15 +3331,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-  #include <stdlib.h>
-  #include <linux/version.h>
-  int main (void) {
-  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-    return 0;
-  #else
-    return 1;
-  #endif
-  }
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <linux/version.h>
+    int main (void) {
+      FILE *fp = fopen ("linuxinfo", "w");
+      if (!fp) return 1;
+      fprintf (fp, "%s\n", UTS_RELEASE);
+      fclose (fp);
+      return 0;
+    }
+
 _ACEOF
 rm -f conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -3496,9 +3355,9 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
-    KERN="_KRNL_2_4_"
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    LINUX_MAJOR=`cat linuxinfo | cut -d'.' -f1`
+    LINUX_MINOR=`cat linuxinfo | cut -d'.' -f2`
+    LINUX_PATCH=`cat linuxinfo | cut -d'.' -f3`
 
 else
   echo "$as_me: program exited with status $ac_status" >&5
@@ -3507,13 +3366,27 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 
-    KERN="_KRNL_2_2_"
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    LINUX_MAJOR="0"
+    LINUX_MINOR="0"
+    LINUX_PATCH="0"
 
 fi
 rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+  rm -f linuxinfo
+  echo "$as_me:$LINENO: result: $LINUX_MAJOR.$LINUX_MINOR.$LINUX_PATCH" >&5
+echo "${ECHO_T}$LINUX_MAJOR.$LINUX_MINOR.$LINUX_PATCH" >&6
+  if test "$LINUX_MINOR" = "6"; then
+    KERN="_KRNL_2_6_"
+  elif test "$LINUX_MINOR" = "4"; then
+    KERN="_KRNL_2_4_"
+  else
+    KERN="_KRNL_2_2_"
+  fi
+  if test "$LINUX_MAJOR" = "0" -a "$LINUX_MINOR" = "0" -a "$LINUX_PATCH" = "0"; then
+    { echo "$as_me:$LINENO: WARNING: Cannot determine Linux Kernel version." >&5
+echo "$as_me: WARNING: Cannot determine Linux Kernel version." >&2;}
+  fi
 
 echo "$as_me:$LINENO: checking for /usr/src/linux/net/core/link_watch.c" >&5
 echo $ECHO_N "checking for /usr/src/linux/net/core/link_watch.c... $ECHO_C" >&6
@@ -3768,6 +3641,36 @@ echo "$as_me: error: keepalived MUST be compiled at least with LVS or VRRP frame
    { (exit 1); exit 1; }; }
 fi
 
+
+IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
+  echo "$as_me:$LINENO: checking for IPVS syncd support" >&5
+echo $ECHO_N "checking for IPVS syncd support... $ECHO_C" >&6
+  if test "$KERN" = "_KRNL_2_6_"; then
+    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+  elif test "$IPVS_MAJOR" -ge 1 -a "$KERN" = "_KRNL_2_4_"; then
+    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+  elif test "$IPVS_MINOR" -ge 9 -a "$IPVS_PATCH" -ge 2 -a "$KERN" = "_KRNL_2_4_"; then
+    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+  else
+    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+  fi
+
+  if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_" -o "$enable_lvs_syncd" = "no"; then
+    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+  fi
+
+  if test "$IPVS_SYNCD" = "_HAVE_IPVS_SYNCD_"; then
+    echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  else
+    echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  fi
+fi
+
+
+
 VRRP_SUPPORT="_WITHOUT_VRRP_"
 if test "$enable_vrrp" != "no"; then
   echo "$as_me:$LINENO: checking for kernel netlink support" >&5
@@ -3840,34 +3743,6 @@ fi
 
 
 
-
-IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
-  echo "$as_me:$LINENO: checking for LVS syncd support" >&5
-echo $ECHO_N "checking for LVS syncd support... $ECHO_C" >&6
-  if test "$IPVS_MAJOR" -ge 1 -a "$KERN" = "_KRNL_2_4_"; then
-    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  elif test "$IPVS_MINOR" -ge 9 -a "$IPVS_PATCH" -ge 2 -a "$KERN" = "_KRNL_2_4_"; then
-    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  else
-    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-  fi
-
-  if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_" -o "$enable_lvs_syncd" = "no"; then
-    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-  fi
-
-  if test "$IPVS_SYNCD" = "_HAVE_IPVS_SYNCD_"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-  else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-  fi
-fi
-
-
-
 echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
 if test "${ac_cv_c_const+set}" = set; then
@@ -4132,6 +4007,81 @@ echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
   fi
 fi
 
+echo "$as_me:$LINENO: checking for working memcmp" >&5
+echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6
+if test "${ac_cv_func_memcmp_working+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_working=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  /* Some versions of memcmp are not 8-bit clean.  */
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+    exit (1);
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    char foo[21];
+    char bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+        char *a = foo + i;
+        char *b = bar + i;
+        strcpy (a, "--------01111111");
+        strcpy (b, "--------10000000");
+        if (memcmp (a, b, 16) >= 0)
+          exit (1);
+      }
+    exit (0);
+  }
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_memcmp_working=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_memcmp_working=no
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
+echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6
+test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+
 echo "$as_me:$LINENO: checking return type of signal handlers" >&5
 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
 if test "${ac_cv_type_signal+set}" = set; then
@@ -4288,8 +4238,10 @@ if test "${VRRP_SUPPORT}" = "_WITH_VRRP_"; then
 fi
 if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
   OUTPUT_TARGET="$OUTPUT_TARGET keepalived/check/Makefile"
-  if test "$KERN" = "_KRNL_2_4_"; then
-    OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipvs/Makefile"
+  if test "$KERN" = "_KRNL_2_6_"; then
+    OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipvs-2.6/Makefile"
+  elif test "$KERN" = "_KRNL_2_4_"; then
+    OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipvs-2.4/Makefile"
   else
     OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipfwc/Makefile"
   fi
@@ -4943,10 +4895,10 @@ s,@CPP@,$CPP,;t t
 s,@EGREP@,$EGREP,;t t
 s,@LINKWATCH_SUPPORT@,$LINKWATCH_SUPPORT,;t t
 s,@KERN@,$KERN,;t t
+s,@IPVS_SYNCD@,$IPVS_SYNCD,;t t
 s,@DFLAGS@,$DFLAGS,;t t
 s,@IPVS_SUPPORT@,$IPVS_SUPPORT,;t t
 s,@VRRP_SUPPORT@,$VRRP_SUPPORT,;t t
-s,@IPVS_SYNCD@,$IPVS_SYNCD,;t t
 s,@LIBOBJS@,$LIBOBJS,;t t
 s,@LTLIBOBJS@,$LTLIBOBJS,;t t
 CEOF
index d2b1c25..f30b67f 100644 (file)
@@ -35,7 +35,7 @@ dnl ----[ Checks for header files ]----
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(fcntl.h syslog.h unistd.h sys/ioctl.h sys/time.h)
-AC_CHECK_HEADERS(linux/netlink.h linux/rtnetlink.h)
+dnl [do we really need this ?] AC_CHECK_HEADERS(linux/netlink.h linux/rtnetlink.h)
 AC_CHECK_HEADERS(openssl/ssl.h openssl/md5.h openssl/err.h,,AC_MSG_ERROR([
   !!! OpenSSL is not properly installed on your system. !!!
   !!! Can not include OpenSSL headers files.            !!!]))
@@ -47,26 +47,43 @@ AC_CHECK_LIB(popt, poptGetContext,,AC_MSG_ERROR([Popt libraries is required]))
 
 dnl ----[ Kernel version check ]----
 CPPFLAGS="$CPPFLAGS -I$kernelinc"
-AC_MSG_CHECKING([for kernel >= 2.4.0])
+AC_MSG_CHECKING([for kernel version])
 AC_TRY_RUN([
-  #include <stdlib.h>
-  #include <linux/version.h>
-  int main (void) {
-  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-    return 0;
-  #else
-    return 1;
-  #endif
-  }], [
-    KERN="_KRNL_2_4_"
-    AC_MSG_RESULT(yes)
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <linux/version.h>
+    int main (void) {
+      FILE *fp = fopen ("linuxinfo", "w");
+      if (!fp) return 1;
+      fprintf (fp, "%s\n", UTS_RELEASE);
+      fclose (fp); 
+      return 0;
+    } 
   ], [
-    KERN="_KRNL_2_2_"
-    AC_MSG_RESULT(no)
+    LINUX_MAJOR=`cat linuxinfo | cut -d'.' -f1`
+    LINUX_MINOR=`cat linuxinfo | cut -d'.' -f2`
+    LINUX_PATCH=`cat linuxinfo | cut -d'.' -f3`
   ], [
-    KERN="_KRNL_2_2_"
-    AC_MSG_RESULT(no)
+    LINUX_MAJOR="0"
+    LINUX_MINOR="0"
+    LINUX_PATCH="0"
+  ], [
+    LINUX_MAJOR="0"
+    LINUX_MINOR="0"
+    LINUX_PATCH="0"
   ])
+  rm -f linuxinfo
+  AC_MSG_RESULT([$LINUX_MAJOR.$LINUX_MINOR.$LINUX_PATCH])
+  if test "$LINUX_MINOR" = "6"; then
+    KERN="_KRNL_2_6_"
+  elif test "$LINUX_MINOR" = "4"; then
+    KERN="_KRNL_2_4_"
+  else
+    KERN="_KRNL_2_2_"
+  fi
+  if test "$LINUX_MAJOR" = "0" -a "$LINUX_MINOR" = "0" -a "$LINUX_PATCH" = "0"; then
+    AC_MSG_WARN([Cannot determine Linux Kernel version.])
+  fi
 
 AC_CHECK_FILE(/usr/src/linux/net/core/link_watch.c, [
                 LINKWATCH_SUPPORT="_WITH_LINKWATCH_"
@@ -128,6 +145,35 @@ if test "$IPVS_SUPPORT" = "_WITHOUT_LVS_" -a "$enable_vrrp" = "no"; then
   AC_MSG_ERROR([keepalived MUST be compiled at least with LVS or VRRP framework])
 fi
 
+dnl ----[ IPVS syncd support probe ]---
+dnl Sync daemon is supported since IPVS 0.9.2 for kernel 2.4
+
+IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
+  AC_MSG_CHECKING([for IPVS syncd support])
+  if test "$KERN" = "_KRNL_2_6_"; then
+    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+  elif test "$IPVS_MAJOR" -ge 1 -a "$KERN" = "_KRNL_2_4_"; then
+    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+  elif test "$IPVS_MINOR" -ge 9 -a "$IPVS_PATCH" -ge 2 -a "$KERN" = "_KRNL_2_4_"; then
+    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+  else
+    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+  fi
+
+  if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_" -o "$enable_lvs_syncd" = "no"; then
+    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+  fi
+
+  if test "$IPVS_SYNCD" = "_HAVE_IPVS_SYNCD_"; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
+  fi
+fi
+
+AC_SUBST(IPVS_SYNCD)
+
 dnl ----[ Checks for kernel netlink support ]----
 VRRP_SUPPORT="_WITHOUT_VRRP_"
 if test "$enable_vrrp" != "no"; then
@@ -164,33 +210,6 @@ fi
 AC_SUBST(IPVS_SUPPORT)
 AC_SUBST(VRRP_SUPPORT)
 
-dnl ----[ LVS syncd support probe ]---
-dnl Sync daemon is supported since LVS 0.9.2 for kernel 2.4
-
-IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
-  AC_MSG_CHECKING([for LVS syncd support])
-  if test "$IPVS_MAJOR" -ge 1 -a "$KERN" = "_KRNL_2_4_"; then
-    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  elif test "$IPVS_MINOR" -ge 9 -a "$IPVS_PATCH" -ge 2 -a "$KERN" = "_KRNL_2_4_"; then
-    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  else
-    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-  fi
-
-  if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_" -o "$enable_lvs_syncd" = "no"; then
-    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-  fi
-
-  if test "$IPVS_SYNCD" = "_HAVE_IPVS_SYNCD_"; then
-    AC_MSG_RESULT([yes])
-  else
-    AC_MSG_RESULT([no])
-  fi
-fi
-
-AC_SUBST(IPVS_SYNCD)
-
 dnl ----[ Checks for typedefs, structures, and compiler characteristics ]----
 AC_C_CONST
 AC_TYPE_PID_T
@@ -198,7 +217,7 @@ AC_HEADER_TIME
 
 dnl ----[ Checks for library functions ]----
 AC_PROG_GCC_TRADITIONAL
-dnl AC_FUNC_MEMCMP
+AC_FUNC_MEMCMP
 AC_TYPE_SIGNAL
 AC_CHECK_FUNCS(gettimeofday select socket strerror strtol uname)
 
@@ -209,8 +228,10 @@ if test "${VRRP_SUPPORT}" = "_WITH_VRRP_"; then
 fi
 if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
   OUTPUT_TARGET="$OUTPUT_TARGET keepalived/check/Makefile"
-  if test "$KERN" = "_KRNL_2_4_"; then
-    OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipvs/Makefile"
+  if test "$KERN" = "_KRNL_2_6_"; then
+    OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipvs-2.6/Makefile"
+  elif test "$KERN" = "_KRNL_2_4_"; then
+    OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipvs-2.4/Makefile"
   else
     OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipfwc/Makefile"
   fi
index 3aa273d..4948ceb 100644 (file)
@@ -1,8 +1,9 @@
 # Makefile.in
 #
-# Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
 
-EXEC = ../bin/genhash
+EXEC = genhash
+BIN  = ../bin
 
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
@@ -12,33 +13,33 @@ CC = @CC@
 INCLUDES = -I../lib
 CFLAGS = @CFLAGS@ @CPPFLAGS@ $(INCLUDES) \
         -Wall -Wunused -Wstrict-prototypes
-LDFLAGS = -lssl -lpopt
+LDFLAGS = @LIBS@ @LDFLAGS@
 
 OBJS = main.o sock.o layer4.o http.o ssl.o
 LIB_OBJS = ../lib/timer.o ../lib/scheduler.o \
           ../lib/memory.o ../lib/list.o ../lib/utils.o \
           ../lib/html.o
 
-all:   $(EXEC)
-       strip $(EXEC)
+all:   $(BIN)/$(EXEC)
+       strip $(BIN)/$(EXEC)
        @echo ""
        @echo "Make complete"
 
-$(EXEC): $(LIB_OBJS) $(OBJS)
-       $(CC) $(LIB_OBJS) $(OBJS) -o $(EXEC) $(LDFLAGS)
+$(BIN)/$(EXEC): $(LIB_OBJS) $(OBJS)
+       $(CC) $(LIB_OBJS) $(OBJS) -o $(BIN)/$(EXEC) $(LDFLAGS)
 
 clean:
        rm -f core *.o
 
 distclean: clean
-       rm -f Makefile
+       rm -f Makefile $(BIN)/$(EXEC)
 
 uninstall:
-       rm -f $(bindir)/$(EXEC)
+       rm -f $(DESTDIR)$(bindir)/$(EXEC)
 
 install:
-       install -d $(bindir)
-       install -m 755 $(EXEC) $(bindir)/
+       install -d $(DESTDIR)$(bindir)
+       install -m 755 $(BIN)/$(EXEC) $(DESTDIR)$(bindir)/
 
 mrproper: clean distclean
        rm -f config.*
index 9eae2a2..ed042ed 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <errno.h>
index 6a67671..b24376c 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _HTTP_H
index 6392752..3005b6e 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "layer4.h"
index 5a513c9..e4be9ba 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LAYER4_H
index 2e4b664..5fe0791 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <signal.h>
index 9dd3427..33d2741 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MAIN_H
index 7f6420d..2d6ea62 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <string.h>
index 939a155..c5f6ef5 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SOCK_H
index fa42d9b..e7043fc 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
index e785209..9bfb33d 100644 (file)
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SSL_H
index 401a12a..5ee811a 100644 (file)
@@ -1,7 +1,7 @@
 Name: keepalived
 Summary: HA monitor built upon LVS, VRRP and services poller
 Packager: Christophe Varoqui, <christophe.varoqui@free.fr>
-Version: 1.1.5
+Version: 1.1.6
 Release: 1
 Source: http://www.keepalived.org/software/%{name}-%{version}.tar.gz
 Copyright: GPL
index 547a2cb..d63c6ef 100644 (file)
@@ -4,7 +4,7 @@
 #
 # Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
 
-EXEC = keepalived
+EXEC      = keepalived
 BIN       = ../bin
 KERNEL    = @KERN@
 IPVS_FLAG = @IPVS_SUPPORT@
@@ -33,7 +33,11 @@ ifeq ($(IPVS_FLAG),_WITH_LVS_)
   ifeq ($(KERNEL),_KRNL_2_2_)
     SUBDIRS += libipfwc
   else
-    SUBDIRS += libipvs
+    ifeq ($(KERNEL),_KRNL_2_4_)
+      SUBDIRS += libipvs-2.4
+    else
+      SUBDIRS += libipvs-2.6
+    endif
   endif
 endif
 
@@ -76,21 +80,21 @@ distclean:
        @set -e; \
        for i in $(SUBDIRS); do \
        $(MAKE) -C $$i distclean; done
-       rm -f Makefile
+       rm -f Makefile $(BIN)/$(EXEC)
 
 mrproper: distclean
        rm -f config.*
 
 uninstall:
-       rm -f $(sbindir)/$(EXEC)
-       rm -rf $(sysconfdir)/keepalived
-       rm -f $(init_dir)/$(init_script)
+       rm -f $(DESTDIR)$(sbindir)/$(EXEC)
+       rm -rf $(DESTDIR)$(sysconfdir)/keepalived
+       rm -f $(DESTDIR)$(init_dir)/$(init_script)
 
 install:
-       install -d $(sbindir)
-       install -m 700 $(BIN)/$(EXEC) $(sbindir)/
-       install -d $(sysconfdir)/init.d
-       install -m 755 $(init_script) $(sysconfdir)/init.d/keepalived
-       install -d $(sysconfdir)/keepalived/samples
-       install -m 644 $(conf_file) $(sysconfdir)/keepalived/
-       install -m 644 ../doc/samples/* $(sysconfdir)/keepalived/samples/
+       install -d $(DESTDIR)$(sbindir)
+       install -m 700 $(BIN)/$(EXEC) $(DESTDIR)$(sbindir)/
+       install -d $(DESTDIR)$(sysconfdir)/init.d
+       install -m 755 $(init_script) $(DESTDIR)$(sysconfdir)/init.d/keepalived
+       install -d $(DESTDIR)$(sysconfdir)/keepalived/samples
+       install -m 644 $(conf_file) $(DESTDIR)$(sysconfdir)/keepalived/
+       install -m 644 ../doc/samples/* $(DESTDIR)$(sysconfdir)/keepalived/samples/
index 0a38e80..c27c7ae 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
 
 KERNEL   = @KERN@
 CC      = @CC@
@@ -36,8 +36,8 @@ distclean: clean
 
 check_daemon.o: check_daemon.c ../include/check_daemon.h \
   ../include/check_parser.h ../include/check_data.h ../include/check_api.h \
-  ../include/global_data.h ../include/ipwrapper.h ../include/pidfile.h \
-  ../include/daemon.h ../../lib/list.h ../../lib/memory.h \
+  ../include/global_data.h ../include/ipwrapper.h ../include/ipwrapper.h \
+  ../include/pidfile.h ../include/daemon.h ../../lib/list.h ../../lib/memory.h \
   ../../lib/parser.h ../../lib/watchdog.h ../include/vrrp_netlink.h \
   ../include/vrrp_if.h
 check_data.o: check_data.c ../include/check_data.h \
index 34a6065..9111542 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_api.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_api.h"
index 9c7b748..bc8ce27 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckrs child process handling.
  *
- * Version:     $Id: check_daemon.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_daemon.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_daemon.h"
@@ -28,6 +28,7 @@
 #include "check_api.h"
 #include "global_data.h"
 #include "ipwrapper.h"
+#include "ipvswrapper.h"
 #include "pidfile.h"
 #include "daemon.h"
 #include "list.h"
@@ -71,6 +72,7 @@ stop_check(void)
        free_ssl();
        if (!(debug & 16))
                clear_services();
+       ipvs_stop();
 
        /* Stop daemon */
        pidfile_rm(CHECKERS_PID_FILE);
@@ -102,6 +104,7 @@ static void
 start_check(void)
 {
        /* Initialize sub-system */
+       ipvs_start();
        init_checkers_queue();
 #ifdef _WITH_VRRP_
        init_interface_queue();
@@ -162,6 +165,7 @@ reload_check_thread(thread * thread)
        free_global_data(data);
        free_checkers_queue();
        free_ssl();
+       ipvs_stop();
 
        /* free watchdog sd */
        wdog_close(check_wdog_sd, WDOG_CHECK);
@@ -268,7 +272,7 @@ start_check_child(void)
        /* Launch the scheduling I/O multiplexer */
        launch_scheduler();
 
-       /* Finish VRRP daemon process */
+       /* Finish healthchecker daemon process */
        stop_check();
        exit(0);
 }
index 7bafdf0..0db101e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_data.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_data.h"
index 70dc608..40a4685 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_http.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
index 8871470..9c69e80 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        MISC CHECK. Perform a system call to run an extra
  *              system prog or script.
  *
- * Version:     $Id: check_misc.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_misc.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
@@ -22,7 +22,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_misc.h"
index 07aecbd..db008ba 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: check_parser.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_parser.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_parser.h"
index bee944d..4941a56 100644 (file)
@@ -7,7 +7,7 @@
  *              url, compute a MD5 over this result and match it to the
  *              expected value.
  *
- * Version:     $Id: check_ssl.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -22,7 +22,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
index 7763743..748f93b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_tcp.h"
index b5f5903..a2e3098 100644 (file)
@@ -7,7 +7,7 @@
  *              library to add/remove server MASQ rules to the kernel 
  *              firewall framework.
  *
- * Version:     $Id: ipfwwrapper.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipfwwrapper.h"
index ff9e220..ae5a6f2 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        IPVS Kernel wrapper. Use setsockopt call to add/remove
  *              server to/from the loadbalanced server pool.
  *  
- * Version:     $Id: ipvswrapper.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -20,7 +20,7 @@
  *               as published by the Free Software Foundation; either version
  *               2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipvswrapper.h"
@@ -34,7 +34,33 @@ static int parse_timeout(char *, unsigned *);
 static int string_to_number(const char *, int, int);
 static int modprobe_ipvs(void);
 
-#ifdef _KRNL_2_2_              /* KERNEL 2.2 LVS handling */
+/* fetch virtual server group from group name */
+virtual_server_group *
+ipvs_get_group_by_name(char *gname, list l)
+{
+       element e;
+       virtual_server_group *vsg;
+
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               vsg = ELEMENT_DATA(e);
+               if (!strcmp(vsg->gname, gname))
+                       return vsg;
+       }
+       return NULL;
+}
+
+#ifdef _KRNL_2_2_              /* KERNEL 2.2 IPVS handling */
+
+/* Simple fake func for compatibility */
+int
+ipvs_start(void)
+{
+       return IPVS_SUCCESS;
+}
+void
+ipvs_stop(void)
+{
+}
 
 int
 ipvs_syncd_cmd(int cmd, char *ifname, int state)
@@ -131,13 +157,15 @@ ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
 }
 
 
-#else                          /* KERNEL 2.4 LVS handling */
+#elif _KRNL_2_4_                       /* KERNEL 2.4 IPVS handling */
 
-static int
-ipvs_talk(int cmd, struct ip_vs_rule_user *urule)
-{
-       int result;
+/* Global module def IPVS rules */
+static struct ip_vs_rule_user *urule;
 
+/* Initialization helpers */
+int
+ipvs_start(void)
+{
        /* Init IPVS kernel channel */
        if (ipvs_init()) {
                /* try to insmod the ip_vs module if ipvs_init failed */
@@ -149,10 +177,24 @@ ipvs_talk(int cmd, struct ip_vs_rule_user *urule)
                }
        }
 
-       result = ipvs_command(cmd, urule);
-       if (result)
-               syslog(LOG_INFO, "IPVS : %s", ipvs_strerror(errno));
+       /* Allocate global user rules */
+       urule = (struct ip_vs_rule_user *) MALLOC(sizeof (struct ip_vs_rule_user));
+       return IPVS_SUCCESS;
+}
+
+void
+ipvs_stop(void)
+{
+       /* Clean up the room */
+       FREE(urule);
        ipvs_close();
+}
+
+static int
+ipvs_talk(int cmd)
+{
+       if (ipvs_command(cmd, urule))
+               syslog(LOG_INFO, "IPVS : %s", ipvs_strerror(errno));
        return IPVS_SUCCESS;
 }
 
@@ -161,17 +203,15 @@ ipvs_syncd_cmd(int cmd, char *ifname, int state)
 {
 #ifdef _HAVE_IPVS_SYNCD_
 
-       struct ip_vs_rule_user urule;
-
-       memset(&urule, 0, sizeof (struct ip_vs_rule_user));
+       memset(urule, 0, sizeof (struct ip_vs_rule_user));
 
        /* prepare user rule */
-       urule.state = state;
+       urule->state = state;
        if (ifname != NULL)
-               strncpy(urule.mcast_ifn, ifname, IP_VS_IFNAME_MAXLEN);
+               strncpy(urule->mcast_ifn, ifname, IP_VS_IFNAME_MAXLEN);
 
        /* Talk to the IPVS channel */
-       return ipvs_talk(cmd, &urule);
+       return ipvs_talk(cmd);
 
 #else
        syslog(LOG_INFO, "IPVS : Sync daemon not supported");
@@ -179,25 +219,9 @@ ipvs_syncd_cmd(int cmd, char *ifname, int state)
 #endif
 }
 
-/* fetch virtual server group from group name */
-virtual_server_group *
-ipvs_get_group_by_name(char *gname, list l)
-{
-       element e;
-       virtual_server_group *vsg;
-
-       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
-               vsg = ELEMENT_DATA(e);
-               if (!strcmp(vsg->gname, gname))
-                       return vsg;
-       }
-       return NULL;
-}
-
 /* IPVS group range rule */
 static int
-ipvs_group_range_cmd(int cmd, struct ip_vs_rule_user *urule
-                    , virtual_server_group_entry *vsg_entry)
+ipvs_group_range_cmd(int cmd, virtual_server_group_entry *vsg_entry)
 {
        uint32_t addr_ip;
        int err = 0;
@@ -210,7 +234,7 @@ ipvs_group_range_cmd(int cmd, struct ip_vs_rule_user *urule
                urule->vport = SVR_PORT(vsg_entry);
 
                /* Talk to the IPVS channel */
-               err = ipvs_talk(cmd, urule);
+               err = ipvs_talk(cmd);
        }
 
        return err;
@@ -218,9 +242,7 @@ ipvs_group_range_cmd(int cmd, struct ip_vs_rule_user *urule
 
 /* set IPVS group rules */
 static int
-ipvs_group_cmd(int cmd, list vs_group, real_server * rs
-                     , struct ip_vs_rule_user *urule
-                     , char * vsgname)
+ipvs_group_cmd(int cmd, list vs_group, real_server * rs, char * vsgname)
 {
        virtual_server_group *vsg = ipvs_get_group_by_name(vsgname, vs_group);
        virtual_server_group_entry *vsg_entry;
@@ -240,7 +262,7 @@ ipvs_group_cmd(int cmd, list vs_group, real_server * rs
 
                /* Talk to the IPVS channel */
                if (IPVS_ALIVE(cmd, vsg_entry, rs)) {
-                       err = ipvs_talk(cmd, urule);
+                       err = ipvs_talk(cmd);
                        IPVS_SET_ALIVE(cmd, vsg_entry);
                }
        }
@@ -255,7 +277,7 @@ ipvs_group_cmd(int cmd, list vs_group, real_server * rs
 
                /* Talk to the IPVS channel */
                if (IPVS_ALIVE(cmd, vsg_entry, rs)) {
-                       err = ipvs_talk(cmd, urule);
+                       err = ipvs_talk(cmd);
                        IPVS_SET_ALIVE(cmd, vsg_entry);
                }
        }
@@ -268,7 +290,7 @@ ipvs_group_cmd(int cmd, list vs_group, real_server * rs
 
                /* Talk to the IPVS channel */
                if (IPVS_ALIVE(cmd, vsg_entry, rs)) {
-                       err = ipvs_group_range_cmd(cmd, urule, vsg_entry);
+                       err = ipvs_group_range_cmd(cmd, vsg_entry);
                        IPVS_SET_ALIVE(cmd, vsg_entry);
                }
        }
@@ -277,13 +299,11 @@ ipvs_group_cmd(int cmd, list vs_group, real_server * rs
 }
 
 /* Fill IPVS rule with root vs infos */
-struct ip_vs_rule_user *
+void
 ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
 {
-       struct ip_vs_rule_user *urule;
-
-       /* Allocate target rule */
-       urule = (struct ip_vs_rule_user *) MALLOC(sizeof (struct ip_vs_rule_user));
+       /* Clean up target rule */
+       memset(urule, 0, sizeof (struct ip_vs_rule_user));
 
        strncpy(urule->sched_name, vs->sched, IP_VS_SCHEDNAME_MAXLEN);
        urule->weight = 1;
@@ -311,17 +331,17 @@ ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
                        urule->dport = SVR_PORT(rs);
                }
        }
-
-       return urule;
 }
 
 /* Set/Remove a RS from a VS */
 int
 ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
 {
-       struct ip_vs_rule_user *urule = ipvs_set_rule(cmd, vs, rs);
        int err = 0;
 
+       /* Prepare target rule */
+       ipvs_set_rule(cmd, vs, rs);
+
        /* Does the service use inhibit flag ? */
        if (cmd == IP_VS_SO_SET_DELDEST && rs->inhibit) {
                urule->weight = 0;
@@ -338,7 +358,7 @@ ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
 
        /* Set vs rule and send to kernel */
        if (vs->vsgname) {
-               err = ipvs_group_cmd(cmd, vs_group, rs, urule, vs->vsgname);
+               err = ipvs_group_cmd(cmd, vs_group, rs, vs->vsgname);
        } else {
                if (vs->vfwmark) {
                        urule->vfwmark = vs->vfwmark;
@@ -348,10 +368,9 @@ ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
                }
 
                /* Talk to the IPVS channel */
-               err = ipvs_talk(cmd, urule);
+               err = ipvs_talk(cmd);
        }
 
-       FREE(urule);
        return err;
 }
 
@@ -359,21 +378,23 @@ ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
 int
 ipvs_group_remove_entry(virtual_server *vs, virtual_server_group_entry *vsge)
 {
-       struct ip_vs_rule_user *urule = NULL;
        real_server *rs;
        int err = 0;
        element e;
        list l = vs->rs;
 
+       /* Clean target rules */
+       memset(urule, 0, sizeof (struct ip_vs_rule_user));
+
        /* Process realserver queue */
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
                rs = ELEMENT_DATA(e);
 
                if (rs->alive) {
                        /* Prepare the IPVS rule */
-                       if (!urule) {
+                       if (urule->daddr) {
                                /* Setting IPVS rule with vs root rs */
-                               urule = ipvs_set_rule(IP_VS_SO_SET_DELDEST, vs, rs);
+                               ipvs_set_rule(IP_VS_SO_SET_DELDEST, vs, rs);
                        } else {
                                urule->weight = rs->weight;
                                urule->daddr = SVR_IP(rs);
@@ -382,28 +403,315 @@ ipvs_group_remove_entry(virtual_server *vs, virtual_server_group_entry *vsge)
 
                        /* Set vs rule */
                        if (vsge->range) {
-                               ipvs_group_range_cmd(IP_VS_SO_SET_DELDEST, urule, vsge);
+                               ipvs_group_range_cmd(IP_VS_SO_SET_DELDEST, vsge);
                        } else {
                                urule->vfwmark = vsge->vfwmark;
                                urule->vaddr = SVR_IP(vsge);
                                urule->vport = SVR_PORT(vsge);
 
                                /* Talk to the IPVS channel */
-                               err = ipvs_talk(IP_VS_SO_SET_DELDEST, urule);
+                               err = ipvs_talk(IP_VS_SO_SET_DELDEST);
                        }
                }
        }
 
        /* Remove VS entry */
        if (vsge->range)
-               err = ipvs_group_range_cmd(IP_VS_SO_SET_DEL, urule, vsge);
+               err = ipvs_group_range_cmd(IP_VS_SO_SET_DEL, vsge);
        else
-               err = ipvs_talk(IP_VS_SO_SET_DEL, urule);
-
-       FREE(urule);
+               err = ipvs_talk(IP_VS_SO_SET_DEL);
        return err;
 }
 
+#else                                  /* KERNEL 2.6 IPVS handling */
+
+/* Global module def IPVS rules */
+static struct ip_vs_service_user *srule;
+static struct ip_vs_dest_user *drule;
+static struct ip_vs_daemon_user *daemonrule;
+
+/* Initialization helpers */
+int
+ipvs_start(void)
+{
+       /* Initialize IPVS module */
+       if (ipvs_init()) {
+               if (modprobe_ipvs() || ipvs_init()) {
+                       syslog(LOG_INFO, "IPVS: Can't initialize ipvs: %s",
+                              ipvs_strerror(errno));
+                       return IPVS_ERROR;
+               }
+       }
+
+       /* Allocate global user rules */
+       srule = (struct ip_vs_service_user *) MALLOC(sizeof (struct ip_vs_service_user));
+       drule = (struct ip_vs_dest_user *) MALLOC(sizeof (struct ip_vs_dest_user));
+       daemonrule = (struct ip_vs_daemon_user *) MALLOC(sizeof (struct ip_vs_daemon_user));
+       return IPVS_SUCCESS;
+}
+
+void
+ipvs_stop(void)
+{
+       /* Clean up the room */
+       FREE(srule);
+       FREE(drule);
+       FREE(daemonrule);
+       ipvs_close();
+}
+
+/* Send user rules to IPVS module */
+static void
+ipvs_talk(int cmd)
+{
+       int result = -1;
+
+       switch (cmd) {
+               case IP_VS_SO_SET_STARTDAEMON:
+                       result = ipvs_start_daemon(daemonrule);
+                       break;
+               case IP_VS_SO_SET_STOPDAEMON:
+                       result = ipvs_stop_daemon(daemonrule);
+                       break;
+               case IP_VS_SO_SET_ADD:
+                       result = ipvs_add_service(srule);
+                       break;
+               case IP_VS_SO_SET_DEL:
+                       result = ipvs_del_service(srule);
+                       break;
+               case IP_VS_SO_SET_EDIT:
+                       result = ipvs_update_service(srule);
+                       break;
+               case IP_VS_SO_SET_ZERO:
+                       result = ipvs_zero_service(srule);
+                       break;
+               case IP_VS_SO_SET_ADDDEST:
+                       result = ipvs_add_dest(srule, drule);
+                       break;
+               case IP_VS_SO_SET_DELDEST:
+                       result = ipvs_del_dest(srule, drule);
+                       break;
+               case IP_VS_SO_SET_EDITDEST:
+                       result = ipvs_update_dest(srule, drule);
+                       break;
+       }
+
+       if (result)
+               syslog(LOG_INFO, "IPVS: %s", ipvs_strerror(errno));
+}
+
+int
+ipvs_syncd_cmd(int cmd, char *ifname, int state)
+{
+       memset(daemonrule, 0, sizeof (struct ip_vs_daemon_user));
+
+       /* prepare user rule */
+       daemonrule->state = state;
+       if (ifname != NULL)
+               strncpy(daemonrule->mcast_ifn, ifname, IP_VS_IFNAME_MAXLEN);
+
+       /* Talk to the IPVS channel */
+       ipvs_talk(cmd);
+       return IPVS_SUCCESS;
+}
+
+/* IPVS group range rule */
+static void
+ipvs_group_range_cmd(int cmd, virtual_server_group_entry *vsg_entry)
+{
+       uint32_t addr_ip;
+
+       /* Parse the whole range */
+       for (addr_ip = SVR_IP(vsg_entry);
+            ((addr_ip >> 24) & 0xFF) <= vsg_entry->range;
+            addr_ip += 0x01000000) {
+               srule->addr = addr_ip;
+               srule->port = SVR_PORT(vsg_entry);
+
+               /* Talk to the IPVS channel */
+               ipvs_talk(cmd);
+       }
+}
+
+/* set IPVS group rules */
+static void
+ipvs_group_cmd(int cmd, list vs_group, real_server * rs, char * vsgname)
+{
+       virtual_server_group *vsg = ipvs_get_group_by_name(vsgname, vs_group);
+       virtual_server_group_entry *vsg_entry;
+       list l;
+       element e;
+
+       /* return if jointure fails */
+       if (!vsg) return;
+
+       /* visit addr_ip list */
+       l = vsg->addr_ip;
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               vsg_entry = ELEMENT_DATA(e);
+               srule->addr = SVR_IP(vsg_entry);
+               srule->port = SVR_PORT(vsg_entry);
+
+               /* Talk to the IPVS channel */
+               if (IPVS_ALIVE(cmd, vsg_entry, rs)) {
+                       ipvs_talk(cmd);
+                       IPVS_SET_ALIVE(cmd, vsg_entry);
+               }
+       }
+
+       /* visit vfwmark list */
+       l = vsg->vfwmark;
+       srule->addr = 0;
+       srule->port = 0;
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               vsg_entry = ELEMENT_DATA(e);
+               srule->fwmark = vsg_entry->vfwmark;
+
+               /* Talk to the IPVS channel */
+               if (IPVS_ALIVE(cmd, vsg_entry, rs)) {
+                       ipvs_talk(cmd);
+                       IPVS_SET_ALIVE(cmd, vsg_entry);
+               }
+       }
+
+       /* visit range list */
+       l = vsg->range;
+       srule->fwmark = 0;
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               vsg_entry = ELEMENT_DATA(e);
+
+               /* Talk to the IPVS channel */
+               if (IPVS_ALIVE(cmd, vsg_entry, rs)) {
+                       ipvs_group_range_cmd(cmd, vsg_entry);
+                       IPVS_SET_ALIVE(cmd, vsg_entry);
+               }
+       }
+}
+
+/* Fill IPVS rule with root vs infos */
+void
+ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
+{
+       /* Clean target rule */
+       memset(drule, 0, sizeof (struct ip_vs_dest_user));
+
+       drule->weight = 1;
+       drule->conn_flags = vs->loadbalancing_kind;
+       strncpy(srule->sched_name, vs->sched, IP_VS_SCHEDNAME_MAXLEN);
+       srule->netmask = ((u_int32_t) 0xffffffff);
+       srule->protocol = vs->service_type;
+
+       if (!parse_timeout(vs->timeout_persistence, &srule->timeout))
+               syslog(LOG_INFO,
+                      "IPVS : Virtual service [%s:%d] illegal timeout.",
+                      inet_ntop2(SVR_IP(vs)), ntohs(SVR_PORT(vs)));
+
+       if (srule->timeout != 0 || vs->granularity_persistence)
+               srule->flags = IP_VS_SVC_F_PERSISTENT;
+
+       if (cmd == IP_VS_SO_SET_ADD || cmd == IP_VS_SO_SET_DEL)
+               if (vs->granularity_persistence)
+                       srule->netmask = vs->granularity_persistence;
+
+       /* SVR specific */
+       if (rs) {
+               if (cmd == IP_VS_SO_SET_ADDDEST || cmd == IP_VS_SO_SET_DELDEST) {
+                       drule->weight = rs->weight;
+                       drule->addr = SVR_IP(rs);
+                       drule->port = SVR_PORT(rs);
+               }
+       }
+}
+
+/* Set/Remove a RS from a VS */
+int
+ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
+{
+       /* Allocate the room */
+       memset(srule, 0, sizeof (struct ip_vs_service_user));
+       ipvs_set_rule(cmd, vs, rs);
+
+       /* Does the service use inhibit flag ? */
+       if (cmd == IP_VS_SO_SET_DELDEST && rs->inhibit) {
+               drule->weight = 0;
+               cmd = IP_VS_SO_SET_EDITDEST;
+       }
+       if (cmd == IP_VS_SO_SET_ADDDEST && rs->inhibit && rs->set)
+               cmd = IP_VS_SO_SET_EDITDEST;
+
+       /* Set flag */
+       if (cmd == IP_VS_SO_SET_ADDDEST && !rs->set)
+               rs->set = 1;
+       if (cmd == IP_VS_SO_SET_DELDEST && rs->set)
+               rs->set = 0;
+
+       /* Set vs rule and send to kernel */
+       if (vs->vsgname) {
+               ipvs_group_cmd(cmd, vs_group, rs, vs->vsgname);
+       } else {
+               if (vs->vfwmark) {
+                       srule->fwmark = vs->vfwmark;
+               } else {
+                       srule->addr = SVR_IP(vs);
+                       srule->port = SVR_PORT(vs);
+               }
+
+               /* Talk to the IPVS channel */
+               ipvs_talk(cmd);
+       }
+
+       return IPVS_SUCCESS;
+}
+
+/* Remove a specific vs group entry */
+int
+ipvs_group_remove_entry(virtual_server *vs, virtual_server_group_entry *vsge)
+{
+       real_server *rs;
+       element e;
+       list l = vs->rs;
+
+       /* Clean target rules */
+       memset(srule, 0, sizeof (struct ip_vs_service_user));
+       memset(drule, 0, sizeof (struct ip_vs_dest_user));
+
+       /* Process realserver queue */
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               rs = ELEMENT_DATA(e);
+
+               if (rs->alive) {
+                       /* Prepare the IPVS rule */
+                       if (!drule->addr) {
+                               /* Setting IPVS rule with vs root rs */
+                               ipvs_set_rule(IP_VS_SO_SET_DELDEST, vs, rs);
+                       } else {
+                               drule->weight = rs->weight;
+                               drule->addr = SVR_IP(rs);
+                               drule->port = SVR_PORT(rs);
+                       }
+
+                       /* Set vs rule */
+                       if (vsge->range) {
+                               ipvs_group_range_cmd(IP_VS_SO_SET_DELDEST, vsge);
+                       } else {
+                               srule->fwmark = vsge->vfwmark;
+                               srule->addr = SVR_IP(vsge);
+                               srule->port = SVR_PORT(vsge);
+
+                               /* Talk to the IPVS channel */
+                               ipvs_talk(IP_VS_SO_SET_DELDEST);
+                       }
+               }
+       }
+
+       /* Remove VS entry */
+       if (vsge->range)
+               ipvs_group_range_cmd(IP_VS_SO_SET_DEL, vsge);
+       else
+               ipvs_talk(IP_VS_SO_SET_DEL);
+       return IPVS_SUCCESS;
+}
+
 #endif
 
 /*
index f348426..df210ec 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $id: ipwrapper.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $id: ipwrapper.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipwrapper.h"
@@ -157,7 +157,6 @@ init_service_vs(virtual_server * vs)
        if (!LIST_ISEMPTY(vs->rs))
                if (!init_service_rs(vs, vs->rs))
                        return 0;
-
        return 1;
 }
 
index 7914609..95608fe 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
 
 CC      = @CC@
 INCLUDES = -I../include -I../../lib
index cec941d..a7513a2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <syslog.h>
index 757bcaa..46c3ff8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: global_data.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <syslog.h>
index 6ef0990..c1940a6 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: global_parser.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: global_parser.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "global_parser.h"
index ed80e06..3ab4425 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: layer4.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "layer4.h"
index 9cf9f61..d02d82d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "main.h"
index c851710..85a2a3d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: pidfile.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "pidfile.h"
index 01953b2..ace42c3 100644 (file)
@@ -7,7 +7,7 @@
  *              using the smtp protocol according to the RFC 821. A non blocking
  *              timeouted connection is used to handle smtp protocol.
  *
- * Version:     $Id: smtp.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: smtp.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "smtp.h"
index 5af271f..d2c2e79 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_api.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_API_H
index d422be3..5678e0c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_daemon.c include file.
  * 
- * Version:     $Id: check_daemon.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_daemon.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_DAEMON_H
index ab8db8b..9c41379 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_data.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_DATA_H
index 57114a1..a548f76 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _HTTP_H
index f1c406a..6de19ba 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_misc.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MISC_H
index 7c4339f..a4f216b 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        check_parser.c include file.
  *  
- * Version:     $Id: check_parser.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_parser.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_PARSER_H
index 3142438..6f65fb0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SSL_H
index 848b6c6..fbce338 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _TCP_H
index c66f408..1cc5a65 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: daemon.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _DAEMON_H
index 1631d41..b1ffa21 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: global_data.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _GLOBAL_DATA_H
index 83fa86a..58e6c61 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: global_parser.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: global_parser.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _GLOBAL_PARSER_H
index 8545c55..8b7b386 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPFWWRAPPER_H
index 6240aa1..8c7c3ba 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPVSWRAPPER_H
 
 #ifdef _WITH_LVS_
 #ifdef _KRNL_2_2_
-#include <linux/ip_fw.h>
-#include <net/ip_masq.h>
-#else
-#include "../libipvs/libipvs.h"
+  #include <linux/ip_fw.h>
+  #include <net/ip_masq.h>
+#elif _KRNL_2_4_
+  #include "../libipvs-2.4/libipvs.h"
+#elif _KRNL_2_6_
+  #include "../libipvs-2.6/libipvs.h"
 #endif
-#include <net/ip_vs.h>
+  #include <net/ip_vs.h>
 #endif
 
 #ifndef IP_VS_TEMPLATE_TIMEOUT
@@ -92,6 +94,8 @@ do {                                          \
 } while (0)
 
 /* prototypes */
+extern int ipvs_start(void);
+extern void ipvs_stop(void);
 extern virtual_server_group *ipvs_get_group_by_name(char *gname, list l);
 extern int ipvs_group_remove_entry(virtual_server * vs,
                                   virtual_server_group_entry * vsge);
index 2defc02..99dbba5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPWRAPPER_H
index 753cbf7..3c16e4c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: layer4.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LAYER4_H
index c38b7d4..082120e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: main.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MAIN_H
@@ -59,8 +59,8 @@ int linkwatch = 0;            /* Use linkwatch kernel netlink reflection */
 #define LOG_FACILITY_MAX       7
 #define PROG    "Keepalived"
 
-#define VERSION_CODE 0x010105
-#define DATE_CODE    0x190104
+#define VERSION_CODE 0x010106
+#define DATE_CODE    0x170204
 
 #define KEEPALIVED_VERSION(version)    \
        (version >> 16) & 0xFF,         \
index cece1d0..b6b68e7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: pidfile.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _PIDFILE_H
index df27c4a..4e1d9b6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: smtp.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SMTP_H
index 7c741d5..cbe8689 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_H
index f176696..8161882 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_arp.c include file.
  *
- * Version:     $Id: vrrp_arp.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_arp.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_ARP_H
index ffbd3bc..1a1572e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_daemon.c include file.
  * 
- * Version:     $Id: vrrp_daemon.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_daemon.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_DAEMON_H
index 3af17e8..4cbefad 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_data.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_DATA_H
index d8f0388..4d9aadf 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IF_H
@@ -88,12 +88,13 @@ list if_queue;
 #else
 #define IF_ISUP(X) (((X)->flags & IFF_UP)      && \
                     ((X)->flags & IFF_RUNNING) && \
-                    IF_LINKBEAT(X))
+                    if_linkbeat(X))
 #endif
 
 /* prototypes */
 extern interface *if_get_by_ifindex(const int ifindex);
 extern interface *if_get_by_ifname(const char *ifname);
+extern int if_linkbeat(const interface *ifp);
 extern int if_mii_probe(const char *ifname);
 extern int if_ethtool_probe(const char *ifname);
 extern void if_add_queue(interface * ifp);
index b494f57..0d16336 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_index.c include file.
  *
- * Version:     $Id: vrrp_index.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_index.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_INDEX_H
index 0f3b193..eb01082 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPADDR_H
index 0022833..45e6aab 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_iproute.c include file.
  *
- * Version:     $Id: vrrp_iproute.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_iproute.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPROUTE_H
index e36a390..e345980 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPSEC_AH_H
index c74eed1..970b4e3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_NETLINK_H
index 704c698..d62b3cb 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp_notify.c include file.
  *
- * Version:     $Id: vrrp_notify.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_notify.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_NOTIFY_H
index ab67081..30002b2 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: vrrp_parser.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_parser.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_PARSER_H
index 9ccac26..ef9e825 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_SCHEDULER_H
index 1ffd0d6..5c61152 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_sync.c include file.
  * 
- * Version:     $Id: vrrp_sync.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_sync.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_SYNC_H
index a20d20c..ff8d45e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_track.c include file.
  *
- * Version:     $Id: vrrp_track.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_track.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_TRACK_H
diff --git a/keepalived/libipfwc/Makefile b/keepalived/libipfwc/Makefile
new file mode 100644 (file)
index 0000000..d0c6824
--- /dev/null
@@ -0,0 +1,18 @@
+# Makefile to make libipfwc.
+
+CC     = gcc
+CFLAGS = -g -O2 -Wall -Wunused
+
+export OBJS += libipfwc.a
+
+all: libipfwc.a
+
+libipfwc.a: libipfwc.a(libipfwc.o)
+
+libipfwc.o: libipfwc.h ipfwc_kernel_headers.h
+
+clean:
+       rm -f *.a *.o *~
+
+distclean: clean
+       rm -f Makefile
diff --git a/keepalived/libipvs-2.4/Makefile b/keepalived/libipvs-2.4/Makefile
new file mode 100644 (file)
index 0000000..e1cfc88
--- /dev/null
@@ -0,0 +1,18 @@
+# Makefile to make libipvsc.
+
+CC     = gcc
+CFLAGS = -g -O2  -I/usr/src/linux/include -Wall -Wunused
+
+export OBJS += libipvs.a
+
+all: libipvs.a
+
+libipvs.a: libipvs.a(libipvs.o)
+
+libipvsc.o: libipvs.h
+
+clean:
+       rm -f *.a *.o *~
+
+distclean: clean
+       rm -f Makefile
diff --git a/keepalived/libipvs-2.6/Makefile.in b/keepalived/libipvs-2.6/Makefile.in
new file mode 100644 (file)
index 0000000..d816a9f
--- /dev/null
@@ -0,0 +1,21 @@
+# Makefile for libipvs
+
+CC             = @CC@
+CFLAGS         = @CFLAGS@ @CPPFLAGS@ -Wall -Wunused
+
+.PHONY         = all clean install dist distclean rpm rpms
+STATIC_LIB     = libipvs.a
+
+all:           $(STATIC_LIB)
+
+$(STATIC_LIB): libipvs.o
+               ar rv $@ $^
+
+%.o:           %.c
+               $(CC) $(CFLAGS) -c -o $@ $<
+
+clean:
+               rm -f *.[ao] *~ *.orig *.rej core
+
+distclean:     clean
+               rm -f Makefile
diff --git a/keepalived/libipvs-2.6/libipvs.c b/keepalived/libipvs-2.6/libipvs.c
new file mode 100644 (file)
index 0000000..fb0f038
--- /dev/null
@@ -0,0 +1,367 @@
+/*
+ * libipvs:    Library for manipulating IPVS through [gs]etsockopt
+ *
+ * Version:     $Id: libipvs.c,v 1.7 2003/06/08 09:31:39 wensong Exp $
+ *
+ * Authors:     Wensong Zhang <wensong@linuxvirtualserver.org>
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include "libipvs.h"
+
+
+typedef struct ipvs_servicedest_s {
+       ipvs_service_t          svc;
+       ipvs_dest_t             dest;
+} ipvs_servicedest_t;
+
+static int sockfd = -1;
+static void* ipvs_func = NULL;
+struct ip_vs_getinfo ipvs_info;
+
+
+int ipvs_init(void)
+{
+       socklen_t len;
+
+       len = sizeof(ipvs_info);
+       if ((sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1)
+               return -1;
+
+       if (getsockopt(sockfd, IPPROTO_IP, IP_VS_SO_GET_INFO,
+                      (char *)&ipvs_info, &len))
+               return -1;
+
+       return 0;
+}
+
+
+int ipvs_getinfo(void)
+{
+       socklen_t len;
+
+       len = sizeof(ipvs_info);
+       return getsockopt(sockfd, IPPROTO_IP, IP_VS_SO_GET_INFO,
+                         (char *)&ipvs_info, &len);
+}
+
+
+unsigned int ipvs_version(void)
+{
+       return ipvs_info.version;
+}
+
+
+int ipvs_flush(void)
+{
+       return setsockopt(sockfd, IPPROTO_IP, IP_VS_SO_SET_FLUSH,
+                         NULL, 0);
+}
+
+
+int ipvs_add_service(ipvs_service_t *svc)
+{
+       ipvs_func = ipvs_add_service;
+       return setsockopt(sockfd, IPPROTO_IP,
+                         IP_VS_SO_SET_ADD, (char *)svc, sizeof(*svc));
+}
+
+
+int ipvs_update_service(ipvs_service_t *svc)
+{
+       ipvs_func = ipvs_update_service;
+       return setsockopt(sockfd, IPPROTO_IP,
+                         IP_VS_SO_SET_EDIT, (char *)svc, sizeof(*svc));
+}
+
+
+int ipvs_del_service(ipvs_service_t *svc)
+{
+       ipvs_func = ipvs_del_service;
+       return setsockopt(sockfd, IPPROTO_IP,
+                         IP_VS_SO_SET_DEL, (char *)svc, sizeof(*svc));
+}
+
+
+int ipvs_zero_service(ipvs_service_t *svc)
+{
+       ipvs_func = ipvs_zero_service;
+       return setsockopt(sockfd, IPPROTO_IP,
+                         IP_VS_SO_SET_ZERO, (char *)svc, sizeof(*svc));
+}
+
+
+int ipvs_add_dest(ipvs_service_t *svc, ipvs_dest_t *dest)
+{
+       ipvs_servicedest_t svcdest = {*svc, *dest};
+
+       ipvs_func = ipvs_add_dest;
+       return setsockopt(sockfd, IPPROTO_IP, IP_VS_SO_SET_ADDDEST,
+                         (char *)&svcdest, sizeof(svcdest));
+}
+
+
+int ipvs_update_dest(ipvs_service_t *svc, ipvs_dest_t *dest)
+{
+       ipvs_servicedest_t svcdest = {*svc, *dest};
+
+       ipvs_func = ipvs_update_dest;
+       return setsockopt(sockfd, IPPROTO_IP, IP_VS_SO_SET_EDITDEST,
+                         (char *)&svcdest, sizeof(svcdest));
+}
+
+
+int ipvs_del_dest(ipvs_service_t *svc, ipvs_dest_t *dest)
+{
+       ipvs_servicedest_t svcdest = {*svc, *dest};
+
+       ipvs_func = ipvs_del_dest;
+       return setsockopt(sockfd, IPPROTO_IP, IP_VS_SO_SET_DELDEST,
+                         (char *)&svcdest, sizeof(svcdest));
+}
+
+
+int ipvs_set_timeout(ipvs_timeout_t *to)
+{
+       ipvs_func = ipvs_set_timeout;
+       return setsockopt(sockfd, IPPROTO_IP, IP_VS_SO_SET_TIMEOUT,
+                         (char *)to, sizeof(*to));
+}
+
+
+int ipvs_start_daemon(ipvs_daemon_t *dm)
+{
+       ipvs_func = ipvs_start_daemon;
+       return setsockopt(sockfd, IPPROTO_IP, IP_VS_SO_SET_STARTDAEMON,
+                         (char *)dm, sizeof(*dm));
+}
+
+
+extern int ipvs_stop_daemon(ipvs_daemon_t *dm)
+{
+       ipvs_func = ipvs_stop_daemon;
+       return setsockopt(sockfd, IPPROTO_IP, IP_VS_SO_SET_STOPDAEMON,
+                         (char *)dm, sizeof(*dm));
+}
+
+
+struct ip_vs_get_services *ipvs_get_services(void)
+{
+       struct ip_vs_get_services *get;
+       socklen_t len;
+
+       len = sizeof(*get) +
+               sizeof(ipvs_service_entry_t)*ipvs_info.num_services;
+       if (!(get = malloc(len)))
+               return NULL;
+
+       ipvs_func = ipvs_get_services;
+       get->num_services = ipvs_info.num_services;
+       if (getsockopt(sockfd, IPPROTO_IP,
+                      IP_VS_SO_GET_SERVICES, get, &len) < 0) {
+               free(get);
+               return NULL;
+       }
+       return get;
+}
+
+
+typedef int (*qsort_cmp_t)(const void *, const void *);
+
+int
+ipvs_cmp_services(ipvs_service_entry_t *s1, ipvs_service_entry_t *s2)
+{
+       int r;
+
+       r = s1->fwmark - s2->fwmark;
+       if (r != 0)
+               return r;
+
+       r = s1->protocol - s2->protocol;
+       if (r != 0)
+               return r;
+
+       r = ntohl(s1->addr) - ntohl(s2->addr);
+       if (r != 0)
+               return r;
+
+       return ntohs(s1->port) - ntohs(s2->port);
+}
+
+
+void
+ipvs_sort_services(struct ip_vs_get_services *s, ipvs_service_cmp_t f)
+{
+       qsort(s->entrytable, s->num_services,
+             sizeof(ipvs_service_entry_t), (qsort_cmp_t)f);
+}
+
+
+struct ip_vs_get_dests *ipvs_get_dests(ipvs_service_entry_t *svc)
+{
+       struct ip_vs_get_dests *d;
+       socklen_t len;
+
+       len = sizeof(*d) + sizeof(ipvs_dest_entry_t)*svc->num_dests;
+       if (!(d = malloc(len)))
+               return NULL;
+
+       ipvs_func = ipvs_get_dests;
+
+       d->fwmark = svc->fwmark;
+       d->protocol = svc->protocol;
+       d->addr = svc->addr;
+       d->port = svc->port;
+       d->num_dests = svc->num_dests;
+
+       if (getsockopt(sockfd, IPPROTO_IP,
+                      IP_VS_SO_GET_DESTS, d, &len) < 0) {
+               free(d);
+               return NULL;
+       }
+       return d;
+}
+
+
+int ipvs_cmp_dests(ipvs_dest_entry_t *d1, ipvs_dest_entry_t *d2)
+{
+       int r;
+
+       r = ntohl(d1->addr) - ntohl(d2->addr);
+       if (r != 0)
+               return r;
+
+       return ntohs(d1->port) - ntohs(d2->port);
+}
+
+
+void ipvs_sort_dests(struct ip_vs_get_dests *d, ipvs_dest_cmp_t f)
+{
+       qsort(d->entrytable, d->num_dests,
+             sizeof(ipvs_dest_entry_t), (qsort_cmp_t)f);
+}
+
+
+ipvs_service_entry_t *
+ipvs_get_service(__u32 fwmark, __u16 protocol, __u32 addr, __u16 port)
+{
+       ipvs_service_entry_t *svc;
+       socklen_t len;
+
+       len = sizeof(*svc);
+       if (!(svc = malloc(len)))
+               return NULL;
+
+       ipvs_func = ipvs_get_service;
+
+       svc->fwmark = fwmark;
+       svc->protocol = protocol;
+       svc->addr = addr;
+       svc->port = port;
+       if (getsockopt(sockfd, IPPROTO_IP, IP_VS_SO_GET_SERVICE,
+                      (char *)svc, &len)) {
+               free(svc);
+               return NULL;
+       }
+       return svc;
+}
+
+
+ipvs_timeout_t *ipvs_get_timeout(void)
+{
+       ipvs_timeout_t *u;
+       socklen_t len;
+
+       len = sizeof(*u);
+       if (!(u = malloc(len)))
+               return NULL;
+
+       ipvs_func = ipvs_get_timeout;
+       if (getsockopt(sockfd, IPPROTO_IP, IP_VS_SO_GET_TIMEOUT,
+                      (char *)u, &len)) {
+               free(u);
+               return NULL;
+       }
+       return u;
+}
+
+
+ipvs_daemon_t *ipvs_get_daemon(void)
+{
+       ipvs_daemon_t *u;
+       socklen_t len;
+
+       /* note that we need to get the info about two possible
+          daemons, master and backup. */
+       len = sizeof(*u) * 2;
+       if (!(u = malloc(len)))
+               return NULL;
+
+       ipvs_func = ipvs_get_daemon;
+       if (getsockopt(sockfd, IPPROTO_IP,
+                      IP_VS_SO_GET_DAEMON, (char *)u, &len)) {
+               free(u);
+               return NULL;
+       }
+       return u;
+}
+
+
+void ipvs_close(void)
+{
+       close(sockfd);
+}
+
+
+const char *ipvs_strerror(int err)
+{
+       unsigned int i;
+       struct table_struct {
+               void *func;
+               int err;
+               const char *message;
+       } table [] = {
+               { 0, EPERM, "Permission denied (you must be root)" },
+               { 0, EINVAL, "Module is wrong version" },
+               { 0, ENOPROTOOPT, "Protocol not available" },
+               { 0, ENOMEM, "Memory allocation problem" },
+               { ipvs_add_service, EEXIST, "Service already exists" },
+               { ipvs_add_service, ENOENT, "Scheduler not found" },
+               { ipvs_update_service, ESRCH, "No such service" },
+               { ipvs_update_service, ENOENT, "Scheduler not found" },
+               { ipvs_del_service, ESRCH, "No such service" },
+               { ipvs_zero_service, ESRCH, "No such service" },
+               { ipvs_add_dest, ESRCH, "Service not defined" },
+               { ipvs_add_dest, EEXIST, "Destination already exists" },
+               { ipvs_update_dest, ESRCH, "Service not defined" },
+               { ipvs_update_dest, ENOENT, "No such destination" },
+               { ipvs_del_dest, ESRCH, "Service not defined" },
+               { ipvs_del_dest, ENOENT, "No such destination" },
+               { ipvs_start_daemon, EEXIST, "Daemon has already run" },
+               { ipvs_stop_daemon, ESRCH, "No daemon is running" },
+               { ipvs_get_services, ESRCH, "No such service" },
+               { ipvs_get_dests, ESRCH, "No such service" },
+               { ipvs_get_service, ESRCH, "No such service" },
+       };
+
+       for (i = 0; i < sizeof(table)/sizeof(struct table_struct); i++) {
+               if ((!table[i].func || table[i].func == ipvs_func)
+                   && table[i].err == err)
+                       return table[i].message;
+       }
+
+       return strerror(err);
+}
diff --git a/keepalived/libipvs-2.6/libipvs.h b/keepalived/libipvs-2.6/libipvs.h
new file mode 100644 (file)
index 0000000..9ebdfb4
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * libipvs.h:  header file for the library ipvs
+ *
+ * Version:    $Id: libipvs.h,v 1.7 2003/06/08 09:31:39 wensong Exp $
+ *
+ * Authors:    Wensong Zhang <wensong@linuxvirtualserver.org>
+ *
+ */
+
+#ifndef _LIBIPVS_H
+#define _LIBIPVS_H
+
+#include <net/ip_vs.h>
+
+#define MINIMUM_IPVS_VERSION_MAJOR      1
+#define MINIMUM_IPVS_VERSION_MINOR      1
+#define MINIMUM_IPVS_VERSION_PATCH      4
+
+#ifndef IPVS_VERSION
+#define IPVS_VERSION(x,y,z)            (((x)<<16)+((y)<<8)+(z))
+#endif
+
+/*
+ * The default IPVS_SVC_PERSISTENT_TIMEOUT is a little larger than average
+ * connection time plus IPVS TCP FIN timeout (2*60 seconds). Because the
+ * connection template won't be released until its controlled connection
+ * entries are expired.
+ * If IPVS_SVC_PERSISTENT_TIMEOUT is too less, the template will expire
+ * soon and will be put in expire again and again, which causes additional
+ * overhead. If it is too large, the same will always visit the same
+ * server, which may make dynamic load imbalance worse.
+ */
+#define IPVS_SVC_PERSISTENT_TIMEOUT    (6*60)
+
+
+typedef struct ip_vs_service_user      ipvs_service_t;
+typedef struct ip_vs_dest_user         ipvs_dest_t;
+typedef struct ip_vs_timeout_user      ipvs_timeout_t;
+typedef struct ip_vs_daemon_user       ipvs_daemon_t;
+typedef struct ip_vs_service_entry     ipvs_service_entry_t;
+typedef struct ip_vs_dest_entry                ipvs_dest_entry_t;
+
+
+/* ipvs info variable */
+extern struct ip_vs_getinfo ipvs_info;
+
+/* init socket and get ipvs info */
+extern int ipvs_init(void);
+
+/* get ipvs info separately */
+extern int ipvs_getinfo(void);
+
+/* get the version number */
+extern unsigned int ipvs_version(void);
+
+/* flush all the rules */
+extern int ipvs_flush(void);
+
+/* add a virtual service */
+extern int ipvs_add_service(ipvs_service_t *svc);
+
+/* update a virtual service with new options */
+extern int ipvs_update_service(ipvs_service_t *svc);
+
+/* delete a virtual service */
+extern int ipvs_del_service(ipvs_service_t *svc);
+
+/* zero the counters of a service or all */
+extern int ipvs_zero_service(ipvs_service_t *svc);
+
+/* add a destination server into a service */
+extern int ipvs_add_dest(ipvs_service_t *svc, ipvs_dest_t *dest);
+
+/* update a destination server with new options */
+extern int ipvs_update_dest(ipvs_service_t *svc, ipvs_dest_t *dest);
+
+/* remove a destination server from a service */
+extern int ipvs_del_dest(ipvs_service_t *svc, ipvs_dest_t *dest);
+
+/* set timeout */
+extern int ipvs_set_timeout(ipvs_timeout_t *to);
+
+/* start a connection synchronizaiton daemon (master/backup) */
+extern int ipvs_start_daemon(ipvs_daemon_t *dm);
+
+/* stop a connection synchronizaiton daemon (master/backup) */
+extern int ipvs_stop_daemon(ipvs_daemon_t *dm);
+
+
+/* get all the ipvs services */
+extern struct ip_vs_get_services *ipvs_get_services(void);
+
+/* sort the service entries */
+typedef int (*ipvs_service_cmp_t)(ipvs_service_entry_t *,
+                                 ipvs_service_entry_t *);
+extern int ipvs_cmp_services(ipvs_service_entry_t *s1,
+                            ipvs_service_entry_t *s2);
+extern void ipvs_sort_services(struct ip_vs_get_services *s,
+                              ipvs_service_cmp_t f);
+
+/* get the destination array of the specified service */
+extern struct ip_vs_get_dests *ipvs_get_dests(ipvs_service_entry_t *svc);
+
+/* sort the destination entries */
+typedef int (*ipvs_dest_cmp_t)(ipvs_dest_entry_t *,
+                              ipvs_dest_entry_t *);
+extern int ipvs_cmp_dests(ipvs_dest_entry_t *d1,
+                         ipvs_dest_entry_t *d2);
+extern void ipvs_sort_dests(struct ip_vs_get_dests *d,
+                           ipvs_dest_cmp_t f);
+
+/* get an ipvs service entry */
+extern ipvs_service_entry_t *
+ipvs_get_service(__u32 fwmark, __u16 protocol, __u32 addr, __u16 port);
+
+/* get ipvs timeout */
+extern ipvs_timeout_t *ipvs_get_timeout(void);
+
+/* get ipvs daemon information */
+extern ipvs_daemon_t *ipvs_get_daemon(void);
+
+/* close the socket */
+extern void ipvs_close(void);
+
+extern const char *ipvs_strerror(int err);
+
+#endif /* _LIBIPVS_H */
index 8a1d9de..70a3090 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
 
 CC      = @CC@
 INCLUDES = -I../include -I../../lib
index 91daf42..0b859cd 100644 (file)
@@ -8,7 +8,7 @@
  *              master fails, a backup server takes over.
  *              The original implementation has been made by jerome etienne.
  *
- * Version:     $Id: vrrp.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -22,7 +22,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
@@ -827,7 +827,6 @@ vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
                syslog(LOG_INFO,
                       "VRRP_Instance(%s) Dropping received VRRP packet...",
                       vrrp->iname);
-               vrrp_send_adv(vrrp, vrrp->priority);
                return 0;
        } else if (hd->priority < vrrp->priority) {
                /* We receive a lower prio adv we just refresh remote ARP cache */
@@ -897,7 +896,6 @@ vrrp_state_fault_rx(vrrp_rt * vrrp, char *buf, int buflen)
                syslog(LOG_INFO,
                       "VRRP_Instance(%s) Dropping received VRRP packet...",
                       vrrp->iname);
-               vrrp_send_adv(vrrp, vrrp->priority);
                return 0;
        } else if (vrrp->priority > hd->priority ||
                   hd->priority == VRRP_PRIO_OWNER)
index 399cbd6..2baedd0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ARP primitives.
  *
- * Version:     $Id: vrrp_arp.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_arp.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* system includes */
index fe53b58..4401749 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP child process handling.
  *
- * Version:     $Id: vrrp_daemon.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_daemon.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_daemon.h"
index f967e3c..bc72e5a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_data.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_data.h"
index fae17d2..b9ca01e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* global include */
@@ -350,6 +350,14 @@ init_if_linkbeat(void)
                                 , POLLING_DELAY);
        }
 }
+
+int
+if_linkbeat(const interface * ifp)
+{
+       if (IF_MII_SUPPORTED(ifp) || IF_ETHTOOL_SUPPORTED(ifp))
+               return IF_LINKBEAT(ifp);
+       return 1;
+}
 #endif
 
 /* Interface queue helpers*/
index a016648..b479587 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP instance index table.
  *
- * Version:     $Id: vrrp_index.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_index.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
index b81449e..bf3662b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
index 0c0754d..08a605a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 routes manipulation.
  *
- * Version:     $Id: vrrp_iproute.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_iproute.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
index a956dde..5967ea8 100644 (file)
@@ -7,7 +7,7 @@
  *              authentication data encryption using HMAC MD5 according to
  *              RFCs 2085 & 2104.
  *
- * Version:     $Id: vrrp_ipsecah.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_ipsecah.h"
index 9155054..15891e5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* global include */
index d123355..ceae0b1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP state transition notification scripts handling.
  *
- * Version:     $Id: vrrp_notify.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_notify.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* system include */
index b8461ba..a0e2b2b 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: vrrp_parser.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_parser.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_parser.h"
index 8405353..94931a2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_scheduler.h"
index 8303e82..9b998f7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP synchronization framework.
  *
- * Version:     $Id: vrrp_sync.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_sync.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_sync.h"
@@ -36,6 +36,8 @@ extern vrrp_conf_data *vrrp_data;
 void
 vrrp_init_instance_sands(vrrp_rt * vrrp)
 {
+       set_time_now();
+
        if (vrrp->state == VRRP_STATE_MAST        ||
            vrrp->state == VRRP_STATE_GOTO_MASTER ||
            vrrp->state == VRRP_STATE_GOTO_FAULT) {
index 5dd1d9c..ab3357f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interface tracking framework.
  *
- * Version:     $Id: vrrp_track.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vrrp_track.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
index a54b29a..893db3a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
 
 CC      = @CC@
 INCLUDES = -I.
index e255abe..873c9ad 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        HTML stream parser utility functions.
  *
- * Version:     $Id: html.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: html.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <string.h>
index 993d194..6e94bf0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        parser.c include file.
  *
- * Version:     $Id: html.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: html.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _HTML_H
index 9617399..84c8250 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: list.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "list.h"
@@ -88,7 +88,7 @@ list_element(list l, int num)
        /* fetch element number num */
        for (i = 0; i < num; i++)
                if (e)
-                       e = ELEMENT_NEXT(e);
+                       ELEMENT_NEXT(e);
 
        if (e)
                return ELEMENT_DATA(e);
index 224b451..2c0ce47 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: list.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LIST_H
index ebcdebc..dad0605 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Memory management framework. This framework is used to
  *              find any memory leak.
  *
- * Version:     $Id: memory.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: memory.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "memory.h"
index 419b50f..78f09e3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: memory.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MEMORY_H
index 128acb7..4ab6bb7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Forked system call to launch an extra script.
  *
- * Version:     $Id: notify.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: notify.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <unistd.h>
index 119b378..9496fb3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        notify.c include file.
  *
- * Version:     $Id: notify.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: notify.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _NOTIFY_H
index 6378d1c..586c081 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: parser.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "parser.h"
index a714dc3..8145ef0 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: parser.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _PARSER_H
index ce39dd8..f69f887 100644 (file)
@@ -7,7 +7,7 @@
  *              the thread management routine (thread.c) present in the 
  *              very nice zebra project (http://www.zebra.org).
  *
- * Version:     $Id: scheduler.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: scheduler.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <signal.h>
@@ -234,6 +234,7 @@ thread_add_read(thread_master * m, int (*func) (thread *)
        thread->u.fd = fd;
 
        /* Compute read timeout value */
+       set_time_now();
        thread->sands = timer_add_long(time_now, timer);
 
        /* Sort the thread. */
@@ -266,6 +267,7 @@ thread_add_write(thread_master * m, int (*func) (thread *)
        thread->u.fd = fd;
 
        /* Compute write timeout value */
+       set_time_now();
        thread->sands = timer_add_long(time_now, timer);
 
        /* Sort the thread. */
@@ -291,6 +293,7 @@ thread_add_timer(thread_master * m, int (*func) (thread *)
        thread->arg = arg;
 
        /* Do we need jitter here? */
+       set_time_now();
        thread->sands = timer_add_long(time_now, timer);
 
        /* Sort by timeval. */
@@ -318,6 +321,7 @@ thread_add_child(thread_master * m, int (*func) (thread *)
        thread->u.c.status = 0;
 
        /* Compute write timeout value */
+       set_time_now();
        thread->sands = timer_add_long(time_now, timer);
 
        /* Sort by timeval. */
index 9b4dbe1..5aea8b7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: scheduler.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SCHEDULER_H
index 4a62e65..3cc9bfb 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: timer.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <stdio.h>
index 3fe6db1..940460e 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: timer.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _TIMER_H
index 30bcdcd..071332c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: utils.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "utils.h"
index ca97d5e..4375e5a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: utils.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _UTILS_H
index 6cad32a..6295ca7 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vector.h"
index dece2b3..7379f73 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: vector.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VECTOR_H
index 70fb0eb..5c13af0 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Software watchdog framework.
  *  
- * Version:     $Id: watchdog.c,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: watchdog.c,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <unistd.h>
index daa3488..e4bd2cd 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        watchdog.c include file.
  *  
- * Version:     $Id: watchdog.h,v 1.1.5 2004/01/25 23:14:31 acassen Exp $
+ * Version:     $Id: watchdog.h,v 1.1.6 2004/02/21 02:31:28 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _WATCHDOG_H