keepalived-0.4.1 v0.4.1
authorAlexandre Cassen <acassen@freebox.fr>
Thu, 13 Sep 2001 22:18:16 +0000 (00:18 +0200)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:58:53 +0000 (10:58 +0200)
* keepalived-0.4.1 released.
* Added support to LVS kernel 2.4 code
* keepalived-0.4.0 released.

36 files changed:
ChangeLog
INSTALL
Makefile
cfreader.c
cfreader.h
check.h
check_http.c
check_http.h
check_tcp.c
check_tcp.h
ipfwwrapper.c
ipfwwrapper.h
ipvswrapper.c
ipvswrapper.h
ipwrapper.c
ipwrapper.h
layer4.c
layer4.h
libnetlink/libnetlink.c
main.c
main.h
pidfile.c
pidfile.h
scheduler.c
scheduler.h
smtp.c
smtp.h
utils.c
vrrp.c
vrrp.h
vrrp_ipaddress.c
vrrp_ipaddress.h
vrrp_iproute.c
vrrp_iproute.h
vrrp_ipsecah.c
vrrp_ipsecah.h

index 90e6b06..5a1d6c3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
+2001-09-14  Alexandre Cassen  <acassen@linux-vs.org>
+
+       * keepalived-0.4.1 released.
+       * Added support to LVS kernel 2.4 code
+
+
 2001-08-23  Alexandre Cassen  <acassen@linux-vs.org>
 
-       * keepalived-0.3.6 released.
+       * keepalived-0.4.0 released.
        * Patch a race condition into the scheduler timer computation.
        * Patch a race condition into the tcp checker thread. Only
          register next timer thread if tcp connection is not in progress.
@@ -31,7 +37,6 @@
         * Added a daemonization function imported from zebra.
         * Rewrite the pidfile handling, check if daemon is running, if not
           remove eventual stalled pidfile and create new pidfile.
-
         * Added a strong scheduling framework based on an I/O multiplexer
           to handle asynchronous process. This code is imported from zebra
           and have been enhanced for keepalived purposes.
           The dynamic data structure has been rewritten to use apropriate types.
           Right now parsing framework is ready for easy new checker structures
           integration.
-
         * Rewrite the smtp connector. The implementation take advantage of the
           I/O multiplexer. All read/write operations from/to the remote smtp server
           are done asynchronously. The implementation is rfc 821 compliant (multiple
           receiver are handled by a multiple RCPT TO command as specified in rfc821.3.1).
-
         * Rewrite the IPFW & IPVS wrappers.
-
         * Added support for NAT mask on IP MASQ rules (keyword nat_mask in configuration
           file). Added support for sorry server facility, so when all the server from a 
           VS server pool are removed, a sorry server is automaticaly added to the VS pool 
           (typically this is used when you have a spare server online).
-
         * Rewrite the previous checkers. Checkers are now based on a hierarchic layer
           stack framework. The protocol implemented for the moment is TCP. All layer 5
           checkers are using layer4.c primitives with the same design :
@@ -75,7 +76,5 @@
           . a connection checker thread testing connection states (error, in_progress,
             timeout, success). When connection success upper level thread are registered
             to handle checks.
-
         * Delay loop is now checkers specifics since we can use a multithreaded framework.
-
         * Update the PDF documentation file.
diff --git a/INSTALL b/INSTALL
index 51f28a0..0e66309 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -5,9 +5,17 @@ Kernel needing
 
   IP aliasing
   Kernel/User netlink socket
+  Network firewalls
   Routing messages
   LinuxVirtualServer
 
+  If you use KERNEL 2.4 build your kernel with ipchains support :
+  => Network options
+       IP: Netfilter Configuration
+        <M> ipchains (2.2-style) support
+
+  => Patch your 2.4 kernel with the LVS code
+
 Installation
 ============
 
index 82d6f65..46282f3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,9 +4,11 @@
 EXEC= keepalived
 CC= gcc
 
+KERNEL := KERNEL_2_$(shell uname -r | cut -d'.' -f2)
+
 # To compile with debug messages uncomment the following line
-CFLAGS= -g -Wall -D DEBUG
-#CFLAGS= -g -Wall
+CFLAGS= -g -Wall -DDEBUG -D$(KERNEL)
+#CFLAGS= -g -Wall -D$(KERNEL)
 DEFS=
 
 LIB=   libipfwc/libipfwc.a \
index e774f7c..9594d7f 100644 (file)
@@ -7,12 +7,10 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: cfreader.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: cfreader.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
- * Changes:     Alexandre Cassen : 2001/06/25 : Initial release
- *              
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index e707711..7e550d7 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: cfreader.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: cfreader.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include <syslog.h>
 #include <arpa/inet.h>
 
-#include <linux/ip_masq.h>
+#ifdef KERNEL_2_2
+  #include <linux/ip_masq.h>
+#else
+  #include <net/ip_vs.h>
+#endif
 
 /* local includes */
 #include "utils.h"
 #define MAX_TIMEOUT_LENGTH 5
 #define MAX_INT_LENGTH     10
 
+#ifdef KERNEL_2_2
+  #define SCHED_MAX_LENGTH IP_MASQ_TNAME_MAX
+#else
+  #define SCHED_MAX_LENGTH IP_VS_SCHEDNAME_MAXLEN
+#endif
+
 /* Keywords definition */
 struct keyword {
   int key;
@@ -141,7 +151,7 @@ typedef struct _virtual_server {
   uint16_t addr_port;
   uint16_t service_type;
   int delay_loop;
-  char sched[IP_MASQ_TNAME_MAX];
+  char sched[SCHED_MAX_LENGTH];
   unsigned loadbalancing_kind;
   struct in_addr nat_mask;
   char timeout_persistence[MAX_TIMEOUT_LENGTH];
diff --git a/check.h b/check.h
index ce06375..1865ba6 100644 (file)
--- a/check.h
+++ b/check.h
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: check.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 2c97d2d..3350c0d 100644 (file)
@@ -7,12 +7,10 @@
  *              url, compute a MD5 over this result and match it to the
  *              expected value.
  *
- * Version:     $Id: check_http.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: check_http.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/06/25 : Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index 2a95e7f..6fd6339 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: check_http.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index aa95510..440ac17 100644 (file)
@@ -5,12 +5,10 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/06/25 : Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index f7b7997..3d8c722 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a9874c2..e1fad69 100644 (file)
@@ -7,12 +7,10 @@
  *              library to add/remove server MASQ rules to the kernel 
  *              firewall framework.
  *
- * Version:     $Id: ipfwwrapper.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/06/25 : Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index 5e94164..429b008 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index e1c85f4..ac2d069 100644 (file)
@@ -6,20 +6,10 @@
  * Part:        IPVS Kernel wrapper. Use setsockopt call to add/remove
  *              server to/from the loadbalanced server pool.
  *  
- * Version:     $Id: ipvswrapper.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
- * Changes:     
- *              Alexandre Cassen : 2001/03/27 :
- *                <+> Added setsockopt return value.
- *                <+> Added support to the IP_MASQ_CMD ruleset.
- *                    IP_MASQ_CMD_ADD : Adding a virtual service.
- *                    IP_MASQ_CMD_DEL : Deleting a virtual service.
- *                    IP_MASQ_CMD_ADD_DEST : Adding a real service.
- *                    IP_MASQ_CMD_DEL_DEST : Deleting a real service.
- *               Alexandre Cassen      :       Initial release
- *              
  *               This program is distributed in the hope that it will be useful,
  *               but WITHOUT ANY WARRANTY; without even the implied warranty of
  *               MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -33,6 +23,8 @@
 
 #include "ipvswrapper.h"
 
+#ifdef KERNEL_2_2  /* KERNEL 2.2 LVS handling */
+
 int ipvs_cmd(int cmd, virtualserver *vserver, realserver *rserver)
 {
   struct ip_masq_ctl ctl;
@@ -50,13 +42,10 @@ int ipvs_cmd(int cmd, virtualserver *vserver, realserver *rserver)
   ctl.u.vs_user.protocol = vserver->service_type;
 
   if(!parse_timeout(vserver->timeout_persistence, &ctl.u.vs_user.timeout)) {
-#ifdef DEBUG
-    syslog(LOG_DEBUG, "IPVS WRAPPER : Virtual service [%s:%d] illegal timeout.",
+    syslog(LOG_INFO, "IPVS WRAPPER : Virtual service [%s:%d] illegal timeout.",
                       inet_ntoa(vserver->addr_ip), ntohs(vserver->addr_port));
-#endif
   }
   ctl.u.vs_user.vs_flags = (ctl.u.vs_user.timeout!=0)?IP_VS_SVC_F_PERSISTENT:0;
-  ctl.u.vs_user.vfwmark  = 0;
   
   /* VS specific */
   ctl.u.vs_user.vaddr = vserver->addr_ip.s_addr;
@@ -71,41 +60,126 @@ int ipvs_cmd(int cmd, virtualserver *vserver, realserver *rserver)
 
   sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
   if (sockfd == -1) {
-#ifdef DEBUG
-    syslog(LOG_DEBUG, "IPVS WRAPPER : Can not initialize SOCK_RAW descriptor.");
-#endif
+    syslog(LOG_INFO, "IPVS WRAPPER : Can not initialize SOCK_RAW descriptor.");
     return IPVS_ERROR;
   }
 
   result = setsockopt(sockfd, IPPROTO_IP, IP_FW_MASQ_CTL, (char *)&ctl, sizeof(ctl));
 
   if (errno == ESRCH) {
-#ifdef DEBUG
-    syslog(LOG_DEBUG, "IPVS WRAPPER : Virtual service [%s:%d] not defined.",
+    syslog(LOG_INFO, "IPVS WRAPPER : Virtual service [%s:%d] not defined.",
                       inet_ntoa(vserver->addr_ip), ntohs(vserver->addr_port));
-#endif
     close(sockfd);
-    return IPVSNOTDEFINED;
+    return IPVS_ERROR;
   } else if (errno == EEXIST) {
-#ifdef DEBUG
-    syslog(LOG_DEBUG, "IPVS WRAPPER : Destination already exists [%s:%d].",
+    syslog(LOG_INFO, "IPVS WRAPPER : Destination already exists [%s:%d].",
                       inet_ntoa(rserver->addr_ip), ntohs(rserver->addr_port));
-#endif
-    close(sockfd);
-    return IPVSSVREXIST;
   } else if (errno == ENOENT) {
-#ifdef DEBUG
-    syslog(LOG_DEBUG, "IPVS WRAPPER : No such destination [%s:%d].",
+    syslog(LOG_INFO, "IPVS WRAPPER : No such destination [%s:%d].",
                       inet_ntoa(rserver->addr_ip), ntohs(rserver->addr_port));
-#endif
-    close(sockfd);
-    return IPVSNODEST;
   }
 
   close(sockfd);
   return IPVS_SUCCESS;
 }
 
+#else /* KERNEL 2.4 LVS handling */
+
+int ipvs_cmd(int cmd, virtualserver *vserver, realserver *rserver)
+{
+  struct ip_vs_rule_user urule;
+  int result=0;
+  int sockfd;
+
+  memset(&urule, 0, sizeof(struct ip_vs_rule_user));
+
+  strncpy(urule.sched_name, vserver->sched, IP_VS_SCHEDNAME_MAXLEN);
+  urule.weight = -1;
+  /*
+   *  Set MASQ as default forwarding method.
+   *  FIXME: In the current implementation we only support NAT.
+   */
+  urule.conn_flags = IP_VS_CONN_F_MASQ;
+  urule.netmask    = ((u_int32_t) 0xffffffff);
+  urule.protocol   = vserver->service_type;
+  
+  if (!parse_timeout(vserver->timeout_persistence, &urule.timeout)) {
+    syslog(LOG_INFO, "IPVS WRAPPER : Virtual service [%s:%d] illegal timeout.",
+                      inet_ntoa(vserver->addr_ip), ntohs(vserver->addr_port));
+  }
+  urule.vs_flags = (urule.timeout != 0)?IP_VS_SVC_F_PERSISTENT:0;
+
+  /* VS specific */
+  urule.vaddr = vserver->addr_ip.s_addr;
+  urule.vport = vserver->addr_port;
+
+  /* SVR specific */
+  if (cmd == IP_VS_SO_SET_ADDDEST || cmd == IP_VS_SO_SET_DELDEST) {
+    urule.weight = rserver->weight;
+    urule.daddr  = rserver->addr_ip.s_addr;
+    urule.dport  = rserver->addr_port;
+  }
+
+  sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
+  if (sockfd == -1) {
+    syslog(LOG_INFO, "IPVS WRAPPER : Can not initialize SOCK_RAW descriptor.");
+    return IPVS_ERROR;
+  } 
+  
+  result = setsockopt(sockfd, IPPROTO_IP, cmd, (char *)&urule, sizeof(urule));
+
+  /* kernel return error handling */
+
+  if (result) {
+    syslog(LOG_INFO, "IPVS WRAPPER : setsockopt failed !!!");
+
+    switch (cmd) {
+      case IP_VS_SO_SET_ADD:
+        if (errno == EEXIST)
+          syslog(LOG_INFO, "IPVS WRAPPER : Destination already exists [%s:%d].",
+                           inet_ntoa(vserver->addr_ip), ntohs(vserver->addr_port));
+        else if (errno == ENOENT) {
+          syslog(LOG_INFO, "IPVS WRAPPER : Scheduler not found: ip_vs_%s.o !!!",
+                           urule.sched_name);
+          close(sockfd);
+          return IPVS_ERROR;
+        }
+        break;
+
+      case IP_VS_SO_SET_DEL:
+        if (errno == ESRCH)
+          syslog(LOG_INFO, "IPVS WRAPPER : No such service [%s:%d].",
+                           inet_ntoa(vserver->addr_ip), ntohs(vserver->addr_port));
+        close(sockfd);
+        return IPVS_ERROR;
+        break;
+
+      case IP_VS_SO_SET_ADDDEST:
+        if (errno == ESRCH)
+          syslog(LOG_INFO, "IPVS WRAPPER : Service not defined [%s:%d].",
+                           inet_ntoa(rserver->addr_ip), ntohs(rserver->addr_port));
+        else if (errno == EEXIST)
+          syslog(LOG_INFO, "IPVS WRAPPER : Destination already exists [%s:%d].",
+                           inet_ntoa(rserver->addr_ip), ntohs(rserver->addr_port));
+        break;
+
+      case IP_VS_SO_SET_DELDEST:
+        if (errno == ESRCH)
+          syslog(LOG_INFO, "IPVS WRAPPER : Service not defined [%s:%d].",
+                           inet_ntoa(rserver->addr_ip), ntohs(rserver->addr_port));
+        else if (errno == ENOENT)
+          syslog(LOG_INFO, "IPVS WRAPPER : No such destination [%s:%d].",
+                           inet_ntoa(rserver->addr_ip), ntohs(rserver->addr_port));
+        break;
+    }
+  }
+
+  close(sockfd);
+  return IPVS_SUCCESS;
+}
+
+#endif
+
 /*
  * Source code from the ipvsadm.c Wensong code
  */
index a7bd166..2fec27b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include <netinet/ip_icmp.h>
 #include <netinet/udp.h>
 #include <netinet/tcp.h>
-#include <linux/ip_fw.h>
-#include <linux/ip_masq.h>
-#include <net/ip_masq.h>
+
+#ifdef KERNEL_2_2
+  #include <linux/ip_fw.h>
+  #include <net/ip_masq.h>
+#endif
+
 #include <net/ip_vs.h>
 
 /* locale includes */
 #define IPVS_ERROR   0
 #define IPVS_SUCCESS 1
 
-/* Return codes */
-#define IPVSNOTDEFINED 0x0003
-#define IPVSSVREXIST   0x0004
-#define IPVSNODEST     0x0005
-
 /* prototypes */
 extern int parse_timeout(char *buf, unsigned *timeout);
 extern int string_to_number(const char *s, int min, int max);
index 28b406c..f9a6fb4 100644 (file)
@@ -5,12 +5,10 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $id: ipwrapper.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $id: ipwrapper.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/06/25 : Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -31,7 +29,7 @@ int clear_service_vs(virtualserver *vserver)
   pointersvr = vserver->svr;
   while (vserver->svr) {
     /* IPVS cleaning server entry */
-    if (!ipvs_cmd(IP_MASQ_CMD_DEL_DEST, vserver, vserver->svr)) {
+    if (!ipvs_cmd(LVS_CMD_DEL_DEST, vserver, vserver->svr)) {
       vserver->svr = pointersvr;
       return 0;
     }
@@ -45,7 +43,7 @@ int clear_service_vs(virtualserver *vserver)
   }
   vserver->svr = pointersvr;
 
-  if (!ipvs_cmd(IP_MASQ_CMD_DEL, vserver, vserver->svr))
+  if (!ipvs_cmd(LVS_CMD_DEL, vserver, vserver->svr))
     return 0;
 
   return 1;
@@ -97,7 +95,7 @@ void perform_svr_state(int alive, virtualserver *vserver, realserver *rserver)
                inet_ntoa(vserver->addr_ip), ntohs(vserver->addr_port));
 
         vserver->s_svr->alive = 0;
-        ipvs_cmd(IP_MASQ_CMD_DEL_DEST, vserver, vserver->s_svr);
+        ipvs_cmd(LVS_CMD_DEL_DEST, vserver, vserver->s_svr);
         ipfw_cmd(IP_FW_CMD_DEL, vserver, vserver->s_svr);
       }
     }
@@ -106,7 +104,7 @@ void perform_svr_state(int alive, virtualserver *vserver, realserver *rserver)
     syslog(LOG_INFO, "Adding service [%s:%d] to VS [%s:%d]",
            inet_ntoa(rserver->addr_ip), ntohs(rserver->addr_port),
            inet_ntoa(vserver->addr_ip), ntohs(vserver->addr_port));
-    ipvs_cmd(IP_MASQ_CMD_ADD_DEST, vserver, rserver);
+    ipvs_cmd(LVS_CMD_ADD_DEST, vserver, rserver);
     if (vserver->nat_mask.s_addr == HOST_NETMASK)
       ipfw_cmd(IP_FW_CMD_ADD, vserver, rserver);
 
@@ -118,7 +116,7 @@ void perform_svr_state(int alive, virtualserver *vserver, realserver *rserver)
            inet_ntoa(vserver->addr_ip), ntohs(vserver->addr_port));
 
     /* server is down, it is removed from the LVS realserver pool */
-    ipvs_cmd(IP_MASQ_CMD_DEL_DEST, vserver, rserver);
+    ipvs_cmd(LVS_CMD_DEL_DEST, vserver, rserver);
     if (vserver->nat_mask.s_addr == HOST_NETMASK)
       ipfw_cmd(IP_FW_CMD_DEL, vserver, rserver);
 
@@ -130,7 +128,7 @@ void perform_svr_state(int alive, virtualserver *vserver, realserver *rserver)
 
       /* the sorry server is now up in the pool, we flag it alive */
       vserver->s_svr->alive = 1;
-      ipvs_cmd(IP_MASQ_CMD_ADD_DEST, vserver, vserver->s_svr);
+      ipvs_cmd(LVS_CMD_ADD_DEST, vserver, vserver->s_svr);
       ipfw_cmd(IP_FW_CMD_ADD, vserver, vserver->s_svr);
     }
 
@@ -143,7 +141,7 @@ int init_service_vs(virtualserver *vserver)
 
   pointersvr = vserver->svr;
   while (vserver->svr) {
-    if (!ipvs_cmd(IP_MASQ_CMD_ADD_DEST, vserver, vserver->svr)) {
+    if (!ipvs_cmd(LVS_CMD_ADD_DEST, vserver, vserver->svr)) {
       vserver->svr = pointersvr;
       return 0;
     }
@@ -169,7 +167,7 @@ int init_services(virtualserver *vserver)
 
   pointervs = vserver;
   while (vserver) {
-    if (!ipvs_cmd(IP_MASQ_CMD_ADD, vserver, vserver->svr))
+    if (!ipvs_cmd(LVS_CMD_ADD, vserver, vserver->svr))
       return 0;
 
     /* work if all realserver ip address are in the
index a4e069f..f3f1add 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #define UP   1
 #define DOWN 0
 
+/* LVS command set by kernel */
+#ifdef KERNEL_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
+#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
+#endif
+
 /* prototypes */
 extern void perform_svr_state(int alive, virtualserver *vserver, realserver *rserver);
 extern int init_services(virtualserver *vserver);
index babfe1d..2b24e4d 100644 (file)
--- a/layer4.c
+++ b/layer4.c
@@ -6,12 +6,10 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: layer4.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/06/25 : Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index d63cc42..a59d7cf 100644 (file)
--- a/layer4.h
+++ b/layer4.h
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: layer4.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 30fb520..ce6a0b6 100644 (file)
@@ -27,7 +27,7 @@
 
 #ifndef MSG_TRUNC
 #      define MSG_TRUNC 0x20
-#endif MSG_TRUNC
+#endif
 
 #if 1
 #      define nl_perror(str)   perror(str)
diff --git a/main.c b/main.c
index 0017c98..1b68f9a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -5,17 +5,10 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: main.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:
- *              Alexandre Cassen : 2001/06/25 : Rewritte the whole framework
- *                <+> Added scheduling framework using I/O multiplexer thread
- *                <+> Added syslog support
- *                <+> Change the signal handling
- *              Alexandre Cassen : 2000/12/09 : Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/main.h b/main.h
index 52d04d8..55d0bd3 100644 (file)
--- a/main.h
+++ b/main.h
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: main.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -39,6 +39,6 @@ struct thread_master *master;
 
 /* Build version */
 #define PROG    "keepalived"
-#define VERSION "0.3.6 (10/08, 2001)"
+#define VERSION "0.4.1 (14/09, 2001)"
 
 #endif
index 9fb55e2..146fa76 100644 (file)
--- a/pidfile.c
+++ b/pidfile.c
@@ -5,12 +5,10 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: pidfile.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/06/25 : Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index bb5a0ba..15cb41b 100644 (file)
--- a/pidfile.h
+++ b/pidfile.h
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: pidfile.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index d6e15d9..d3acacf 100644 (file)
@@ -7,12 +7,10 @@
  *              the thread management routine (thread.c) present in the 
  *              very nice zebra project (http://www.zebra.org).
  *
- * Version:     $Id: scheduler.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: scheduler.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/06/08 : Initial release
- *
  *              This program is distributed in the hope that it will be useful, 
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of 
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
index 3df309e..1b22995 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: scheduler.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/smtp.c b/smtp.c
index a59942f..381aeba 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -7,12 +7,10 @@
  *              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.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: smtp.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/07/15 : Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/smtp.h b/smtp.h
index 27bfb60..df8e212 100644 (file)
--- a/smtp.h
+++ b/smtp.h
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: smtp.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/utils.c b/utils.c
index 129a2af..26f04bd 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: utils.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/vrrp.c b/vrrp.c
index c66aaab..9f9273c 100644 (file)
--- a/vrrp.c
+++ b/vrrp.c
@@ -4,7 +4,7 @@
  *              master fails, a backup server takes over.
  *              The original implementation has been made by jerome etienne.
  *
- * Version:     $Id: vrrp.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: vrrp.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Based on the Jerome Etienne, <jetienne@arobas.net> code.
diff --git a/vrrp.h b/vrrp.h
index 71d6e11..b8b468d 100644 (file)
--- a/vrrp.h
+++ b/vrrp.h
@@ -4,7 +4,7 @@
  *              master fails, a backup server takes over.
  *              The original implementation has been made by jerome etienne.
  *
- * Version:     $Id: vrrp.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: vrrp.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Based on the Jerome Etienne, <jetienne@arobas.net> code.
index 6617e3f..9b792cb 100644 (file)
@@ -8,12 +8,10 @@
  *              master fails, a backup server takes over.
  *              The original implementation has been made by jerome etienne.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/08/20      Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index e84017e..e84c713 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -25,7 +25,9 @@
 
 /* global includes */
 #include <stdio.h>
+#include <stdlib.h>
 #include <arpa/inet.h>
+#include <string.h>
 #include <syslog.h>
 
 /* types definitions */
index b4a74dc..9c9f23e 100644 (file)
@@ -5,12 +5,10 @@
  *
  * Part:        Routing utilities using the NETLINK kernel interface.
  *
- * Version:     $Id: vrrp_iproute.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: vrrp_iproute.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/08/20      Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index a07d8ce..1ae9e7c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_iproute.c include file.
  *
- * Version:     $Id: vrrp_iproute.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: vrrp_iproute.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index be57c70..d1efd1e 100644 (file)
@@ -7,12 +7,10 @@
  *              authentication data encryption using HMAC MD5 according to
  *              RFCs 2085 & 2104.
  *
- * Version:     $Id: vrrp_ipsecah.c,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
- * Changes:     Alexandre Cassen : 2001/08/20      Initial release
- *
  *              This program is distributed in the hope that it will be useful,
  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index d0876f3..6c95571 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 0.4.0 2001/08/24 00:35:19 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 0.4.1 2001/09/14 00:37:56 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *