keepalived-0.6.8 v0.6.8
authorAlexandre Cassen <acassen@freebox.fr>
Mon, 15 Jul 2002 21:58:29 +0000 (23:58 +0200)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:58:56 +0000 (10:58 +0200)
* keepalived-0.6.8 released.
* Alex Kramarov, <alex@incredimail.com> & Remi Nivet, <Remi.Nivet@atosorigin.com>
  reported an assertion error during smtp notification process. The assertion
  caused a bad file descriptor registration during in_progress connection
  handling. Fixed registering an event thread calling upper level SMTP
  protocol in_progress connection handler. So the SMTP stream handlers use
  global I/O multiplexer on connection success.
* Benoit Gaussen, <ben@trez42.net> and I added support to "inhibit" feature.
  Added a new keyword called "inhibit_on_failure" for real_server declaration.
  If specified the real_server will not be removed from the IPVS topology if
  real_server fail according to checker result. Instead of removing the entry
  from IPVS topology, the corresponding real_server weight will be set to 0.
  When real_server will be back, then weight will be set back to original value.
  See sample directory for example.
* Added support to IP_MASQ_CMD_SET_DEST for 2.2 krnl and IP_VS_SO_SET_EDITDEST
  for 2.4 IPVS code to provide support to "inhibit" feature.
* Review Makefile.in to exit on compilation error.
* Extended autconf script to check for kernel netlink support.
* keepalived-0.6.7 released.
* Rewrote the previous SMTP notification framework. New code use a strong
  multi-threaded FSM design.
* Moved the SMTP get_local_name() into utils.c
* IPVS : updated the code to support IPVS_SVC_PERSISTENT_TIMEOUT. Introduced
  into the new libipvs coming with ipvs-1.0.4.
* VRRP : Extended the mcast membership subscription to handle more robust
  mcast subscription errors. Removed the previous ugly stalling sleeping
  call retry for membership subscription. Membership subscriptions are now
  multi-threaded to not degrade global scheduling timer.
* VRRP : Remi Nivet, <Remi.Nivet@atosorigin.com> pointed out a buffer
  overflow during the sending advert interface binding process.
* Some more cosmetics patches.
* Review the Makefile(s) code dependencies.
* Updated the TODO file.

79 files changed:
ChangeLog
Makefile.in
TODO
VERSION
configure
configure.in
genhash/Makefile.in
genhash/client.o [deleted file]
genhash/common.o [deleted file]
genhash/main.o [deleted file]
keepalived.spec
keepalived/Makefile.in
keepalived/core/Makefile.in
keepalived/core/daemon.c
keepalived/core/data.c
keepalived/core/layer4.c
keepalived/core/list.c
keepalived/core/main.c
keepalived/core/memory.c
keepalived/core/parser.c
keepalived/core/pidfile.c
keepalived/core/scheduler.c
keepalived/core/smtp.c
keepalived/core/timer.c
keepalived/core/utils.c
keepalived/core/vector.c
keepalived/etc/keepalived/keepalived.conf
keepalived/healthcheck/Makefile.in
keepalived/healthcheck/check_api.c
keepalived/healthcheck/check_ci.c
keepalived/healthcheck/check_http.c
keepalived/healthcheck/check_misc.c
keepalived/healthcheck/check_ssl.c
keepalived/healthcheck/check_tcp.c
keepalived/healthcheck/ipfwwrapper.c
keepalived/healthcheck/ipvswrapper.c
keepalived/healthcheck/ipwrapper.c
keepalived/include/check_api.h
keepalived/include/check_ci.h
keepalived/include/check_http.h
keepalived/include/check_misc.h
keepalived/include/check_ssl.h
keepalived/include/check_tcp.h
keepalived/include/daemon.h
keepalived/include/data.h
keepalived/include/ipfwwrapper.h
keepalived/include/ipvswrapper.h
keepalived/include/ipwrapper.h
keepalived/include/layer4.h
keepalived/include/list.h
keepalived/include/main.h
keepalived/include/memory.h
keepalived/include/parser.h
keepalived/include/pidfile.h
keepalived/include/scheduler.h
keepalived/include/smtp.h
keepalived/include/timer.h
keepalived/include/utils.h
keepalived/include/vector.h
keepalived/include/vrrp.h
keepalived/include/vrrp_if.h
keepalived/include/vrrp_ipaddress.h
keepalived/include/vrrp_ipsecah.h
keepalived/include/vrrp_netlink.h
keepalived/include/vrrp_notify.h
keepalived/include/vrrp_scheduler.h
keepalived/include/vrrp_sync.h
keepalived/libipvs/libipvs.h
keepalived/samples/keepalived.conf.inhibit [new file with mode: 0644]
keepalived/samples/keepalived.conf.sample
keepalived/vrrp/Makefile.in
keepalived/vrrp/vrrp.c
keepalived/vrrp/vrrp_if.c
keepalived/vrrp/vrrp_ipaddress.c
keepalived/vrrp/vrrp_ipsecah.c
keepalived/vrrp/vrrp_netlink.c
keepalived/vrrp/vrrp_notify.c
keepalived/vrrp/vrrp_scheduler.c
keepalived/vrrp/vrrp_sync.c

index eeeb39e..cc0d5f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2002-07-16  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-0.6.8 released.
+       * Alex Kramarov, <alex@incredimail.com> & Remi Nivet, <Remi.Nivet@atosorigin.com>
+         reported an assertion error during smtp notification process. The assertion
+         caused a bad file descriptor registration during in_progress connection
+         handling. Fixed registering an event thread calling upper level SMTP
+         protocol in_progress connection handler. So the SMTP stream handlers use
+         global I/O multiplexer on connection success.
+       * Benoit Gaussen, <ben@trez42.net> and I added support to "inhibit" feature.
+         Added a new keyword called "inhibit_on_failure" for real_server declaration.
+         If specified the real_server will not be removed from the IPVS topology if
+         real_server fail according to checker result. Instead of removing the entry
+         from IPVS topology, the corresponding real_server weight will be set to 0.
+         When real_server will be back, then weight will be set back to original value.
+         See sample directory for example.
+       * Added support to IP_MASQ_CMD_SET_DEST for 2.2 krnl and IP_VS_SO_SET_EDITDEST
+         for 2.4 IPVS code to provide support to "inhibit" feature.
+       * Review Makefile.in to exit on compilation error.
+       * Extended autconf script to check for kernel netlink support.
+
+2002-07-12  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-0.6.7 released.
+       * Rewrote the previous SMTP notification framework. New code use a strong
+         multi-threaded FSM design.
+       * Moved the SMTP get_local_name() into utils.c
+       * IPVS : updated the code to support IPVS_SVC_PERSISTENT_TIMEOUT. Introduced
+         into the new libipvs coming with ipvs-1.0.4.
+       * VRRP : Extended the mcast membership subscription to handle more robust
+         mcast subscription errors. Removed the previous ugly stalling sleeping
+         call retry for membership subscription. Membership subscriptions are now
+         multi-threaded to not degrade global scheduling timer.
+       * VRRP : Remi Nivet, <Remi.Nivet@atosorigin.com> pointed out a buffer
+         overflow during the sending advert interface binding process.
+       * Some more cosmetics patches.
+
 2002-07-05  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-0.6.6 released.
        * added indentation style .indent.pro
@@ -21,6 +56,7 @@
        * Refine autoconf/automake scripts. Added automake support to libipvs and
          libipfwc. Added code selection compilation for libipvs and libipfwc.
        * Review Makefile(s) to use more convenient facilities like distclean, ...
+       * Review the Makefile(s) code dependencies.
        * Added support to modprobe_ipvs if the ip_vs.o module is not loaded.
          If modprobe fails then IPVS is assumed unavailable.
        * Refine the IPVS wrapper to be more tolerant. When a VS or RS is already
@@ -30,6 +66,7 @@
          instance want to run on an interface administratively shut. Added extension
          to FSM to force transition to FAULT state during bootstrap if the interface
          is shut.
+       * Updated the TODO file.
        * Some cosmetics patches.
 
 2002-07-01  Alexandre Cassen  <acassen@linux-vs.org>
index 089a99f..72b7f22 100644 (file)
@@ -35,3 +35,6 @@ uninstall:
 install:
        $(MAKE) -C keepalived install
        $(MAKE) -C genhash install
+
+rpm:
+       rpm -ba keepalived.spec
diff --git a/TODO b/TODO
index c143803..05f4b42 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,19 +1,27 @@
 * Insert LDAP, FTP, SSH, IMAP, POP, RADIUS checkers.
 * Add minimum configuration verification (realserver must have
   a checker defined, ...)
+* VRRP : finish IPSEC-AH integration for seqnum synchronization when
+  using vrrp_sync_group in fallback mode.
 * documentation:
        - hackers guide
        - code documentation
-       - users guide
 * code cleanup:
        - name space cleanup
        - function returnval check
-       - maybe put *.h files into a ../include directory
-       - maybe add a ../healthcheck directory for the checks
-* more choice with parameters, less hardcoded values:
-       - a general.conf could help, stuff like timeouts and so on
+       - beautifull the genhash code
+       - check_ssl.c audit the password_cb() call back func
+         for buffer overflow.
+       - check smtp.c to release allocated buffer when terminate
+         thread is registered. Occur when sigint is receive when
+         smtp alertes have not been able to finish the whole sending
+         sequence.
+* more choice with parameters, less hardcoded values
 * functionality:
        - better startup check mechanism to prevent long debugging sessions
-       - hooks for external checktools. For node-failover
+       - hooks in VRRP framework for external checktools.
+         As state transition decision
        - a VTYSH to administrate keepalived on the fly
-       - something I forgot right now :)
+* Configuration file reload on signal. Extend the parser to use
+  global scheduler with conf file stream.
+* something I forgot right now :)
diff --git a/VERSION b/VERSION
index 05e8a45..fae59ca 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.6.6
+0.6.8
index 4195116..bd6de01 100755 (executable)
--- a/configure
+++ b/configure
@@ -1149,7 +1149,7 @@ else
 fi
 done
 
-for ac_hdr in openssl/ssl.h openssl/md5.h openssl/err.h
+for ac_hdr in linux/netlink.h linux/rtnetlink.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -1186,6 +1186,46 @@ EOF
  
 else
   echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in openssl/ssl.h openssl/md5.h openssl/err.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1197: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1202 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1207: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
 { echo "configure: error: 
   !!! OpenSSL is not properly installed on your system. !!!
   !!! Can not include OpenSSL headers files.            !!!" 1>&2; exit 1; }
@@ -1197,17 +1237,17 @@ if test "${ci_linux}" = "yes"; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1201: checking for $ac_hdr" >&5
+echo "configure:1241: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1206 "configure"
+#line 1246 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1237,7 +1277,7 @@ done
 fi
 
 echo $ac_n "checking for MD5_Init in -lcrypto""... $ac_c" 1>&6
-echo "configure:1241: checking for MD5_Init in -lcrypto" >&5
+echo "configure:1281: checking for MD5_Init in -lcrypto" >&5
 ac_lib_var=`echo crypto'_'MD5_Init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1245,7 +1285,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypto  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1249 "configure"
+#line 1289 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1256,7 +1296,7 @@ int main() {
 MD5_Init()
 ; return 0; }
 EOF
-if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1285,7 +1325,7 @@ else
 fi
 
 echo $ac_n "checking for SSL_CTX_new in -lssl""... $ac_c" 1>&6
-echo "configure:1289: checking for SSL_CTX_new in -lssl" >&5
+echo "configure:1329: checking for SSL_CTX_new in -lssl" >&5
 ac_lib_var=`echo ssl'_'SSL_CTX_new | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1293,7 +1333,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lssl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1297 "configure"
+#line 1337 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1304,7 +1344,7 @@ int main() {
 SSL_CTX_new()
 ; return 0; }
 EOF
-if { (eval echo configure:1308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1333,7 +1373,7 @@ else
 fi
 
 echo $ac_n "checking for poptGetContext in -lpopt""... $ac_c" 1>&6
-echo "configure:1337: checking for poptGetContext in -lpopt" >&5
+echo "configure:1377: checking for poptGetContext in -lpopt" >&5
 ac_lib_var=`echo popt'_'poptGetContext | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1341,7 +1381,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpopt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1345 "configure"
+#line 1385 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1352,7 +1392,7 @@ int main() {
 poptGetContext()
 ; return 0; }
 EOF
-if { (eval echo configure:1356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1382,7 +1422,7 @@ fi
 
 if test "${ci_linux}" = "yes"; then
   echo $ac_n "checking for cluster_maxnodes in -lcluster""... $ac_c" 1>&6
-echo "configure:1386: checking for cluster_maxnodes in -lcluster" >&5
+echo "configure:1426: checking for cluster_maxnodes in -lcluster" >&5
 ac_lib_var=`echo cluster'_'cluster_maxnodes | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1390,7 +1430,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcluster  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1394 "configure"
+#line 1434 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1401,7 +1441,7 @@ int main() {
 cluster_maxnodes()
 ; return 0; }
 EOF
-if { (eval echo configure:1405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1434,7 +1474,7 @@ fi
 CPPFLAGS="$CPPFLAGS -I$kernelinc"
 CFLAGS="$CFLAGS -I$kernelinc"
 echo $ac_n "checking for kernel >= 2.4.0""... $ac_c" 1>&6
-echo "configure:1438: checking for kernel >= 2.4.0" >&5
+echo "configure:1478: checking for kernel >= 2.4.0" >&5
 if test "$cross_compiling" = yes; then
   
     KERN="_KRNL_2_2_"
@@ -1442,7 +1482,7 @@ if test "$cross_compiling" = yes; then
   
 else
   cat > conftest.$ac_ext <<EOF
-#line 1446 "configure"
+#line 1486 "configure"
 #include "confdefs.h"
 
   #include <stdlib.h>
@@ -1455,7 +1495,7 @@ else
   #endif
   }
 EOF
-if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
     KERN="_KRNL_2_4_"
@@ -1479,17 +1519,17 @@ IPVS_SUPPORT="_WITHOUT_LVS_"
 if test "$enable_lvs" != "no"; then
   ac_safe=`echo "net/ip_vs.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for net/ip_vs.h""... $ac_c" 1>&6
-echo "configure:1483: checking for net/ip_vs.h" >&5
+echo "configure:1523: checking for net/ip_vs.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1488 "configure"
+#line 1528 "configure"
 #include "confdefs.h"
 #include <net/ip_vs.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1493: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1521,7 +1561,7 @@ fi
 
 if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
   echo $ac_n "checking for IPVS version""... $ac_c" 1>&6
-echo "configure:1525: checking for IPVS version" >&5
+echo "configure:1565: checking for IPVS version" >&5
   if test "$cross_compiling" = yes; then
   
     IPVS_MAJOR="0"
@@ -1530,7 +1570,7 @@ echo "configure:1525: checking for IPVS version" >&5
   
 else
   cat > conftest.$ac_ext <<EOF
-#line 1534 "configure"
+#line 1574 "configure"
 #include "confdefs.h"
  
     #include <stdlib.h>
@@ -1545,7 +1585,7 @@ else
     } 
   
 EOF
-if { (eval echo configure:1549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
     IPVS_MAJOR=`head -n 1 ipvsinfo | tail -n 1`
@@ -1577,7 +1617,45 @@ if test "$IPVS_SUPPORT" = "_WITHOUT_LVS_" -a "$enable_vrrp" = "no"; then
 fi
 
 if test "$enable_vrrp" != "no"; then
-  VRRP_SUPPORT="_WITH_VRRP_"
+  echo $ac_n "checking for kernel netlink support""... $ac_c" 1>&6
+echo "configure:1622: checking for kernel netlink support" >&5
+  if test "$cross_compiling" = yes; then
+  
+      echo "$ac_t""no" 1>&6
+    
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1629 "configure"
+#include "confdefs.h"
+
+    #include <asm/types.h>
+    #include <sys/socket.h>
+    #include <linux/netlink.h>
+    int main (void) {
+      int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+      if (fd < 0)
+        exit(1);
+      close(fd);
+      exit(0);
+    }
+EOF
+if { (eval echo configure:1643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  
+      echo "$ac_t""yes" 1>&6
+      VRRP_SUPPORT="_WITH_VRRP_"
+    
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  
+      echo "$ac_t""no" 1>&6
+    
+fi
+rm -fr conftest*
+fi
+
 fi
 
 if test "${ci_linux}" = "yes"; then
@@ -1604,7 +1682,7 @@ fi
 IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
 if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
   echo $ac_n "checking for LVS syncd support""... $ac_c" 1>&6
-echo "configure:1608: checking for LVS syncd support" >&5
+echo "configure:1686: checking for LVS syncd support" >&5
   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
@@ -1627,12 +1705,12 @@ fi
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1631: checking for working const" >&5
+echo "configure:1709: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1636 "configure"
+#line 1714 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1681,7 +1759,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1702,12 +1780,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1706: checking for pid_t" >&5
+echo "configure:1784: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1711 "configure"
+#line 1789 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1735,12 +1813,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1739: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:1817: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1744 "configure"
+#line 1822 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -1749,7 +1827,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:1753: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -1772,13 +1850,13 @@ fi
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1776: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1854: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 1782 "configure"
+#line 1860 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -1796,7 +1874,7 @@ rm -f conftest*
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 1800 "configure"
+#line 1878 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -1818,12 +1896,12 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1822: checking return type of signal handlers" >&5
+echo "configure:1900: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1827 "configure"
+#line 1905 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -1840,7 +1918,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:1844: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -1861,12 +1939,12 @@ EOF
 for ac_func in gettimeofday select socket strerror strtol uname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1865: checking for $ac_func" >&5
+echo "configure:1943: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1870 "configure"
+#line 1948 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1889,7 +1967,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
index 38b346b..294b424 100644 (file)
@@ -37,6 +37,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)
 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.            !!!]))
@@ -128,8 +129,27 @@ 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 ----[ Checks for kernel netlink support ]----
 if test "$enable_vrrp" != "no"; then
-  VRRP_SUPPORT="_WITH_VRRP_"
+  AC_MSG_CHECKING([for kernel netlink support])
+  AC_TRY_RUN([
+    #include <asm/types.h>
+    #include <sys/socket.h>
+    #include <linux/netlink.h>
+    int main (void) {
+      int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+      if (fd < 0)
+        exit(1);
+      close(fd);
+      exit(0);
+    }], [
+      AC_MSG_RESULT(yes)
+      VRRP_SUPPORT="_WITH_VRRP_"
+    ], [
+      AC_MSG_RESULT(no)
+    ], [
+      AC_MSG_RESULT(no)
+    ])
 fi
 
 if test "${ci_linux}" = "yes"; then
index c754d1e..62aff91 100644 (file)
@@ -27,7 +27,7 @@ $(EXEC): $(OBJS)
 clean:
        rm -f core *.o
 
-distclean:
+distclean: clean
        rm -f Makefile
 
 uninstall:
diff --git a/genhash/client.o b/genhash/client.o
deleted file mode 100644 (file)
index f8965ff..0000000
Binary files a/genhash/client.o and /dev/null differ
diff --git a/genhash/common.o b/genhash/common.o
deleted file mode 100644 (file)
index 52072a8..0000000
Binary files a/genhash/common.o and /dev/null differ
diff --git a/genhash/main.o b/genhash/main.o
deleted file mode 100644 (file)
index 0b8c066..0000000
Binary files a/genhash/main.o and /dev/null differ
index 6789e88..1fd9877 100644 (file)
@@ -1,9 +1,9 @@
 Summary: Generic HA monitor build upon VRRP and services poller, strongly recommanded for LVS HA.
 Name: keepalived
-Packager: Christophe Varoqui <christophe.varoqui@free.fr>
-Version: 0.6.6
+Packager: Christophe Varoqui, <christophe.varoqui@free.fr>
+Version: 0.6.7
 Release: 1
-Source: http://www.keepalived.org/software/keepalived-0.6.6.tar.gz
+Source: http://www.keepalived.org/software/keepalived-0.6.7.tar.gz
 Copyright: GPL
 Group: Utilities/File
 BuildRoot: /tmp/%{name}-%{version}.build
@@ -14,7 +14,7 @@ The main goal of the keepalived project is to add a strong & robust keepalive fa
 
 %prep
 rm -rf %{buildroot}
-%setup -n keepalived-0.6.6
+%setup -n keepalived-0.6.7
 
 %build
 ./configure --prefix=%{buildroot} --exec-prefix=%{buildroot} --sysconfdir=%{buildroot}/etc
index cacbd02..0924806 100644 (file)
@@ -40,8 +40,8 @@ endif
 all:
        @set -e; \
        for i in $(SUBDIRS); do \
-       $(MAKE) -C $$i; done && \
-       echo "Building $(EXEC) in $(BIN)" && \
+       $(MAKE) -C $$i || exit 1; done && \
+       echo "Building $(BIN)/$(EXEC)" && \
        $(CC) -o $(BIN)/$(EXEC) $(LDFLAGS) `find $(SUBDIRS) -name '*.[oa]'`
        strip $(BIN)/$(EXEC)
        @echo ""
@@ -50,8 +50,8 @@ all:
 debug:
        @set -e; \
        for i in $(SUBDIRS); do \
-       $(MAKE) -C $$i; done && \
-       echo "Building $(EXEC) in $(BIN)" && \
+       $(MAKE) -C $$i || exit 1; done && \
+       echo "Building $(BIN)/$(EXEC)" && \
        $(CC) -o $(BIN)/$(EXEC) $(LDFLAGS) `find $(SUBDIRS) -name '*.[oa]'`
        @echo ""
        @echo "Make complete"
index dea3ec9..37062ef 100644 (file)
@@ -26,3 +26,23 @@ clean:
 
 distclean: clean
        rm -f Makefile
+
+
+main.o: main.c ../include/main.h
+memory.o: memory.c ../include/memory.h
+daemon.o: daemon.c ../include/daemon.h
+pidfile.o: pidfile.c ../include/pidfile.h
+utils.o: utils.c ../include/utils.h
+timer.o: timer.c ../include/timer.h
+scheduler.o: scheduler.c ../include/scheduler.h ../include/memory.h \
+  ../include/utils.h
+vector.o: vector.c ../include/vector.h ../include/memory.h
+list.o: list.c ../include/list.h ../include/memory.h
+data.o: data.c ../include/data.h ../include/memory.h ../include/utils.h \
+  ../include/check_api.h ../include/vrrp.h ../include/vrrp_sync.h
+parser.o: parser.c ../include/parser.h ../include/memory.h ../include/vrrp.h \
+  ../include/vrrp_if.h ../include/check_api.h
+layer4.o: layer4.c ../include/layer4.h ../include/check_api.h ../include/utils.h
+smtp.o: smtp.c ../include/smtp.h ../include/memory.h ../include/list.h \
+  ../include/utils.h
+
index 920f31a..f5aed58 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: main.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b03c3ed..fbe3dac 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: data.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: data.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -398,6 +398,8 @@ dump_rs(void *data)
               inet_ntop2(SVR_IP(rs))
               , ntohs(SVR_PORT(rs))
               , rs->weight);
+       if (rs->inhibit)
+               syslog(LOG_INFO, "     -> Inhibit service on failure");
 }
 
 void
@@ -410,7 +412,6 @@ alloc_rs(char *ip, char *port)
 
        inet_ston(ip, &new->addr_ip);
        new->addr_port = htons(atoi(port));
-       new->alive = 1;
 
        if (LIST_ISEMPTY(vs->rs))
                vs->rs = alloc_list(free_rs, dump_rs);
index 072cd77..cec750c 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: layer4.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index f6f4f79..76b1fb2 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: list.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 2ffa8db..d2337bc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: main.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -304,7 +304,7 @@ end:
        keepalived_free_final();
 #endif
 
-       closelog();
        /* finally return from system */
+       closelog();
        exit(0);
 }
index d60c875..81a3168 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Memory management framework. This framework is used to
  *              find any memory leak.
  *
- * Version:     $Id: memory.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: memory.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -224,7 +224,7 @@ keepalived_free(void *buffer, char *file, char *function, int line)
        }
 
        if (buffer != NULL)
-               free(buffer);
+               xfree(buffer);
 
        if (debug & 1)
                printf("%sfree  [%3d:%3d], %p, %4ld at %s, %3d, %s\n",
index 3232148..05e7893 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: parser.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -660,6 +660,13 @@ weight_handler(vector strvec)
        real_server *rs = LIST_TAIL_DATA(vs->rs);
        rs->weight = atoi(VECTOR_SLOT(strvec, 1));
 }
+static void
+inhibit_handler(vector strvec)
+{
+       virtual_server *vs = LIST_TAIL_DATA(conf_data->vs);
+       real_server *rs = LIST_TAIL_DATA(vs->rs);
+       rs->inhibit = 1;
+}
 
 /* Real Servers Groups for VS handlers */
 static void
@@ -789,6 +796,7 @@ init_keywords(void)
        install_keyword("real_server", &rs_handler);
        install_sublevel();
        install_keyword("weight", &weight_handler);
+       install_keyword("inhibit_on_failure", &inhibit_handler);
 
        /* Checkers mapping */
        install_checkers_keyword();
index 8b5ca64..4704b47 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: pidfile.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 3edab12..9e0b1b7 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 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: scheduler.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 0be9e4a..c89b938 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 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: smtp.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include "utils.h"
 
 extern data *conf_data;
-
-/* static prototype */
-static int smtp_send_cmd_thread(thread *);
+extern thread_master *master;
+
+/* SMTP FSM definition */
+static int connection_error(thread *);
+static int connection_in_progress(thread *);
+static int connection_timeout(thread *);
+static int connection_success(thread *);
+static int helo_cmd(thread *);
+static int mail_cmd(thread *);
+static int rcpt_cmd(thread *);
+static int data_cmd(thread *);
+static int body_cmd(thread *);
+static int quit_cmd(thread *);
+
+static int connection_code(thread *, int);
+static int helo_code(thread *, int);
+static int mail_code(thread *, int);
+static int rcpt_code(thread *, int);
+static int data_code(thread *, int);
+static int body_code(thread *, int);
+static int quit_code(thread *, int);
+
+static int smtp_read_thread(thread *);
+static int smtp_send_thread(thread *);
+
+struct {
+       int (*send) (thread *);
+       int (*read) (thread *, int);
+} SMTP_FSM[SMTP_MAX_FSM_STATE] = {
+/*      Stream Write Handlers    |   Stream Read handlers   *
+ *-------------------------------+--------------------------*/
+       {connection_error,              NULL},                  /* connect_error */
+       {connection_in_progress,        NULL},                  /* connect_in_progress */
+       {connection_timeout,            NULL},                  /* connect_timeout */
+       {connection_success,            connection_code},       /* connect_success */
+       {helo_cmd,                      helo_code},             /* HELO */
+       {mail_cmd,                      mail_code},             /* MAIL */
+       {rcpt_cmd,                      rcpt_code},             /* RCPT */
+       {data_cmd,                      data_code},             /* DATA */
+       {body_cmd,                      body_code},             /* BODY */
+       {quit_cmd,                      quit_code}              /* QUIT */
+};
 
 static void
 free_smtp_all(smtp_thread_arg * smtp_arg)
@@ -47,11 +86,67 @@ fetch_next_email(smtp_thread_arg * smtp_arg)
        return list_element(conf_data->email, smtp_arg->email_it);
 }
 
+/* layer4 connection handlers */
+static int
+connection_error(thread * thread)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+
+       DBG("SMTP connection ERROR to [%s:%d].",
+           inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+       free_smtp_all(smtp_arg);
+       return 0;
+}
+static int
+connection_timeout(thread * thread)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+
+       DBG("Timeout connecting SMTP server [%s:%d].",
+           inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+       free_smtp_all(smtp_arg);
+       return 0;
+}
+static int
+connection_in_progress(thread * thread)
+{
+       int status;
+
+       DBG("SMTP connection to [%s:%d] now IN_PROGRESS.",
+           inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+
+       /*
+        * Here we use the propriety of a union structure,
+        * each element of the structure have the same value.
+        */
+       status =
+           tcp_socket_state(thread->u.fd, thread, conf_data->smtp_server,
+                            htons(SMTP_PORT), connection_in_progress);
+
+       if (status != connect_in_progress)
+               SMTP_FSM_SEND(status, thread);
+
+       return 0;
+}
 static int
-smtp_read_cmd_thread(thread * thread)
+connection_success(thread * thread)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+
+       DBG("Remote SMTP server [%s:%d] connected.",
+           inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+
+       smtp_arg->stage = connect_success;
+       thread_add_read(thread->master, smtp_read_thread, smtp_arg,
+                       smtp_arg->fd, conf_data->smtp_connection_to);
+       return 0;
+}
+
+/* SMTP protocol handlers */
+static int
+smtp_read_thread(thread * thread)
 {
        smtp_thread_arg *smtp_arg;
-       char *fetched_email;
        char *buffer;
        char *reply;
        int rcv_buffer_size = 0;
@@ -62,45 +157,37 @@ smtp_read_cmd_thread(thread * thread)
        if (thread->type == THREAD_READ_TIMEOUT) {
                DBG("Timeout reading data to remote SMTP server [%s:%d].",
                    inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               free_smtp_all(smtp_arg);
-               close(thread->u.fd);
-               return 0;
+               SMTP_FSM_READ(QUIT, thread, 0);
+               return -1;
        }
 
        buffer = smtp_arg->buffer;
 
-       while ((rcv_buffer_size =
-               read(thread->u.fd, buffer + smtp_arg->buflen,
-                    SMTP_BUFFER_LENGTH - smtp_arg->buflen)) != 0) {
-               if (rcv_buffer_size == -1) {
-                       if (errno == EAGAIN)
-                               goto end;
-                       DBG("Error reading data to remote SMTP server [%s:%d].",
-                           inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-                       free_smtp_all(smtp_arg);
-                       close(thread->u.fd);
-                       return 0;
-               }
+       rcv_buffer_size = read(thread->u.fd, buffer + smtp_arg->buflen,
+                              SMTP_BUFFER_LENGTH - smtp_arg->buflen);
 
-               /* received data overflow buffer size ? */
-               if (smtp_arg->buflen >= SMTP_BUFFER_MAX) {
-                       DBG("Received buffer from remote SMTP server [%s:%d]"
-                           " overflow our get read buffer length.",
-                           inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-                       free_smtp_all(smtp_arg);
-                       close(thread->u.fd);
-                       return 0;
-               } else {
-                       smtp_arg->buflen += rcv_buffer_size;
-                       buffer[smtp_arg->buflen] = 0;   /* NULL terminate */
-                       if (rcv_buffer_size < SMTP_BUFFER_LENGTH)
-                               goto end;
-               }
+       if (rcv_buffer_size == -1) {
+               if (errno == EAGAIN)
+                       goto end;
+               DBG("Error reading data from remote SMTP server [%s:%d].",
+                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+               SMTP_FSM_READ(QUIT, thread, 0);
+               return 0;
        }
 
-      end:
+       /* received data overflow buffer size ? */
+       if (smtp_arg->buflen >= SMTP_BUFFER_MAX) {
+               DBG("Received buffer from remote SMTP server [%s:%d]"
+                   " overflow our get read buffer length.",
+                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+               SMTP_FSM_READ(QUIT, thread, 0);
+               return 0;
+       } else {
+               smtp_arg->buflen += rcv_buffer_size;
+               buffer[smtp_arg->buflen] = 0;   /* NULL terminate */
+       }
 
-// printf("Received : %s", buffer);
+end:
 
        /* parse the buffer, finding the last line of the response for the code */
        reply = buffer;
@@ -114,9 +201,8 @@ smtp_read_cmd_thread(thread * thread)
                        smtp_arg->buflen -= (reply - buffer);
                        buffer[smtp_arg->buflen] = 0;
 
-                       thread_add_read(thread->master, smtp_read_cmd_thread,
-                                       smtp_arg, thread->u.fd,
-                                       conf_data->smtp_connection_to);
+                       thread_add_read(thread->master, smtp_read_thread, smtp_arg,
+                                       thread->u.fd, conf_data->smtp_connection_to);
                        return 0;
                }
 
@@ -139,311 +225,302 @@ smtp_read_cmd_thread(thread * thread)
        buffer[smtp_arg->buflen] = 0;
 
        if (status == -1) {
-               thread_add_read(thread->master, smtp_read_cmd_thread, smtp_arg,
+               thread_add_read(thread->master, smtp_read_thread, smtp_arg,
                                thread->u.fd, conf_data->smtp_connection_to);
                return 0;
        }
 
-       /* setting the next stage */
-       switch (smtp_arg->stage) {
-       case CONNECTION:
-               if (status == 220) {
-                       smtp_arg->stage = HELO;
-               } else {
-                       DBG("Error connecting smtp server : [%s]",
-                           buffer);
-                       smtp_arg->stage = ERROR;
-               }
-               break;
+       SMTP_FSM_READ(smtp_arg->stage, thread, status);
 
-       case HELO:
-               if (status == 250) {
-                       smtp_arg->stage = MAIL;
-               } else {
-                       DBG("Error processing HELO cmd : [%s]",
-                           buffer);
-                       smtp_arg->stage = ERROR;
-               }
-               break;
+       /* Registering next smtp command processing thread */
+       if (smtp_arg->stage != ERROR) {
+               thread_add_write(thread->master, smtp_send_thread, smtp_arg,
+                                smtp_arg->fd, conf_data->smtp_connection_to);
+       } else {
+               DBG("Can not read data from remote SMTP server [%s:%d].",
+                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+               SMTP_FSM_READ(QUIT, thread, 0);
+       }
 
-       case MAIL:
-               if (status == 250) {
-                       smtp_arg->stage = RCPT;
-               } else {
-                       DBG("Error processing MAIL FROM cmd : [%s]",
-                           buffer);
-                       smtp_arg->stage = ERROR;
-               }
-               break;
+       return 0;
+}
 
-       case RCPT:
-               if (status == 250) {
-                       smtp_arg->email_it++;
+static int
+smtp_send_thread(thread * thread)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+       
+       if (thread->type == THREAD_WRITE_TIMEOUT) {
+               DBG("Timeout sending data to remote SMTP server [%s:%d].",
+                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+               SMTP_FSM_READ(QUIT, thread, 0);
+               return 0;
+       }
 
-                       fetched_email = fetch_next_email(smtp_arg);
+       SMTP_FSM_SEND(smtp_arg->stage, thread);
 
-                       if (!fetched_email)
-                               smtp_arg->stage = DATA;
-               } else {
-                       DBG("Error processing RCPT TO cmd : [%s]",
-                           buffer);
-                       smtp_arg->stage = ERROR;
-               }
-               break;
+       /* Handle END command */
+       if (smtp_arg->stage == END) {
+               SMTP_FSM_READ(QUIT, thread, 0);
+               return 0;
+       }
 
-       case DATA:
-               if (status == 354) {
-                       smtp_arg->stage = BODY;
-               } else {
-                       DBG("Error processing DATA cmd : [%s]",
-                           buffer);
-                       smtp_arg->stage = ERROR;
-               }
-               break;
+       /* Registering next smtp command processing thread */
+       if (smtp_arg->stage != ERROR) {
+               thread_add_read(thread->master, smtp_read_thread, smtp_arg,
+                               thread->u.fd, conf_data->smtp_connection_to);
+       } else {
+               DBG("Can not send data to remote SMTP server [%s:%d].",
+                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
+               SMTP_FSM_READ(QUIT, thread, 0);
+       }
 
-       case BODY:
-               if (status == 250) {
-                       smtp_arg->stage = QUIT;
-                       syslog(LOG_INFO, "SMTP alert successfully sent.");
-               } else {
-                       DBG("Error processing DOT cmd : [%s]",
-                           buffer);
-                       smtp_arg->stage = ERROR;
-               }
-               break;
+       return 0;
+}
 
-       case QUIT:
-               /* final state, we are disconnected from the remote host */
-               free_smtp_all(smtp_arg);
-               close(thread->u.fd);
-               return 0;
 
-       case ERROR:
-               break;
+static int
+connection_code(thread * thread, int status)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+
+       if (status == 220) {
+               smtp_arg->stage++;
+       } else {
+               DBG("Error connecting smtp server");
+               smtp_arg->stage = ERROR;
        }
 
-       /* Registering next smtp command processing thread */
-       thread_add_write(thread->master, smtp_send_cmd_thread, smtp_arg,
-                        thread->u.fd, conf_data->smtp_connection_to);
        return 0;
 }
 
-/* Getting localhost official canonical name */
-static char *
-get_local_name(void)
+/* HELO command processing */
+static int
+helo_cmd(thread * thread)
 {
-       struct hostent *host;
-       struct utsname name;
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+       char *buffer;
 
-       if (uname(&name) < 0)
-               return NULL;
+       buffer = (char *)MALLOC(SMTP_BUFFER_MAX);
+       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HELO_CMD,
+                get_local_name());
+       if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
+               smtp_arg->stage = ERROR;
+       FREE(buffer);
 
-       if (!(host = gethostbyname(name.nodename)))
-               return NULL;
+       return 0;
+}
+static int
+helo_code(thread * thread, int status)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+
+       if (status == 250) {
+               smtp_arg->stage++;
+       } else {
+               DBG("Error processing HELO cmd");
+               smtp_arg->stage = ERROR;
+       }
 
-       return host->h_name;
+       return 0;
 }
 
+/* MAIL command processing */
 static int
-smtp_send_cmd_thread(thread * thread)
+mail_cmd(thread * thread)
 {
-       smtp_thread_arg *smtp_arg;
-       char *fetched_email;
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
        char *buffer;
 
-       smtp_arg = THREAD_ARG(thread);
+       buffer = (char *)MALLOC(SMTP_BUFFER_MAX);
+       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_MAIL_CMD,
+                conf_data->email_from);
+       if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
+               smtp_arg->stage = ERROR;
+       FREE(buffer);
 
-       if (thread->type == THREAD_WRITE_TIMEOUT) {
-               DBG("Timeout sending data to remote SMTP server [%s:%d].",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               free_smtp_all(smtp_arg);
-               close(thread->u.fd);
-               return 0;
+       return 0;
+}
+static int
+mail_code(thread * thread, int status)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+
+       if (status == 250) {
+               smtp_arg->stage++;
+       } else {
+               DBG("Error processing MAIL cmd");
+               smtp_arg->stage = ERROR;
        }
 
-       /* allocate temporary command buffer */
-       buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
+       return 0;
+}
 
-       switch (smtp_arg->stage) {
-       case CONNECTION:
-               break;
+/* RCPT command processing */
+static int
+rcpt_cmd(thread * thread)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+       char *buffer;
+       char *fetched_email;
 
-       case HELO:
-               snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HELO_CMD,
-                        get_local_name());
-               if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-                       smtp_arg->stage = ERROR;
-               break;
+       buffer = (char *)MALLOC(SMTP_BUFFER_MAX);
+       /* We send RCPT TO command multiple time to add all our email receivers.
+        * --rfc821.3.1
+        */
+       fetched_email = fetch_next_email(smtp_arg);
 
-       case MAIL:
-               snprintf(buffer, SMTP_BUFFER_MAX, SMTP_MAIL_CMD,
-                        conf_data->email_from);
-               if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-                       smtp_arg->stage = ERROR;
-               break;
+       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_RCPT_CMD, fetched_email);
+       if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
+               smtp_arg->stage = ERROR;
+       FREE(buffer);
 
-       case RCPT:
-               /* We send RCPT TO command multiple time to add all our email receivers.
-                * --rfc821.3.1
-                */
-               fetched_email = fetch_next_email(smtp_arg);
+       return 0;
+}
+static int
+rcpt_code(thread * thread, int status)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+       char *fetched_email;
 
-               snprintf(buffer, SMTP_BUFFER_MAX, SMTP_RCPT_CMD, fetched_email);
-               if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-                       smtp_arg->stage = ERROR;
-               break;
+       if (status == 250) {
+               smtp_arg->email_it++;
 
-       case DATA:
-               if (send(thread->u.fd, SMTP_DATA_CMD, strlen(SMTP_DATA_CMD), 0)
-                   == -1)
-                       smtp_arg->stage = ERROR;
-               break;
+               fetched_email = fetch_next_email(smtp_arg);
 
-       case BODY:
-               snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HEADERS_CMD,
-                        conf_data->email_from, smtp_arg->subject);
-               /* send the subject field */
-               if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-                       smtp_arg->stage = ERROR;
-
-               memset(buffer, 0, SMTP_BUFFER_MAX);
-               snprintf(buffer, SMTP_BUFFER_MAX, SMTP_BODY_CMD,
-                        smtp_arg->body);
-               /* send the the body field */
-               if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
-                       smtp_arg->stage = ERROR;
-
-               /* send the sending dot */
-               if (send(thread->u.fd, SMTP_SEND_CMD, strlen(SMTP_SEND_CMD), 0)
-                   == -1)
-                       smtp_arg->stage = ERROR;
-               break;
+               if (!fetched_email)
+                       smtp_arg->stage++;
+       } else {
+               DBG("Error processing RCPT cmd");
+               smtp_arg->stage = ERROR;
+       }
 
-       case QUIT:
-               if (send(thread->u.fd, SMTP_QUIT_CMD, strlen(SMTP_QUIT_CMD), 0)
-                   == -1)
-                       smtp_arg->stage = ERROR;
-               break;
+       return 0;
+}
 
-       case ERROR:
-               DBG("Can not send data to remote SMTP server [%s:%d].",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               /* we just cleanup the room */
-               free_smtp_all(smtp_arg);
-               close(thread->u.fd);
-               FREE(buffer);
-               return 0;
-               break;
-       }
+/* DATA command processing */
+static int
+data_cmd(thread * thread)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
 
-// printf("Sending : %s", buffer);
+       if (send(thread->u.fd, SMTP_DATA_CMD, strlen(SMTP_DATA_CMD), 0)
+           == -1)
+               smtp_arg->stage = ERROR;
+       return 0;
+}
+static int
+data_code(thread * thread, int status)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
 
-       /* Registering next smtp command processing thread */
-       thread_add_read(thread->master, smtp_read_cmd_thread, smtp_arg,
-                       thread->u.fd, conf_data->smtp_connection_to);
+       if (status == 354) {
+               smtp_arg->stage++;
+       } else {
+               DBG("Error processing DATA cmd");
+               smtp_arg->stage = ERROR;
+       }
 
-       FREE(buffer);
        return 0;
 }
 
-/* SMTP checkers threads */
+/* BODY command processing.
+ * Do we need to use mutli-thread for multi-part body
+ * handling ? Don t really think :)
+ */
 static int
-smtp_check_thread(thread * thread)
+body_cmd(thread * thread)
 {
-       smtp_thread_arg *smtp_arg;
-       int status;
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+       char *buffer;
 
-       smtp_arg = THREAD_ARG(thread);
+       buffer = (char *)MALLOC(SMTP_BUFFER_MAX);
 
-       status =
-           tcp_socket_state(thread->u.fd, thread, conf_data->smtp_server,
-                            htons(SMTP_PORT)
-                            , smtp_check_thread);
+       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HEADERS_CMD,
+                conf_data->email_from, smtp_arg->subject);
 
-       switch (status) {
-       case connect_error:
-               DBG("Error connecting SMTP server [%s:%d].",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               free_smtp_all(smtp_arg);
-               break;
+       /* send the subject field */
+       if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
+               smtp_arg->stage = ERROR;
 
-       case connect_timeout:
-               DBG("Timeout writing data to SMTP server [%s:%d].",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               free_smtp_all(smtp_arg);
-               break;
+       memset(buffer, 0, SMTP_BUFFER_MAX);
+       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_BODY_CMD,
+                smtp_arg->body);
 
-       case connect_success:
-               /* Remote SMTP server is connected.
-                * Register the next step thread smtp_cmd_thread.
-                */
-               DBG("Remote SMTP server [%s:%d] connected.",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               thread_add_write(thread->master, smtp_send_cmd_thread, smtp_arg,
-                                thread->u.fd, conf_data->smtp_connection_to);
-               break;
-       }
+       /* send the the body field */
+       if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
+               smtp_arg->stage = ERROR;
+
+       /* send the sending dot */
+       if (send(thread->u.fd, SMTP_SEND_CMD, strlen(SMTP_SEND_CMD), 0)
+           == -1)
+               smtp_arg->stage = ERROR;
 
+       FREE(buffer);
        return 0;
 }
-
 static int
-smtp_connect_thread(thread * thread)
+body_code(thread * thread, int status)
 {
-       smtp_thread_arg *smtp_arg;
-       enum connect_result status;
-       int fd;
-
-       smtp_arg = THREAD_ARG(thread);
-
-       /* Return if no smtp server is defined */
-       if (conf_data->smtp_server == 0) {
-               free_smtp_all(smtp_arg);
-               return 0;
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
+
+       if (status == 250) {
+               syslog(LOG_INFO, "SMTP alert successfully sent.");
+               smtp_arg->stage++;
+       } else {
+               DBG("Error processing DOT cmd");
+               smtp_arg->stage = ERROR;
        }
 
-       if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
-               DBG("SMTP connect fail to create socket.");
-               return 0;
-       }
+       return 0;
+}
 
-       status = tcp_connect(fd, conf_data->smtp_server, htons(SMTP_PORT));
+/* QUIT command processing */
+static int
+quit_cmd(thread * thread)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
 
-       switch (status) {
-       case connect_error:
-               DBG("SMTP connection ERROR to [%s:%d].",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               free_smtp_all(smtp_arg);
-               close(fd);
-               return 0;
-               break;
+       if (send(thread->u.fd, SMTP_QUIT_CMD, strlen(SMTP_QUIT_CMD), 0)
+           == -1)
+               smtp_arg->stage = ERROR;
+       else
+               smtp_arg->stage++;
+       return 0;
+}
+static int
+quit_code(thread * thread, int status)
+{
+       smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
 
-       case connect_timeout:
-               DBG("Timeout connecting SMTP server [%s:%d].",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               free_smtp_all(smtp_arg);
-               close(fd);
-               return 0;
-               break;
+       /* final state, we are disconnected from the remote host */
+       free_smtp_all(smtp_arg);
+       close(thread->u.fd);
+       return 0;
+}
 
-       case connect_success:
-               DBG("SMTP connection SUCCESS to [%s:%d].",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               break;
+/* connect remote SMTP server */
+static void
+smtp_connect(smtp_thread_arg *smtp_arg)
+{
+       enum connect_result status;
 
-               /* Checking non-blocking connect, we wait until socket is writable */
-       case connect_in_progress:
-               DBG("SMTP connection to [%s:%d] now IN_PROGRESS.",
-                   inet_ntop2(conf_data->smtp_server), SMTP_PORT);
-               break;
+       if ((smtp_arg->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))
+            == -1) {
+               DBG("SMTP connect fail to create socket.");
+               free_smtp_all(smtp_arg);
+               return;
        }
 
-       /* connection have succeeded or still in progress */
-       thread_add_write(thread->master, smtp_check_thread, smtp_arg, fd,
-                        conf_data->smtp_connection_to);
-       return 1;
+       status = tcp_connect(smtp_arg->fd, conf_data->smtp_server,
+                            htons(SMTP_PORT));
+
+       /* Handle connection status code */
+       thread_add_event(master, SMTP_FSM[status].send, smtp_arg,
+                        smtp_arg->fd);
 }
 
+/* Main entry point */
 void
 smtp_alert(thread_master * master, real_server * rs, vrrp_rt * vrrp,
           const char *subject, const char *body)
@@ -451,15 +528,14 @@ smtp_alert(thread_master * master, real_server * rs, vrrp_rt * vrrp,
        smtp_thread_arg *smtp_arg;
 
        /* Only send mail if email specified */
-       if (!LIST_ISEMPTY(conf_data->email)) {
+       if (!LIST_ISEMPTY(conf_data->email) &&
+           conf_data->smtp_server != 0) {
                /* allocate & initialize smtp argument data structure */
                smtp_arg = (smtp_thread_arg *) MALLOC(sizeof (smtp_thread_arg));
                smtp_arg->subject = (char *) MALLOC(MAX_HEADERS_LENGTH);
                smtp_arg->body = (char *) MALLOC(MAX_BODY_LENGTH);
                smtp_arg->buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
 
-               smtp_arg->stage = CONNECTION;   /* first smtp command set to HELO */
-
                /* format subject if rserver is specified */
                if (rs)
                        snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH,
@@ -480,6 +556,6 @@ smtp_alert(thread_master * master, real_server * rs, vrrp_rt * vrrp,
 
                strncpy(smtp_arg->body, body, MAX_BODY_LENGTH);
 
-               thread_add_event(master, smtp_connect_thread, smtp_arg, 0);
+               smtp_connect(smtp_arg);
        }
 }
index 3e2b001..f2dd62f 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: timer.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 9c8a812..e1fe45d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: utils.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -149,3 +149,19 @@ inet_ston(const char *addr, uint32_t * dst)
        memcpy(dst, tmp, INADDRSZ);
        return 1;
 }
+
+/* Getting localhost official canonical name */
+char *
+get_local_name(void)
+{
+       struct hostent *host;
+       struct utsname name;
+
+       if (uname(&name) < 0)
+               return NULL;
+
+       if (!(host = gethostbyname(name.nodename)))
+               return NULL;
+
+       return host->h_name;
+}
index 677d02a..de15241 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vector.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 72f0000..c13930a 100644 (file)
@@ -59,7 +59,6 @@ virtual_server 10.10.10.2 1358 {
     delay_loop 6
     lb_algo rr 
     lb_kind NAT
-    nat_mask 255.255.255.0
     persistence_timeout 50
     protocol TCP
 
index c3c6017..4ec5a89 100644 (file)
@@ -21,8 +21,8 @@ OBJS =        check_api.o check_tcp.o check_http.o check_ssl.o \
        check_misc.o ipwrapper.o ipvswrapper.o $(CI_LINUX_OBJ)
 
 ifeq ($(KERNEL),_KRNL_2_2_)
-OBJS += ipfwwrapper.o
-HEADERS += ipfwwrapper.h
+  OBJS += ipfwwrapper.o
+  HEADERS += ipfwwrapper.h
 endif
 
 HEADERS = $(OBJS:.o=.h)
@@ -37,3 +37,21 @@ clean:
 
 distclean: clean
        rm -f Makefile
+
+check_api.o: check_api.c ../include/check_api.h ../include/parser.h \
+  ../include/memory.h ../include/utils.h ../include/check_misc.h \
+  ../include/check_tcp.h ../include/check_http.h ../include/check_ssl.h
+check_tcp.o: check_tcp.c ../include/check_tcp.h ../include/check_api.h \
+  ../include/memory.h ../include/ipwrapper.h ../include/layer4.h \
+  ../include/smtp.h ../include/utils.h ../include/parser.h
+check_http.o: check_http.c ../include/check_http.h ../include/check_ssl.h \
+  ../include/check_api.h ../include/memory.h ../include/parser.h \
+  ../include/utils.h
+check_ssl.o: check_ssl.c ../include/check_ssl.h ../include/check_api.h \
+  ../include/memory.h ../include/parser.h ../include/smtp.h \
+  ../include/utils.h
+check_misc.o: check_misc.c ../include/check_misc.h ../include/check_api.h \
+  ../include/memory.h ../include/ipwrapper.h ../include/smtp.h \
+  ../include/utils.h ../include/parser.h ../include/daemon.h
+ipwrapper.o: ipwrapper.c ../include/ipwrapper.h ../include/utils.h
+ipvswrapper.o: ipvswrapper.c ../include/ipvswrapper.h ../include/utils.h
index 9316cd9..e231780 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_api.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 63544a3..52e6ada 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        CI-LINUX checker. Integration to Compaq Cluster Infrastructure.
  *
- * Version:     $Id: check_ci.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_ci.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Aneesh Kumar K.V, <aneesh.kumar@digital.com>
index 1507c52..b467dc1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_http.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 8eed2f9..4dd513f 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 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_misc.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
index 73d630d..8f0f7ef 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 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index d24a5d0..c829ec2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 407adad..14eebba 100644 (file)
@@ -7,7 +7,7 @@
  *              library to add/remove server MASQ rules to the kernel 
  *              firewall framework.
  *
- * Version:     $Id: ipfwwrapper.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 40cb12c..c3de759 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 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
 #include "ipvswrapper.h"
 #include "utils.h"
 
+/* local helpers functions */
+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 */
 
 int
@@ -78,6 +83,14 @@ ipvs_cmd(int cmd, virtual_server * vs, real_server * rs)
                ctl.u.vs_user.dport = SVR_PORT(rs);
        }
 
+       /* Does the service use inhibit flag ? */
+       if (ctl.m_cmd == IP_MASQ_CMD_DEL_DEST && rs->inhibit) {
+               ctl.m_cmd = IP_MASQ_CMD_SET_DEST;
+               ctl.u.vs_user.weight = 0;
+       }
+       if (ctl.m_cmd == IP_MASQ_CMD_ADD_DEST && rs->inhibit && rs->alive)
+               ctl.m_cmd = IP_MASQ_CMD_SET_DEST;
+
        sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
        if (sockfd == -1) {
                syslog(LOG_INFO,
@@ -112,10 +125,10 @@ ipvs_cmd(int cmd, virtual_server * vs, real_server * rs)
        return IPVS_SUCCESS;
 }
 
-#else                          /* KERNEL 2.4 LVS handling */
 
-/* 2.4 prototypes */
-static int modprobe_ipvs(void);
+
+
+#else                          /* KERNEL 2.4 LVS handling */
 
 static int
 ipvs_talk(int cmd, struct ip_vs_rule_user *urule)
@@ -179,8 +192,8 @@ ipvs_cmd(int cmd, virtual_server * vs, real_server * rs)
        if (!parse_timeout(vs->timeout_persistence, &urule.timeout))
                syslog(LOG_INFO,
                       "IPVS : Virtual service [%s:%d] illegal timeout.",
-                      inet_ntop2(SVR_IP(vs))
-                      , ntohs(SVR_PORT(vs)));
+                      inet_ntop2(SVR_IP(vs)), ntohs(SVR_PORT(vs)));
+
        if (urule.timeout != 0 || vs->granularity_persistence)
                urule.vs_flags = IP_VS_SVC_F_PERSISTENT;
 
@@ -203,6 +216,14 @@ ipvs_cmd(int cmd, virtual_server * vs, real_server * rs)
                urule.dport = SVR_PORT(rs);
        }
 
+       /* Does the service use inhibit flag ? */
+       if (cmd == IP_VS_SO_SET_DELDEST && rs->inhibit) {
+               urule.weight = 0;
+               cmd = IP_VS_SO_SET_EDITDEST;
+       }
+       if (cmd == IP_VS_SO_SET_ADDDEST && rs->inhibit && rs->alive)
+               cmd = IP_VS_SO_SET_EDITDEST;
+
        /* Talk to the IPVS channel */
        return ipvs_talk(cmd, &urule);
 }
@@ -210,7 +231,7 @@ ipvs_cmd(int cmd, virtual_server * vs, real_server * rs)
 #endif
 
 /*
- * IPVS synchronization daemon state transition
+ * Common IPVS functions
  */
 void
 ipvs_syncd_master(char *ifname)
@@ -227,10 +248,10 @@ ipvs_syncd_backup(char *ifname)
 }
 
 /*
- * Source code from the ipvsadm.c Wensong code
+ * Utility functions coming from Wensong code
  */
 
-int
+static int
 parse_timeout(char *buf, unsigned *timeout)
 {
        int i;
@@ -243,11 +264,11 @@ parse_timeout(char *buf, unsigned *timeout)
        if ((i = string_to_number(buf, 0, 86400 * 31)) == -1)
                return 0;
 
-       *timeout = i * HZ;
+       *timeout = i * (IP_VS_TEMPLATE_TIMEOUT / (6*60));
        return 1;
 }
 
-int
+static int
 string_to_number(const char *s, int min, int max)
 {
        int number;
@@ -267,7 +288,8 @@ string_to_number(const char *s, int min, int max)
                return -1;
 }
 
-static int modprobe_ipvs(void)
+static int
+modprobe_ipvs(void)
 {
        char *argv[] = { "/sbin/modprobe", "-s", "-k", "--", "ip_vs", NULL };
        int child;
index 0ee63ac..c8ff5a9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $id: ipwrapper.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $id: ipwrapper.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -140,8 +140,9 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
                }
 
                rs->alive = alive;
-               syslog(LOG_INFO, "Adding service [%s:%d] to VS [%s:%d]",
-                      inet_ntoa2(SVR_IP(rs), rsip)
+               syslog(LOG_INFO, "%s service [%s:%d] to VS [%s:%d]",
+                      (rs->inhibit) ? "Enabling" : "Adding"
+                      , inet_ntoa2(SVR_IP(rs), rsip)
                       , ntohs(SVR_PORT(rs))
                       , inet_ntoa2(SVR_IP(vs), vsip)
                       , ntohs(SVR_PORT(vs)));
@@ -154,8 +155,9 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
        } else {
 
                rs->alive = alive;
-               syslog(LOG_INFO, "Removing service [%s:%d] from VS [%s:%d]",
-                      inet_ntoa2(SVR_IP(rs), rsip)
+               syslog(LOG_INFO, "%s service [%s:%d] from VS [%s:%d]",
+                      (rs->inhibit) ? "Disabling" : "Removing"
+                      , inet_ntoa2(SVR_IP(rs), rsip)
                       , ntohs(SVR_PORT(rs))
                       , inet_ntoa2(SVR_IP(vs), vsip)
                       , ntohs(SVR_PORT(vs)));
@@ -193,16 +195,20 @@ static int
 init_service_rs(virtual_server * vs, list l)
 {
        element e;
+       real_server *rs;
 
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
-               if (!ipvs_cmd(LVS_CMD_ADD_DEST, vs, ELEMENT_DATA(e)))
+               rs = ELEMENT_DATA(e);
+               if (!ipvs_cmd(LVS_CMD_ADD_DEST, vs, rs))
                        return 0;
+               else
+                       rs->alive = 1;
 #ifdef _KRNL_2_2_
                /* if we have a /32 mask, we create one nat rules per
                 * realserver.
                 */
                if (vs->nat_mask == HOST_NETMASK)
-                       if (!ipfw_cmd(IP_FW_CMD_ADD, vs, ELEMENT_DATA(e)))
+                       if (!ipfw_cmd(IP_FW_CMD_ADD, vs, rs))
                                return 0;
 #endif
        }
index 438c5ee..801cd95 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_api.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 29cae54..b09ab4e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_ci.c include file.
  *
- * Version:     $Id: check_ci.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_ci.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Aneesh Kumar K.V, <aneesh.kumar@digital.com>
index 05a41e5..7cc474f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_http.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index f8ad2ef..4a910e2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_misc.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
index f27382e..c884925 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_http.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 7100f0c..0d7f939 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index cfa61cf..e4d842a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: daemon.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 0951df2..474d1bc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: data.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: data.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -70,6 +70,9 @@ typedef struct _real_server {
        uint32_t addr_ip;
        uint16_t addr_port;
        int weight;
+       int inhibit;            /* Set weight to 0 instead of removing
+                                * the service from IPVS topology.
+                                */
        int alive;
 } real_server;
 
index 36ee116..beb5901 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ad99452..aed62ef 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include <net/ip_vs.h>
 #endif
 
+#ifndef IP_VS_TEMPLATE_TIMEOUT
+#define IP_VS_TEMPLATE_TIMEOUT IPVS_SVC_PERSISTENT_TIMEOUT
+#endif
+
 /* locale includes */
 #include "scheduler.h"
 #include "data.h"
@@ -57,7 +61,7 @@
 
 #ifdef _HAVE_IPVS_SYNCD_
 #define IPVS_STARTDAEMON       IP_VS_SO_SET_STARTDAEMON
-#define IPVS_STOPDAEMON        IP_VS_SO_SET_STOPDAEMON
+#define IPVS_STOPDAEMON                IP_VS_SO_SET_STOPDAEMON
 #define IPVS_MASTER            IP_VS_STATE_MASTER
 #define IPVS_BACKUP            IP_VS_STATE_BACKUP
 #else
@@ -70,8 +74,6 @@
 extern thread_master *master;
 
 /* prototypes */
-extern int parse_timeout(char *buf, unsigned *timeout);
-extern int string_to_number(const char *s, int min, int max);
 extern int ipvs_cmd(int cmd, virtual_server * vserver, real_server * rserver);
 extern int ipvs_syncd_cmd(int cmd, char *ifname, int state);
 extern void ipvs_syncd_master(char *ifname);
index 6155536..a2b4936 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 
 /* LVS command set by kernel */
 #ifdef _KRNL_2_2_
-#define LVS_CMD_ADD      IP_MASQ_CMD_ADD
-#define LVS_CMD_DEL      IP_MASQ_CMD_DEL
-#define LVS_CMD_ADD_DEST IP_MASQ_CMD_ADD_DEST
-#define LVS_CMD_DEL_DEST IP_MASQ_CMD_DEL_DEST
+#define LVS_CMD_ADD            IP_MASQ_CMD_ADD
+#define LVS_CMD_DEL            IP_MASQ_CMD_DEL
+#define LVS_CMD_ADD_DEST       IP_MASQ_CMD_ADD_DEST
+#define LVS_CMD_DEL_DEST       IP_MASQ_CMD_DEL_DEST
+#define LVS_CMD_EDIT_DEST      IP_MASQ_CMD_SET_DEST
 #else
-#define LVS_CMD_ADD      IP_VS_SO_SET_ADD
-#define LVS_CMD_DEL      IP_VS_SO_SET_DEL
-#define LVS_CMD_ADD_DEST IP_VS_SO_SET_ADDDEST
-#define LVS_CMD_DEL_DEST IP_VS_SO_SET_DELDEST
+#define LVS_CMD_ADD            IP_VS_SO_SET_ADD
+#define LVS_CMD_DEL            IP_VS_SO_SET_DEL
+#define LVS_CMD_ADD_DEST       IP_VS_SO_SET_ADDDEST
+#define LVS_CMD_DEL_DEST       IP_VS_SO_SET_DELDEST
+#define LVS_CMD_EDIT_DEST      IP_VS_SO_SET_EDITDEST
 #endif
 
 /* prototypes */
index e480961..cf303d0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: layer4.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -37,9 +37,9 @@
 
 enum connect_result {
        connect_error,
-       connect_success,
        connect_in_progress,
-       connect_timeout
+       connect_timeout,
+       connect_success
 };
 
 /* Prototypes defs */
index 3d826cf..d836fab 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: list.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 797586b..b12ef26 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: main.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -58,8 +58,8 @@ extern void register_vrrp_thread(void);
 /* Build version */
 #define PROG    "Keepalived"
 
-#define VERSION_CODE 0x000606
-#define DATE_CODE    0x030702
+#define VERSION_CODE 0x000608
+#define DATE_CODE    0x0F0702
 
 #define KEEPALIVED_VERSION(version)    \
        (version >> 16) & 0xFF,         \
index 36b1828..2bef49a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: memory.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index e8771c2..8364813 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: parser.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index d4dc200..14300ec 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: pidfile.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a653173..0dcc927 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: scheduler.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index e156214..6501459 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: smtp.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -25,8 +25,6 @@
 
 /* globales includes */
 #include <netdb.h>
-#include <sys/param.h>
-#include <sys/utsname.h>
 
 /* local includes */
 #include "data.h"
 #include "vrrp.h"
 
 /* global defs */
-#define SMTP_PORT          25
-#define SMTP_BUFFER_LENGTH 128
-#define SMTP_BUFFER_MAX    256
+#define SMTP_PORT              25
+#define SMTP_BUFFER_LENGTH     128
+#define SMTP_BUFFER_MAX                256
+#define SMTP_MAX_FSM_STATE     10
 
-/* command stage */
-enum smtp_cmd {
-       CONNECTION,
-       HELO,
-       MAIL,
-       RCPT,
-       DATA,
-       BODY,
-       QUIT,
-       ERROR
-};
+/* SMTP command stage */
+#define HELO   4
+#define MAIL   5
+#define RCPT   6
+#define DATA   7
+#define BODY   8
+#define QUIT   9
+#define END    10
+#define ERROR  11
 
 /* SMTP thread argument structure */
 #define MAX_HEADERS_LENGTH 256
 #define MAX_BODY_LENGTH    512
 
+/* SMTP FSM Macro */
+#define SMTP_FSM_SEND(S, T)    \
+do {                           \
+  if ((*(SMTP_FSM[S].send)))   \
+    (*(SMTP_FSM[S].send)) (T); \
+} while (0)
+
+#define SMTP_FSM_READ(S, T, N)         \
+do {                                   \
+  if ((*(SMTP_FSM[S].read)))           \
+    (*(SMTP_FSM[S].read)) (T, N);      \
+} while (0)
+
+/* SMTP thread arguments */
 typedef struct _smtp_thread_arg {
-       enum smtp_cmd stage;
+       int fd;
+       int stage;
        int email_it;
        char *subject;
        char *body;
@@ -64,12 +76,13 @@ typedef struct _smtp_thread_arg {
        long buflen;
 } smtp_thread_arg;
 
-/* Smtp command string processing */
+/* SMTP command string processing */
 #define SMTP_HELO_CMD    "HELO %s\r\n"
 #define SMTP_MAIL_CMD    "MAIL FROM:<%s>\r\n"
 #define SMTP_RCPT_CMD    "RCPT TO:<%s>\r\n"
 #define SMTP_DATA_CMD    "DATA\r\n"
-#define SMTP_HEADERS_CMD "From: %s\r\nSubject: %s\r\nX-Mailer: Keepalived\r\n\r\n"
+#define SMTP_HEADERS_CMD "From: %s\r\nSubject: %s\r\n" \
+                        "X-Mailer: Keepalived\r\n\r\n"
 #define SMTP_BODY_CMD    "\r\n\r\n%s\r\n\r\n"
 #define SMTP_SEND_CMD    "\r\n.\r\n"
 #define SMTP_QUIT_CMD    "QUIT\r\n"
index 66a848e..e80c184 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: timer.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5defa89..b030ea7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: utils.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -30,6 +30,9 @@
 #include <string.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
+#include <sys/param.h>
+#include <sys/utsname.h>
+#include <netdb.h>
 
 /* Global debugging logging facilities */
 #ifdef _DEBUG_
@@ -44,5 +47,6 @@ extern char *inet_ntop2(uint32_t ip);
 extern char *inet_ntoa2(uint32_t ip, char *buf);
 extern uint8_t inet_stom(char *addr);
 extern int inet_ston(const char *addr, uint32_t * dst);
+extern char *get_local_name(void);
 
 #endif
index f9f3c4b..60ab2f1 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vector.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 47c29ea..3b82dd8 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -191,7 +191,7 @@ typedef struct _vrrp_rt {
 
 /* prototypes */
 extern int open_vrrp_socket(const int proto, const int index);
-extern void new_vrrp_socket(vrrp_rt * vrrp);
+extern int new_vrrp_socket(vrrp_rt * vrrp);
 extern void close_vrrp_socket(vrrp_rt * vrrp);
 extern void vrrp_send_gratuitous_arp(vrrp_rt * vrrp);
 extern int vrrp_send_adv(vrrp_rt * vrrp, int prio);
index 9860e9d..405d687 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c055b13..a32d0be 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 420d04a..de30dba 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index f22208a..1aa3fcc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 81248bd..d7455b7 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp_notify.c include file.
  *
- * Version:     $Id: vrrp_notify.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_notify.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index f8984d6..4691ad3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 8c5e5ff..7b2ae06 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_sync.c include file.
  * 
- * Version:     $Id: vrrp_sync.h,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_sync.h,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 7050823..2418d72 100644 (file)
@@ -1,8 +1,29 @@
+/*
+ * libipvs.h:   header file for the library ipvs
+ *
+ * Version:     $Id: libipvs.h,v 1.3 2002/07/09 14:41:19 wensong Exp $
+ *
+ * Authors:     Wensong Zhang <wensong@linuxvirtualserver.org>
+ *
+ */
+
 #ifndef _LIBIPVS_H
 #define _LIBIPVS_H
 
 #include <net/ip_vs.h>
 
+/*
+ * 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)
+
 /* ipvs info variable */
 extern struct ip_vs_getinfo ipvs_info;
 
diff --git a/keepalived/samples/keepalived.conf.inhibit b/keepalived/samples/keepalived.conf.inhibit
new file mode 100644 (file)
index 0000000..7182728
--- /dev/null
@@ -0,0 +1,34 @@
+! Configuration File for keepalived
+
+global_defs {
+   notification_email {
+     acassen
+   }
+   notification_email_from Alexandre.Cassen@firewall.loc
+   smtp_server 192.168.200.1
+   smtp_connect_timeout 30
+   lvs_id LVS_DEVEL
+}
+
+virtual_server 10.10.10.2 1358 {
+    delay_loop 6
+    lb_algo rr 
+    lb_kind NAT
+    persistence_timeout 50
+    protocol TCP
+
+
+    real_server 192.168.200.2 1358 {
+        weight 1
+        inhibit_on_failure        ! set weight to 0 instead of removing service
+        HTTP_GET {
+            url { 
+              path /testurl3/test.jsp
+              digest 640205b7b0fc66c1ea91c463fac6334d
+            }
+            connect_timeout 3
+            nb_get_retry 3
+            delay_before_retry 3
+        }
+    }
+}
index c22c8db..022cd27 100644 (file)
@@ -10,19 +10,10 @@ global_defs {
    lvs_id LVS_DEVEL
 }
 
-vrrp_sync_group G1 {
-  VI_1
-  VI_2
-}
-
 vrrp_instance VI_1 {
     interface eth0
     virtual_router_id 50
     preempt
-    authentication {
-        auth_type AH
-        auth_pass k@!v361
-    }
     priority 100
     advert_int 1
     virtual_ipaddress {
@@ -32,27 +23,10 @@ vrrp_instance VI_1 {
     }
 }
 
-vrrp_instance VI_2 {
-    interface eth1
-    virtual_router_id 51
-    authentication {
-        auth_type AH
-        auth_pass k@!v362
-    }
-    priority 100
-    advert_int 1
-    virtual_ipaddress {
-        192.168.201.11
-        192.168.201.12
-        192.168.201.13
-    }
-}
-
 virtual_server 10.10.10.2 1358 {
     delay_loop 6
     lb_algo rr 
     lb_kind NAT
-    nat_mask 255.255.255.0
     persistence_timeout 50
     protocol TCP
 
@@ -62,82 +36,6 @@ virtual_server 10.10.10.2 1358 {
         weight 1
         HTTP_GET {
             url { 
-              path /testurl/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334d
-            }
-            url { 
-              path /testurl2/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334d
-            }
-            url { 
-              path /testurl3/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334d
-            }
-            connect_timeout 3
-            nb_get_retry 3
-            delay_before_retry 3
-        }
-    }
-
-    real_server 192.168.200.3 1358 {
-        weight 1
-        HTTP_GET {
-            url { 
-              path /testurl/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334c
-            }
-            url { 
-              path /testurl2/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334c
-            }
-            connect_timeout 3
-            nb_get_retry 3
-            delay_before_retry 3
-        }
-    }
-}
-
-virtual_server 10.10.10.3 1358 {
-    delay_loop 3
-    lb_algo rr 
-    lb_kind NAT
-    nat_mask 255.255.255.0
-    persistence_timeout 50
-    protocol TCP
-
-    real_server 192.168.200.4 1358 {
-        weight 1
-        HTTP_GET {
-            url { 
-              path /testurl/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334d
-            }
-            url { 
-              path /testurl2/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334d
-            }
-            url { 
-              path /testurl3/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334d
-            }
-            connect_timeout 3
-            nb_get_retry 3
-            delay_before_retry 3
-        }
-    }
-
-    real_server 192.168.200.5 1358 {
-        weight 1
-        HTTP_GET {
-            url { 
-              path /testurl/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334d
-            }
-            url { 
-              path /testurl2/test.jsp
-              digest 640205b7b0fc66c1ea91c463fac6334d
-            }
-            url { 
               path /testurl3/test.jsp
               digest 640205b7b0fc66c1ea91c463fac6334d
             }
index d94a643..4121a32 100644 (file)
@@ -25,3 +25,23 @@ clean:
 
 distclean: clean
        rm -f Makefile
+
+vrrp.o: vrrp.c ../include/vrrp.h ../include/vrrp_scheduler.h \
+  ../include/vrrp_notify.h ../include/ipvswrapper.h ../include/memory.h \
+  ../include/list.h ../include/data.h
+vrrp_notify.o: vrrp_notify.c ../include/vrrp_notify.h ../include/memory.h
+vrrp_scheduler.o: vrrp_scheduler.c ../include/vrrp_scheduler.h \
+  ../include/vrrp_ipsecah.h ../include/vrrp_if.h ../include/vrrp.h \
+  ../include/vrrp_sync.h ../include/vrrp_notify.h ../include/ipvswrapper.h \
+  ../include/memory.h ../include/list.h ../include/data.h ../include/smtp.h
+vrrp_sync.o: vrrp_sync.c ../include/vrrp_sync.h ../include/vrrp_if.h \
+  ../include/vrrp_notify.h ../include/data.h
+vrrp_netlink.o: vrrp_netlink.c ../include/vrrp_netlink.h ../include/check_api.h \
+  ../include/vrrp_if.h ../include/memory.h ../include/scheduler.h \
+  ../include/utils.h
+vrrp_if.o: vrrp_if.c ../include/vrrp_if.h ../include/vrrp_netlink.h \
+  ../include/scheduler.h ../include/data.h ../include/memory.h \
+  ../include/utils.h
+vrrp_ipaddress.o: vrrp_ipaddress.c ../include/vrrp_ipaddress.h \
+  ../include/vrrp_netlink.h ../include/utils.h
+vrrp_ipsecah.o: vrrp_ipsecah.c ../include/vrrp_ipsecah.h
index 2fab32e..bdaa55b 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 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -570,7 +570,7 @@ vrrp_send_pkt(vrrp_rt * vrrp, char *buffer, int buflen)
 
        /* build the address */
        memset(&from, 0, sizeof (from));
-       strncpy(from.sa_data, IF_NAME(vrrp->ifp), IF_NAMESIZ);
+       strncpy(from.sa_data, IF_NAME(vrrp->ifp), sizeof(from.sa_data));
 
 //print_buffer(buflen, buffer);
 
@@ -964,7 +964,6 @@ open_vrrp_socket(const int proto, const int index)
        interface *ifp;
        int fd;
        int ret;
-       int retry_num = 0;
 
        /* Retreive interface */
        ifp = if_get_by_ifindex(index);
@@ -1017,29 +1016,14 @@ open_vrrp_socket(const int proto, const int index)
 
        /* -> Need to handle multicast convergance after takeover.
         * We retry until multicast is available on the interface.
-        * After VRRP_MCAST_RETRY we assume interface doesn't support
-        * multicast then exist with error.
-        * -> This can sound a little nasty since it degrade a little
-        * the global scheduling timers.
         */
-moretry:
        ret =
            setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &req_add,
                       sizeof (struct ip_mreqn));
        if (ret < 0) {
                syslog(LOG_INFO, "cant do IP_ADD_MEMBERSHIP errno=%s (%d)",
                       strerror(errno), errno);
-               if (errno == 19) {
-                       retry_num++;
-                       if (retry_num > VRRP_MCAST_RETRY) {
-                               syslog(LOG_INFO,
-                                      "cant do IP_ADD_MEMBERSHIP after %d retry errno=%s",
-                                      VRRP_MCAST_RETRY, strerror(errno));
-                               return -1;
-                       }
-                       sleep(1);       /* FIXME: Beurk... Very nasty... !!! */
-                       goto moretry;
-               }
+               close(fd);
                return -1;
        }
 
@@ -1052,6 +1036,10 @@ close_vrrp_socket(vrrp_rt * vrrp)
        struct ip_mreqn req_add;
        int ret = 0;
 
+       /* If fd is -1 then we add a membership trouble */
+       if (vrrp->fd < 0)
+               return;
+
        /* Leaving the VRRP multicast group */
        memset(&req_add, 0, sizeof (req_add));
        req_add.imr_multiaddr.s_addr = htonl(INADDR_VRRP_GROUP);
@@ -1071,7 +1059,7 @@ close_vrrp_socket(vrrp_rt * vrrp)
        close(vrrp->fd);
 }
 
-void
+int
 new_vrrp_socket(vrrp_rt * vrrp)
 {
        int old_fd = vrrp->fd;
@@ -1093,6 +1081,8 @@ new_vrrp_socket(vrrp_rt * vrrp)
                if (vrrp_ptr->fd == old_fd)
                        vrrp_ptr->fd = vrrp->fd;
        }
+
+       return vrrp->fd;
 }
 
 /* handle terminate state */
index ed10b3f..c583da5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ad1b9f4..7644de7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 689597e..b745679 100644 (file)
@@ -7,7 +7,7 @@
  *              authentication data encryption using HMAC MD5 according to
  *              RFCs 2085 & 2104.
  *
- * Version:     $Id: vrrp_ipsecah.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index e927a2b..b8bd0d2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index e352082..def6944 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP state transition notification scripts handling.
  *
- * Version:     $Id: vrrp_notify.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_notify.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 7f62b58..2363f1d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -51,8 +51,8 @@ struct {
        void (*read) (vrrp_rt *, char *, int);
        void (*read_to) (vrrp_rt *);
 } VRRP_FSM[VRRP_MAX_FSM_STATE + 1] = {
-/*    Stream Read Handlers      |    Stream Read_to handlers   */
-/*------------------------------+------------------------------*/
+/*    Stream Read Handlers      |    Stream Read_to handlers   *
+ *------------------------------+------------------------------*/
        {NULL,                          NULL},
        {vrrp_backup,                   vrrp_goto_master},      /*  BACKUP          */
        {vrrp_leave_master,             vrrp_master},           /*  MASTER          */
@@ -587,7 +587,8 @@ vrrp_fault(vrrp_rt * vrrp)
                return;
 
        /* refresh the multicast fd */
-       new_vrrp_socket(vrrp);
+       if (new_vrrp_socket(vrrp) < 0)
+               return;
 
        /*
         * We force the IPSEC AH seq_number sync
index e0fd743..b647049 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP synchronization framework.
  *
- * Version:     $Id: vrrp_sync.c,v 0.6.5 2002/07/01 23:41:28 acassen Exp $
+ * Version:     $Id: vrrp_sync.c,v 0.6.8 2002/07/16 02:41:25 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *