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

30 files changed:
ChangeLog
INSTALL
Makefile
cfreader.c
cfreader.h
check.h
check_http.c
check_http.h
check_misc.c
check_misc.h
check_tcp.c
check_tcp.h
ipfwwrapper.c
ipfwwrapper.h
ipvswrapper.c
ipvswrapper.h
ipwrapper.c
ipwrapper.h
layer4.c
layer4.h
main.c
main.h
pidfile.c
pidfile.h
scheduler.c
scheduler.h
smtp.c
smtp.h
utils.c
utils.h

index c95d7a4..19ea68f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-09-14  Alexandre Cassen  <acassen@linux-vs.org>
+
+        * keepalived-0.3.7 released.
+        * Added support to LVS kernel 2.4 code
+
+
 2001-08-23  Alexandre Cassen  <acassen@linux-vs.org>
 
        * keepalived-0.3.6 released.
@@ -13,6 +19,7 @@
          => security auditing needed for system call,
             buffer overflow over script path must be handled.
 
+
 2001-07-15  Alexandre Cassen  <acassen@linux-vs.org>
 
        * keepalived-0.3.5 released.
@@ -22,7 +29,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.
 
           => With this framework keepalived use a Boss/Worker thread model design,
              fetching ready thread from a master threading queues.
-
         * Rewrite the configuration file reader to add flexibility on extending.
           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 :
@@ -66,7 +67,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 d43fee1..0e66309 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,3 +1,21 @@
+Kernel needing
+==============
+
+  Compile a kernel with the following options :
+
+  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 9da68d0..a88a5ae 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= main.h \
        scheduler.h \
index c7e9c46..0b35e29 100644 (file)
@@ -7,12 +7,10 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: cfreader.c,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: cfreader.c,v 0.3.7 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 e0bf98b..f6f2eec 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: cfreader.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: cfreader.h,v 0.3.7 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 CONFFILE "/etc/keepalived/keepalived.conf"
 
+/* locals defines */
 #define TEMP_BUFFER_LENGTH 100
 #define MAX_EMAIL_LENGTH   45
 #define MAX_LVSID_LENGTH   20
 #define DIGEST_LENGTH      32+1
 #define MAX_TIMEOUT_LENGTH 5
 
+#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;
@@ -129,7 +140,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 ced631e..1fdcef7 100644 (file)
--- a/check.h
+++ b/check.h
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: check.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 9ba4443..8b23a18 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.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: check_http.c,v 0.3.7 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 e6a2fd4..dcaefae 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: check_http.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 3f4661e..b90595c 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.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: check_misc.c,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
  *
index 9380f39..2e13497 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: check_misc.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
  *
index c4fbeaf..ee6f94c 100644 (file)
@@ -5,12 +5,10 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 0.3.7 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 09391b5..875605c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 705938b..e9ab2eb 100644 (file)
@@ -7,12 +7,10 @@
  *              library to add/remove server MASQ rules to the kernel 
  *              firewall framework.
  *
- * Version:     $Id: ipfwwrapper.c,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 0.3.7 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 8755f42..bf06251 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 364553f..835a16e 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.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 0.3.7 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 668dd8b..3eea932 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 0.3.7 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 a19a917..98c2dfa 100644 (file)
@@ -5,12 +5,10 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $Id: ipwrapper.c,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: ipwrapper.c,v 0.3.7 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 d9abdd9..32091d4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 0.3.7 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 b947d0c..a849499 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.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: layer4.c,v 0.3.7 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 bdae061..94244f6 100644 (file)
--- a/layer4.h
+++ b/layer4.h
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: layer4.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -28,6 +28,8 @@
 #include <stdint.h>
 #include <netdb.h>
 #include <arpa/inet.h>
+#include <sys/socket.h>
+#include <sys/types.h>
 
 /* local includes */
 #include "cfreader.h"
diff --git a/main.c b/main.c
index 8a3adf3..0fdefeb 100644 (file)
--- a/main.c
+++ b/main.c
@@ -5,16 +5,10 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: main.c,v 0.3.7 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 f9eb7b8..f8f1a39 100644 (file)
--- a/main.h
+++ b/main.h
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: main.h,v 0.3.7 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 (23/08, 2001)"
+#define VERSION "0.3.7 (14/09, 2001)"
 
 #endif
index 644fb70..ac17802 100644 (file)
--- a/pidfile.c
+++ b/pidfile.c
@@ -5,12 +5,10 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: pidfile.c,v 0.3.7 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 52fb3b0..b46393b 100644 (file)
--- a/pidfile.h
+++ b/pidfile.h
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: pidfile.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 00ac1b0..f027cb2 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.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: scheduler.c,v 0.3.7 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 35ab41d..2bea633 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: scheduler.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/smtp.c b/smtp.c
index c16cdd2..889d487 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.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: smtp.c,v 0.3.7 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 534682f..e5deace 100644 (file)
--- a/smtp.h
+++ b/smtp.h
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: smtp.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/utils.c b/utils.c
index 1a17ee5..b7f1dbc 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 0.3.6 2001/08/10 15:33:51 acassen Exp $
+ * Version:     $Id: utils.c,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/utils.h b/utils.h
index 1c7b3a2..20f3a37 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -5,7 +5,7 @@
  *
  * Part:        utils.c include file.
  *
- * Version:     $Id: utils.h,v 0.3.6 2001/08/23 23:02:51 acassen Exp $
+ * Version:     $Id: utils.h,v 0.3.7 2001/09/14 00:37:56 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *