keepalived-0.5.8 v0.5.8
authorAlexandre Cassen <acassen@freebox.fr>
Tue, 21 May 2002 20:30:46 +0000 (22:30 +0200)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:58:55 +0000 (10:58 +0200)
* keepalived-0.5.8 released.
* Added an OpenSSL Licence exception to grant Keepalived compilation
  with OpenSSL Toolkit.
  Thanks to Andres Salomon, <dilinger@voxel.net> for suggesting.
* Added connection port selection for Healthcheckers (TCP_CHECK,
  HTTP|SSL_GET). Can be usefull for Healthcheck in fwmark LVS topology
  for grouping service.
  Thanks to Richard  L. Allbery, <rla@prideindustries.com> for suggesting.
  See samples directory for examples.
* Fixed some IPVS exclusion code when running --disable-lvs.
* Added support to VirtualHost selection when using HTTP|SSL_GET.
  See samples directory for examples.
* Added VirtualHost selection into the genhash utility.
* Fixed some IPVS sync daemon initializations issues.
* Cometics patches in IPVS wrapper framework.
* Added support to quoted string. This can be usefull if you are using
  MISC_CHECK and you want to pass arguments to called script. See samples.
  Thanks to Benoit Gaussen, <ben@trez42.net> for suggesting.
* Prepare work on real_server_group in order to group some realserver
  declaration.
* VRRP : Fixed a password length exception causing an unwanted dropping
  issue.
* VRRP : Enhanced the MASTER state to send gratuitous arp if receiving
  a remote lower prio advert => This fix a remote stalled ARP cache.
  Thanks to Simon Kirby, <sim@netnation.com> for discussing this case.

69 files changed:
: [new file with mode: 0644]
AUTHOR [moved from AUTHORS with 100% similarity]
ChangeLog
README
VERSION
check_api.c
check_api.h
check_http.c
check_http.h
check_misc.c
check_misc.h
check_ssl.c
check_ssl.h
check_tcp.c
check_tcp.h
configure
configure.in
daemon.c
daemon.h
data.c
data.h
genhash/main.c
genhash/main.h
ipfwwrapper.c
ipfwwrapper.h
ipvswrapper.c
ipvswrapper.h
ipwrapper.c
ipwrapper.h
layer4.c
layer4.h
list.c
list.h
main.c
main.h
memory.c
memory.h
parser.c
parser.h
pidfile.c
pidfile.h
samples/keepalived.conf.HTTP_GET.port [moved from samples/keepalived.conf.ssl with 77% similarity]
samples/keepalived.conf.fwmark [new file with mode: 0644]
samples/keepalived.conf.misc_check
samples/keepalived.conf.misc_check_arg [new file with mode: 0644]
samples/keepalived.conf.real_server_group [new file with mode: 0644]
samples/keepalived.conf.virtualhost [new file with mode: 0644]
scheduler.c
scheduler.h
smtp.c
smtp.h
timer.c
timer.h
utils.c
utils.h
vector.c
vector.h
vrrp.c
vrrp.h
vrrp_if.c
vrrp_if.h
vrrp_ipaddress.c
vrrp_ipaddress.h
vrrp_ipsecah.c
vrrp_ipsecah.h
vrrp_netlink.c
vrrp_netlink.h
vrrp_scheduler.c
vrrp_scheduler.h

diff --git a/: b/:
new file mode 100644 (file)
index 0000000..f4132e9
--- /dev/null
+++ b/:
@@ -0,0 +1,358 @@
+/*
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ *
+ * Part:        Dynamic data structure definition.
+ *
+ * Version:     $Id: data.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *
+ *              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.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ */
+
+#include "data.h"
+#include "memory.h"
+#include "utils.h"
+#include "check_api.h"
+#include "vrrp.h"
+
+extern data *conf_data;
+
+/* email facility functions */
+static void free_email(void *data)
+{
+  FREE(data);
+}
+static void dump_email(void *data)
+{
+  char *addr = data;
+  syslog(LOG_INFO, " Email notification = %s", addr);
+}
+void alloc_email(char *addr)
+{
+  int size = strlen(addr);
+  char *new;
+
+  new = (char *)MALLOC(size+1);
+  memcpy(new, addr, size);
+
+  list_add(conf_data->email, new);
+}
+
+/* SSL facility functions */
+SSL_DATA *alloc_ssl(void)
+{
+  SSL_DATA *ssl = (SSL_DATA *)MALLOC(sizeof(SSL_DATA));
+  return ssl;
+}
+static void free_ssl(void)
+{
+  SSL_DATA *ssl = conf_data->ssl;
+
+  if (!ssl) return;
+  FREE_PTR(ssl->password);
+  FREE_PTR(ssl->cafile);
+  FREE_PTR(ssl->certfile);
+  FREE_PTR(ssl->keyfile);
+  FREE(ssl);
+}
+static void dump_ssl(void)
+{
+  SSL_DATA *ssl = conf_data->ssl;
+  
+  if (ssl->password)
+    syslog(LOG_INFO, " Password : %s", ssl->password);
+  if (ssl->cafile)
+    syslog(LOG_INFO, " CA-file : %s", ssl->cafile);
+  if (ssl->certfile)
+    syslog(LOG_INFO, " Certificate file : %s", ssl->certfile);
+  if (ssl->keyfile)
+    syslog(LOG_INFO, " Key file : %s", ssl->keyfile);
+  if (!ssl->password && !ssl->cafile && !ssl->certfile && !ssl->keyfile)
+    syslog(LOG_INFO, " Using autogen SSL context");
+}
+
+/* VRRP facility functions */
+static void free_vrrp(void *data)
+{
+  vrrp_rt *vrrp = data;
+
+  FREE(vrrp->iname);
+  FREE_PTR(vrrp->isync);
+  FREE_PTR(vrrp->lvs_syncd_if);
+  FREE_PTR(vrrp->vaddr);
+  FREE(vrrp->ipsecah_counter);
+  FREE(vrrp);
+}
+static void dump_vrrp(void *data)
+{
+  vrrp_rt *vrrp = data;
+  int i;
+
+  syslog(LOG_INFO, " VRRP Instance = %s", vrrp->iname);
+  if (vrrp->isync)
+    syslog(LOG_INFO, "   Sync with instance = %s", vrrp->isync);
+  if (vrrp->init_state == VRRP_STATE_BACK)
+    syslog(LOG_INFO, "   Want State = BACKUP");
+  else
+    syslog(LOG_INFO, "   Want State = MASTER");
+  syslog(LOG_INFO, "   Runing on device = %s", IF_NAME(vrrp->ifp));
+  if (vrrp->lvs_syncd_if)
+    syslog(LOG_INFO, "   Runing LVS sync daemon on interface = %s"
+                   , vrrp->lvs_syncd_if);
+  syslog(LOG_INFO, "   Virtual Router ID = %d", vrrp->vrid);
+  syslog(LOG_INFO, "   Priority = %d", vrrp->priority);
+  syslog(LOG_INFO, "   Advert interval = %dsec", vrrp->adver_int/TIMER_HZ);
+  if (vrrp->preempt)
+    syslog(LOG_INFO, "   Preempt Active");
+  if (vrrp->auth_type) {
+    syslog(LOG_INFO, "   Authentication type = %s",
+               (vrrp->auth_type == VRRP_AUTH_AH)?"IPSEC_AH":"SIMPLE_PASSWORD" );
+    syslog(LOG_INFO, "   Password = %s", vrrp->auth_data);
+  }
+  syslog(LOG_INFO, "   VIP count = %d", vrrp->naddr);
+  for (i = 0; i < vrrp->naddr; i++)
+    syslog(LOG_INFO, "     VIP%d = %s", i+1, ip_ntoa(vrrp->vaddr[i].addr));
+  if (vrrp->notify_exec)
+    syslog(LOG_INFO, "   Using notification script = %s"
+                   , vrrp->notify_file);
+  if (vrrp->smtp_alert)
+    syslog(LOG_INFO, "   Using smtp notification");
+}
+void alloc_vrrp(char *iname)
+{
+  int size = strlen(iname);
+  seq_counter *counter;
+  vrrp_rt *new;
+
+  /* Allocate new VRRP structure */
+  new     = (vrrp_rt *)      MALLOC(sizeof(vrrp_rt));
+  counter = (seq_counter *)  MALLOC(sizeof(seq_counter));
+
+  /* Build the structure */
+  new->ipsecah_counter = counter;
+
+  /* Set default values */
+  new->wantstate  = VRRP_STATE_BACK;
+  new->init_state = VRRP_STATE_BACK;
+  new->adver_int  = TIMER_HZ;
+  new->iname      = (char *)MALLOC(size+1);
+  memcpy(new->iname, iname, size);
+
+  list_add(conf_data->vrrp, new);
+}
+void alloc_vrrp_vip(char *vip)
+{
+  vrrp_rt *vrrp = LIST_TAIL_DATA(conf_data->vrrp);
+  uint32_t ipaddr = inet_addr(vip);
+
+  vrrp->naddr++;
+  if (vrrp->vaddr)
+    vrrp->vaddr = REALLOC(vrrp->vaddr, vrrp->naddr*sizeof(*vrrp->vaddr));
+  else
+    vrrp->vaddr = (vip_addr *)MALLOC(sizeof(*vrrp->vaddr));
+  vrrp->vaddr[vrrp->naddr-1].addr = ipaddr;
+  vrrp->vaddr[vrrp->naddr-1].set  = 0;
+}
+
+/* Virtual server facility functions */
+static void free_vs(void *data)
+{
+  virtual_server *vs = data;
+  FREE_PTR(vs->virtualhost);
+  FREE_PTR(vs->s_svr);
+  if (!LIST_ISEMPTY(vs->rs))
+    free_list(vs->rs);
+  FREE(vs);
+}
+static void dump_vs(void *data)
+{
+  virtual_server *vs = data;
+
+  if (vs->vfwmark)
+    syslog(LOG_INFO, " VS FWMARK = %d", vs->vfwmark);
+  else
+    syslog(LOG_INFO, " VIP = %s, VPORT = %d"
+                   , ip_ntoa(SVR_IP(vs))
+                   , ntohs(SVR_PORT(vs)));
+  if (vs->virtualhost)
+    syslog(LOG_INFO, "   VirtualHost = %s", vs->virtualhost);
+  syslog(LOG_INFO, "   delay_loop = %d, lb_algo = %s"
+                 , vs->delay_loop
+                 , vs->sched);
+  if (atoi(vs->timeout_persistence) > 0)
+    syslog(LOG_INFO, "   persistence timeout = %s"
+                   , vs->timeout_persistence);
+  if (vs->granularity_persistence)
+    syslog(LOG_INFO, "   persistence granularity = %s"
+                   , ip_ntoa(vs->granularity_persistence));
+  syslog(LOG_INFO, "   protocol = %s"
+                 , (vs->service_type == IPPROTO_TCP)?"TCP":"UDP");
+
+  switch (vs->loadbalancing_kind) {
+#ifdef _WITH_LVS_
+#ifdef _KRNL_2_2_
+    case 0:
+      syslog(LOG_INFO, "   lb_kind = NAT");
+      syslog(LOG_INFO, "   nat mask = %s", ip_ntoa(vs->nat_mask));
+      break;
+    case IP_MASQ_F_VS_DROUTE:
+      syslog(LOG_INFO, "   lb_kind = DR");
+      break;
+    case IP_MASQ_F_VS_TUNNEL:
+      syslog(LOG_INFO, "   lb_kind = TUN");
+      break;
+#else
+    case IP_VS_CONN_F_MASQ:
+      syslog(LOG_INFO, "   lb_kind = NAT");
+      break;
+    case IP_VS_CONN_F_DROUTE:
+      syslog(LOG_INFO, "   lb_kind = DR");
+      break;
+    case IP_VS_CONN_F_TUNNEL:
+      syslog(LOG_INFO, "   lb_kind = TUN");
+      break;
+#endif
+#endif
+  }
+
+  if (vs->s_svr) {
+    syslog(LOG_INFO, "   sorry server = %s:%d"
+                   , ip_ntoa(SVR_IP(vs->s_svr))
+                   , ntohs(SVR_PORT(vs->s_svr)));
+  }
+  if (!LIST_ISEMPTY(vs->rs))
+    dump_list(vs->rs);
+}
+void alloc_vs(char *ip, char *port)
+{
+  virtual_server *new;
+
+  new = (virtual_server *)MALLOC(sizeof(virtual_server));
+
+  if (!strcmp(ip, "fwmark")) {
+    new->vfwmark = atoi(port);
+  } else {
+    new->addr_ip   = inet_addr(ip);
+    new->addr_port = htons(atoi(port));
+  }
+  new->delay_loop = KEEPALIVED_DEFAULT_DELAY;
+  strncpy(new->timeout_persistence, "0", 1);
+  new->virtualhost = NULL;
+
+  list_add(conf_data->vs, new);
+}
+
+/* Sorry server facility functions */
+void alloc_ssvr(char *ip, char *port)
+{
+  virtual_server *vs = LIST_TAIL_DATA(conf_data->vs);
+
+  vs->s_svr = (real_server *)MALLOC(sizeof(real_server));
+  vs->s_svr->weight    = 1;
+  vs->s_svr->addr_ip   = inet_addr(ip);
+  vs->s_svr->addr_port = htons(atoi(port));
+}
+
+/* Real server facility functions */
+static void free_rs(void *data)
+{
+  real_server *rs = data;
+  FREE(rs);
+}
+static void dump_rs(void *data)
+{
+  real_server *rs = data;
+  syslog(LOG_INFO, "   RIP = %s, RPORT = %d, WEIGHT = %d"
+                 , ip_ntoa(SVR_IP(rs))
+                 , ntohs(SVR_PORT(rs))
+                 , rs->weight);
+}
+void alloc_rs(char *ip, char *port)
+{
+  virtual_server *vs = LIST_TAIL_DATA(conf_data->vs);
+  real_server *new;
+
+  new = (real_server *)MALLOC(sizeof(real_server));
+
+  new->addr_ip   = inet_addr(ip);
+  new->addr_port = htons(atoi(port));
+  new->alive = 1;
+
+  if (LIST_ISEMPTY(vs->rs))
+    vs->rs = alloc_list(free_rs, dump_rs);
+  list_add(vs->rs, new);
+  vs->last_rs_type = RS;
+}
+
+/* data facility functions */
+data *alloc_data(void)
+{
+  data *new;
+
+  new = (data *)MALLOC(sizeof(data));
+  new->email = alloc_list(free_email, dump_email);
+  new->vrrp  = alloc_list(free_vrrp,  dump_vrrp);
+  new->vs    = alloc_list(free_vs,    dump_vs);
+
+  return new;
+}
+void free_data(void)
+{
+  free_ssl();
+  free_list(conf_data->email);
+  free_list(conf_data->vrrp);
+  free_list(conf_data->vs);
+
+  FREE_PTR(conf_data->lvs_id);
+  FREE_PTR(conf_data->email_from);
+  FREE(conf_data);
+}
+void dump_data(void)
+{
+  if (conf_data->lvs_id             ||
+      conf_data->smtp_server        ||
+      conf_data->smtp_connection_to ||
+      conf_data->email_from) {
+    syslog(LOG_INFO, "------< Global definitions >------");
+  }
+  if (conf_data->lvs_id)
+    syslog(LOG_INFO, " LVS ID = %s", conf_data->lvs_id);
+  if (conf_data->smtp_server)
+    syslog(LOG_INFO, " Smtp server = %s", ip_ntoa(conf_data->smtp_server));
+  if (conf_data->smtp_connection_to)
+    syslog(LOG_INFO, " Smtp server connection timeout = %d"
+                   , conf_data->smtp_connection_to);
+  if (conf_data->email_from) {
+    syslog(LOG_INFO, " Email notification from = %s"
+                   , conf_data->email_from);
+    dump_list(conf_data->email);
+  }
+  if (conf_data->ssl) {
+    syslog(LOG_INFO, "------< SSL definitions >------");
+    dump_ssl();
+  }
+  if (!LIST_ISEMPTY(conf_data->vrrp)) {
+    syslog(LOG_INFO, "------< VRRP Topology >------");
+    dump_list(conf_data->vrrp);
+  }
+#ifdef _WITH_LVS_
+  if (!LIST_ISEMPTY(conf_data->vs)) {
+    syslog(LOG_INFO, "------< LVS Topology >------");
+    syslog(LOG_INFO, " System is compiled with LVS v%d.%d.%d"
+                   , NVERSION(IP_VS_VERSION_CODE));
+    dump_list(conf_data->vs);
+  }
+  dump_checkers_queue();
+#endif
+}
diff --git a/AUTHORS b/AUTHOR
similarity index 100%
rename from AUTHORS
rename to AUTHOR
index ba3e474..0386423 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2002-05-21  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-0.5.8 released.
+       * Added an OpenSSL Licence exception to grant Keepalived compilation
+         with OpenSSL Toolkit.
+         Thanks to Andres Salomon, <dilinger@voxel.net> for suggesting.
+       * Added connection port selection for Healthcheckers (TCP_CHECK,
+         HTTP|SSL_GET). Can be usefull for Healthcheck in fwmark LVS topology
+         for grouping service.
+         Thanks to Richard  L. Allbery, <rla@prideindustries.com> for suggesting.
+         See samples directory for examples.
+       * Fixed some IPVS exclusion code when running --disable-lvs.
+       * Added support to VirtualHost selection when using HTTP|SSL_GET.
+         See samples directory for examples.
+       * Added VirtualHost selection into the genhash utility.
+       * Fixed some IPVS sync daemon initializations issues.
+       * Cometics patches in IPVS wrapper framework.
+       * Added support to quoted string. This can be usefull if you are using
+         MISC_CHECK and you want to pass arguments to called script. See samples.
+         Thanks to Benoit Gaussen, <ben@trez42.net> for suggesting.
+       * Prepare work on real_server_group in order to group some realserver
+         declaration.
+       * VRRP : Fixed a password length exception causing an unwanted dropping
+         issue.
+       * VRRP : Enhanced the MASTER state to send gratuitous arp if receiving
+         a remote lower prio advert => This fix a remote stalled ARP cache.
+         Thanks to Simon Kirby, <sim@netnation.com> for discussing this case.
+
 2002-05-02  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-0.5.7 released.
        * Review autoconf/automake scripts to be more generic on system and code
diff --git a/README b/README
index 2544684..78a092b 100644 (file)
--- a/README
+++ b/README
@@ -10,3 +10,15 @@ strong multi-threading framework. All the events process use this I/O
 multiplexer.
 
 Keepalived is free software. See the file COPYING for copying conditions.
+
+
+OPENSSL TOOLKIT LICENCE EXCEPTION
+
+In addition, as the copyright holder of Keepalived,
+I, Alexandre Cassen, <acassen@linux-vs.org>,
+grant the following special exception: 
+
+        I, Alexandre Cassen, <acassen@linux-vs.org>, explicitly allow
+        the compilation and distribution of the Keepalived software with
+        the OpenSSL Toolkit.
+
diff --git a/VERSION b/VERSION
index d3532a1..659914a 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.5.7
+0.5.8
index 8018d91..ac1a452 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_api.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b1bc74f..d040c42 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_api.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -48,6 +48,7 @@ list checkers_queue;
 #define CHECKER_VALUE_STRING(X) (set_value(X))
 #define CHECKER_RIP(C)   (SVR_IP((C)->rs))
 #define CHECKER_RPORT(C) (SVR_PORT((C)->rs))
+#define CHECKER_VHOST(C) (VHOST((C)->vs))
 
 /* Prototypes definition */
 extern void init_checkers_queue(void);
index eed5221..1ff1f1c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_http.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -63,27 +63,43 @@ void dump_http_get_check(void *data)
     syslog(LOG_INFO, "   Keepalive method = HTTP_GET");
   else
     syslog(LOG_INFO, "   Keepalive method = SSL_GET");
+  if (http_get_chk->connection_port)
+    syslog(LOG_INFO, "   Connection port = %d"
+                   , ntohs(http_get_chk->connection_port));
   syslog(LOG_INFO, "   Connection timeout = %d" , http_get_chk->connection_to);
   syslog(LOG_INFO, "   Nb get retry = %d" , http_get_chk->nb_get_retry);
   syslog(LOG_INFO, "   Delay before retry = %d" 
                  , http_get_chk->delay_before_retry);
   dump_list(http_get_chk->url);
 }
-void http_get_handler(vector strvec)
+static http_get_checker *alloc_http_get(char *proto)
 {
   http_get_checker *http_get_chk;
-  char *str = VECTOR_SLOT(strvec, 0);
 
   http_get_chk        = (http_get_checker *)MALLOC(sizeof(http_get_checker));
   http_get_chk->arg   = (http_arg *)MALLOC(sizeof(http_arg));
-  http_get_chk->proto = (!strcmp(str, "HTTP_GET"))?PROTO_HTTP:PROTO_SSL;
+  http_get_chk->proto = (!strcmp(proto, "HTTP_GET"))?PROTO_HTTP:PROTO_SSL;
   http_get_chk->url   = alloc_list(free_url, dump_url);
 
+  return http_get_chk;
+}
+
+void http_get_handler(vector strvec)
+{
+  http_get_checker *http_get_chk;
+  char *str = VECTOR_SLOT(strvec, 0);
+
   /* queue new checker */
+  http_get_chk = alloc_http_get(str);
   queue_checker(free_http_get_check, dump_http_get_check
                                    , http_connect_thread
                                    , http_get_chk);
 }
+void connect_p_handler(vector strvec)
+{
+  http_get_checker *http_get_chk = CHECKER_GET();
+  http_get_chk->connection_port = htons(CHECKER_VALUE_INT(strvec));
+}
 void connect_to_handler(vector strvec)
 {
   http_get_checker *http_get_chk = CHECKER_GET();
@@ -127,6 +143,7 @@ void install_http_check_keyword(void)
 {
   install_keyword("HTTP_GET",                  &http_get_handler);
   install_sublevel();
+    install_keyword("connect_port",            &connect_p_handler);
     install_keyword("connect_timeout",         &connect_to_handler);
     install_keyword("nb_get_retry",            &nb_get_retry_handler);
     install_keyword("delay_before_retry",      &delay_before_retry_handler);
@@ -142,6 +159,7 @@ void install_ssl_check_keyword(void)
 {
   install_keyword("SSL_GET",                   &http_get_handler);
   install_sublevel();
+    install_keyword("connect_port",            &connect_p_handler);
     install_keyword("connect_timeout",         &connect_to_handler);
     install_keyword("nb_get_retry",            &nb_get_retry_handler);
     install_keyword("delay_before_retry",      &delay_before_retry_handler);
@@ -178,6 +196,26 @@ void install_ssl_check_keyword(void)
  *     http_handle_response (next checker thread registration)
  */
 
+uint16_t get_service_port(checker *checker)
+{
+  http_get_checker *http_get_check = CHECKER_ARG(checker);
+  uint16_t addr_port;
+
+  /*
+   *  Set the remote connection port.
+   *  If a specific checker port is specified, we used this.
+   *  If we are balancing all services (host rather than service),
+   *  then assume we want to use default ports for HTTP or HTTPS.
+   *  Known as 'Layer3 stickyness'.
+   */
+  addr_port = CHECKER_RPORT(checker);
+  if (!addr_port)
+    addr_port = htons((http_get_check->proto == PROTO_SSL)?443:80);
+  if (http_get_check->connection_port)
+    addr_port = http_get_check->connection_port;
+  return addr_port;
+}
+
 /*
  * Simple epilog functions. Handling event timeout.
  * Finish the checker with memory managment or url rety check.
@@ -235,6 +273,9 @@ int timeout_epilog(thread *thread, char *smtp_msg, char *debug_msg)
   checker *checker                 = THREAD_ARG(thread);
   http_get_checker *http_get_check = CHECKER_ARG(checker);
   http_arg *http_arg               = HTTP_ARG(http_get_check);
+#ifdef _DEBUG_
+  uint16_t addr_port               = get_service_port(checker);
+#endif
 
   /*
    * The get retry implementation mean that we retry performing
@@ -248,7 +289,7 @@ int timeout_epilog(thread *thread, char *smtp_msg, char *debug_msg)
     syslog(LOG_DEBUG, "Retry %s server [%s:%d] after %d retry."
                     , debug_msg
                     , ip_ntoa(CHECKER_RIP(checker))
-                    , ntohs(CHECKER_RPORT(checker))
+                    , ntohs(addr_port)
                     , http_arg->retry_it - 1);
 #endif
     return epilog(thread,2,0,1);
@@ -260,7 +301,7 @@ int timeout_epilog(thread *thread, char *smtp_msg, char *debug_msg)
       syslog(LOG_DEBUG, "Timeout %s server [%s:%d]."
                       , debug_msg
                       , ip_ntoa(CHECKER_RIP(checker))
-                      , ntohs(CHECKER_RPORT(checker)));
+                      , ntohs(addr_port));
 #endif
     /* check if server is currently alive */
     if (ISALIVE(checker->rs)) {
@@ -306,6 +347,7 @@ int http_handle_response(thread *thread, unsigned char digest[16]
   checker *checker                 = THREAD_ARG(thread);
   http_get_checker *http_get_check = CHECKER_ARG(checker);
 #ifdef _DEBUG_
+  uint16_t addr_port               = get_service_port(checker);
   http_arg *http_arg               = HTTP_ARG(http_get_check);
 #endif
   int r, di = 0;
@@ -327,7 +369,7 @@ int http_handle_response(thread *thread, unsigned char digest[16]
 #ifdef _DEBUG_
     syslog(LOG_DEBUG, "MD5SUM to [%s:%d] url(%d) = [%s]."
                     , ip_ntoa(CHECKER_RIP(checker))
-                    , ntohs(CHECKER_RPORT(checker))
+                    , ntohs(addr_port)
                     , http_arg->url_it + 1
                     , digest_tmp);
 #endif
@@ -340,7 +382,7 @@ int http_handle_response(thread *thread, unsigned char digest[16]
       syslog(LOG_DEBUG, "MD5 digest error to [%s:%d] url(%d)"
                         ", expecting MD5SUM [%s]."
                       , ip_ntoa(CHECKER_RIP(checker))
-                      , ntohs(CHECKER_RPORT(checker))
+                      , ntohs(addr_port)
                       , http_arg->url_it + 1
                       , fetched_url->digest);
 #endif
@@ -359,7 +401,7 @@ int http_handle_response(thread *thread, unsigned char digest[16]
 #ifdef _DEBUG_
       syslog(LOG_DEBUG, "MD5 digest success to [%s:%d] url(%d)."
                       , ip_ntoa(CHECKER_RIP(checker))
-                      , ntohs(CHECKER_RPORT(checker))
+                      , ntohs(addr_port)
                       , http_arg->url_it + 1);
 #endif
       return epilog(thread,1,1,0)+1;
@@ -375,6 +417,9 @@ int http_read_thread(thread *thread)
   http_get_checker *http_get_check = CHECKER_ARG(checker);
   http_arg *http_arg               = HTTP_ARG(http_get_check);
   REQ *req                         = HTTP_REQ(http_arg);
+#ifdef _DEBUG_
+  uint16_t addr_port               = get_service_port(checker);
+#endif
   unsigned char digest[16];
   int r = 0;
 
@@ -398,7 +443,7 @@ int http_read_thread(thread *thread)
 #ifdef _DEBUG_
       syslog(LOG_DEBUG, "Read error with server [%s:%d]: %s"
                       , ip_ntoa(CHECKER_RIP(checker))
-                      , ntohs(CHECKER_RPORT(checker))
+                      , ntohs(addr_port)
                       , strerror(errno));
 #endif
       if (ISALIVE(checker->rs)) {
@@ -499,6 +544,8 @@ int http_request_thread(thread *thread)
   http_get_checker *http_get_check = CHECKER_ARG(checker);
   http_arg *http_arg               = HTTP_ARG(http_get_check);
   REQ *req                         = HTTP_REQ(http_arg);
+  uint16_t addr_port               = get_service_port(checker);
+  char *vhost                      = CHECKER_VHOST(checker);
   char *str_request;
   url *fetched_url;
   int ret = 0;
@@ -513,18 +560,16 @@ int http_request_thread(thread *thread)
   str_request = (char *)MALLOC(GET_REQUEST_BUFFER_LENGTH);
 
   fetched_url = fetch_next_url(http_get_check);
-
   snprintf(str_request, GET_REQUEST_BUFFER_LENGTH
                       , REQUEST_TEMPLATE
                       , fetched_url->path
-                      , ip_ntoa(CHECKER_RIP(checker))
-                      , ntohs(CHECKER_RPORT(checker)));
-
+                      , (vhost)?vhost:ip_ntoa(CHECKER_RIP(checker))
+                      , ntohs(addr_port));
 #ifdef _DEBUG_
   syslog(LOG_DEBUG, "Processing url(%d) of [%s:%d]."
                   , http_arg->url_it + 1
                   , ip_ntoa(CHECKER_RIP(checker))
-                  , ntohs(CHECKER_RPORT(checker)));
+                  , ntohs(addr_port));
 #endif
 
   /* Send the GET request to remote Web server */
@@ -538,7 +583,7 @@ int http_request_thread(thread *thread)
   if (!ret) {
     syslog(LOG_INFO, "Cannot send get request to [%s:%d]."
                    , ip_ntoa(CHECKER_RIP(checker))
-                   , ntohs(CHECKER_RPORT(checker)));
+                   , ntohs(addr_port));
 
     /* check if server is currently alive */
     if (ISALIVE(checker->rs)) {
@@ -565,6 +610,7 @@ int http_check_thread(thread *thread)
 {
   checker *checker                 = THREAD_ARG(thread);
   http_get_checker *http_get_check = CHECKER_ARG(checker);
+  uint16_t addr_port               = get_service_port(checker);
 #ifdef _DEBUG_
   http_arg *http_arg               = HTTP_ARG(http_get_check);
   REQ *req                         = HTTP_REQ(http_arg);
@@ -574,14 +620,14 @@ int http_check_thread(thread *thread)
 
   status = tcp_socket_state(thread->u.fd, thread
                                         , CHECKER_RIP(checker)
-                                        , CHECKER_RPORT(checker)
+                                        , addr_port
                                         , http_check_thread);
   switch (status) {
     case connect_error:
 #ifdef _DEBUG_
       syslog(LOG_DEBUG, "Error connecting server [%s:%d]."
                       , ip_ntoa(CHECKER_RIP(checker))
-                      , ntohs(CHECKER_RPORT(checker)));
+                      , ntohs(addr_port));
 #endif
       /* check if server is currently alive */
       if (ISALIVE(checker->rs)) {
@@ -612,7 +658,7 @@ int http_check_thread(thread *thread)
 #ifdef _DEBUG_
         syslog(LOG_DEBUG, "Remote Web server [%s:%d] connected."
                         , ip_ntoa(CHECKER_RIP(checker))
-                        , ntohs(CHECKER_RPORT(checker)));
+                        , ntohs(addr_port));
 #endif
         thread_add_write(thread->master, http_request_thread
                                        , checker
@@ -622,7 +668,7 @@ int http_check_thread(thread *thread)
 #ifdef _DEBUG_
         syslog(LOG_DEBUG, "Connection trouble to: [%s:%d]."
                         , ip_ntoa(CHECKER_RIP(checker))
-                        , ntohs(CHECKER_RPORT(checker)));
+                        , ntohs(addr_port));
         if (http_get_check->proto == PROTO_SSL)
           ssl_printerr(SSL_get_error(req->ssl, ret));
 #endif
@@ -640,9 +686,9 @@ int http_connect_thread(thread *thread)
   checker *checker                 = THREAD_ARG(thread);
   http_get_checker *http_get_check = CHECKER_ARG(checker);
   http_arg *http_arg               = HTTP_ARG(http_get_check);
+  uint16_t addr_port               = get_service_port(checker);
   url *fetched_url;
   enum connect_result status;
-  uint16_t addr_port;
   int fd;
 
   /* Find eventual url end */
@@ -662,7 +708,7 @@ int http_connect_thread(thread *thread)
 #ifdef _DEBUG_
       syslog(LOG_DEBUG, "Remote Web server [%s:%d] succeed on service."
                       , ip_ntoa(CHECKER_RIP(checker))
-                      , ntohs(CHECKER_RPORT(checker)));
+                      , ntohs(addr_port));
 #endif
     }
     http_arg->req = NULL;
@@ -679,16 +725,6 @@ int http_connect_thread(thread *thread)
     return 0;
   }
 
-  /*
-   *  Set the remote connection port.
-   *  If we are balancing all services (host rather than service),
-   *  then assume we want to use default ports for HTTP or HTTPS.
-   *  Known as 'Layer3 stickyness'
-   */
-  addr_port = CHECKER_RPORT(checker);
-  if (!addr_port)
-    addr_port = htons((http_get_check->proto == PROTO_SSL)?443:80);
-
   status = tcp_connect(fd, CHECKER_RIP(checker), addr_port);
 
   /* handle tcp connection status & register check worker thread */
index ca00d4e..3d0d865 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_http.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -61,6 +61,7 @@ typedef struct _url {
 } url;
 typedef struct _http_get_checker {
   int      proto;
+  uint16_t connection_port;
   int      connection_to;
   int      nb_get_retry;
   int      delay_before_retry;
@@ -80,7 +81,6 @@ typedef struct _http_get_checker {
 #define REQUEST_TEMPLATE "GET %s HTTP/1.0\r\n" \
                          "User-Agent:KeepAliveClient\r\n" \
                          "Host: %s:%d\r\n\r\n"
-
 /* macro utility */
 #define HTTP_ARG(X) ((X)->arg)
 #define HTTP_REQ(X) ((X)->req)
index 7a83924..8e0c22d 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.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_misc.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
index 030247e..1bc0a1b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_misc.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
index 958169e..cc854ca 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.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 05faeca..a72a400 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_http.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 2c51d5f..9d05713 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -44,6 +44,9 @@ void dump_tcp_check(void *data)
   tcp_checker *tcp_chk = CHECKER_DATA(data);
 
   syslog(LOG_INFO, "   Keepalive method = TCP_CHECK");
+  if (tcp_chk->connection_port)
+    syslog(LOG_INFO, "   Connection port = %d"
+                   , ntohs(tcp_chk->connection_port));
   syslog(LOG_INFO, "   Connection timeout = %d"
                  , tcp_chk->connection_to);
 }
@@ -56,6 +59,11 @@ void tcp_check_handler(vector strvec)
                               , tcp_connect_thread
                               , tcp_chk);
 }
+void connect_port_handler(vector strvec)
+{
+  tcp_checker *tcp_chk = CHECKER_GET();
+  tcp_chk->connection_port = htons(CHECKER_VALUE_INT(strvec));
+}
 void connect_timeout_handler(vector strvec)
 {
   tcp_checker *tcp_chk = CHECKER_GET();
@@ -65,6 +73,7 @@ void install_tcp_check_keyword(void)
 {
   install_keyword("TCP_CHECK",         &tcp_check_handler);
   install_sublevel();
+    install_keyword("connect_port",    &connect_port_handler);
     install_keyword("connect_timeout", &connect_timeout_handler);
   install_sublevel_end();
 }
@@ -72,13 +81,19 @@ void install_tcp_check_keyword(void)
 int tcp_check_thread(thread *thread)
 {
   checker *checker;
+  tcp_checker *tcp_check;
+  uint16_t addr_port;
   int status;
 
   checker = THREAD_ARG(thread);
+  tcp_check = CHECKER_ARG(checker);
 
+  addr_port = CHECKER_RPORT(checker);
+  if (tcp_check->connection_port)
+    addr_port = tcp_check->connection_port;
   status = tcp_socket_state(thread->u.fd, thread
                                         , CHECKER_RIP(checker)
-                                        , CHECKER_RPORT(checker)
+                                        , addr_port
                                         , tcp_check_thread);
 
   /* If status = connect_success, TCP connection to remote host is established.
@@ -89,7 +104,7 @@ int tcp_check_thread(thread *thread)
 #ifdef _DEBUG_
     syslog(LOG_DEBUG, "TCP connection to [%s:%d] success."
                     ,  ip_ntoa(CHECKER_RIP(checker))
-                    ,  ntohs(CHECKER_RPORT(checker)));
+                    ,  ntohs(addr_port));
 #endif
     close(thread->u.fd);
 
@@ -105,7 +120,7 @@ int tcp_check_thread(thread *thread)
 #ifdef _DEBUG_
     syslog(LOG_DEBUG, "TCP connection to [%s:%d] failed !!!"
                     ,  ip_ntoa(CHECKER_RIP(checker))
-                    ,  ntohs(CHECKER_RPORT(checker)));
+                    ,  ntohs(addr_port));
 #endif
 
     if (ISALIVE(checker->rs)) {
@@ -131,6 +146,7 @@ int tcp_connect_thread(thread *thread)
   checker *checker;
   tcp_checker *tcp_check;
   int fd;
+  uint16_t addr_port;
   int status;
 
   checker   = THREAD_ARG(thread);
@@ -143,8 +159,10 @@ int tcp_connect_thread(thread *thread)
     return 0;
   }
 
-  status = tcp_connect(fd, CHECKER_RIP(checker)
-                         , CHECKER_RPORT(checker));
+  addr_port = CHECKER_RPORT(checker);
+  if (tcp_check->connection_port)
+    addr_port = tcp_check->connection_port;
+  status = tcp_connect(fd, CHECKER_RIP(checker), addr_port);
 
   /* handle tcp connection status & register check worker thread */
   tcp_connection_state(fd, status, thread
index 4fe43d8..533cf73 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -33,6 +33,7 @@
 
 /* Checker argument structure  */
 typedef struct _tcp_checker {
+  uint16_t connection_port;
   int connection_to;
 } tcp_checker;
 
index 9d36221..f3777df 100755 (executable)
--- a/configure
+++ b/configure
@@ -1965,7 +1965,6 @@ Keepalived configuration
 Keepalived version       : ${VERSION}
 Compiler                 : ${CC}
 Compiler flags           : ${CFLAGS}
-Compiler flags           : ${CFLAGS}
 Linux Kernel release     : ${KERNEL_VERSION}
 Startup scripts location : ${SYSTEM_SCRIPT_DIR}
 EOF
index baa59f7..cff3bef 100644 (file)
@@ -148,7 +148,6 @@ Keepalived configuration
 Keepalived version       : ${VERSION}
 Compiler                 : ${CC}
 Compiler flags           : ${CFLAGS}
-Compiler flags           : ${CFLAGS}
 Linux Kernel release     : ${KERNEL_VERSION}
 Startup scripts location : ${SYSTEM_SCRIPT_DIR}
 EOF
index 97c3888..e42926c 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: main.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a4441f7..8421243 100644 (file)
--- a/daemon.h
+++ b/daemon.h
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: daemon.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/data.c b/data.c
index 5e767c0..0a92b7b 100644 (file)
--- a/data.c
+++ b/data.c
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: data.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: data.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -169,6 +169,7 @@ void alloc_vrrp_vip(char *vip)
 static void free_vs(void *data)
 {
   virtual_server *vs = data;
+  FREE_PTR(vs->virtualhost);
   FREE_PTR(vs->s_svr);
   if (!LIST_ISEMPTY(vs->rs))
     free_list(vs->rs);
@@ -177,12 +178,15 @@ static void free_vs(void *data)
 static void dump_vs(void *data)
 {
   virtual_server *vs = data;
+
   if (vs->vfwmark)
     syslog(LOG_INFO, " VS FWMARK = %d", vs->vfwmark);
   else
     syslog(LOG_INFO, " VIP = %s, VPORT = %d"
                    , ip_ntoa(SVR_IP(vs))
                    , ntohs(SVR_PORT(vs)));
+  if (vs->virtualhost)
+    syslog(LOG_INFO, "   VirtualHost = %s", vs->virtualhost);
   syslog(LOG_INFO, "   delay_loop = %d, lb_algo = %s"
                  , vs->delay_loop
                  , vs->sched);
@@ -196,6 +200,7 @@ static void dump_vs(void *data)
                  , (vs->service_type == IPPROTO_TCP)?"TCP":"UDP");
 
   switch (vs->loadbalancing_kind) {
+#ifdef _WITH_LVS_
 #ifdef _KRNL_2_2_
     case 0:
       syslog(LOG_INFO, "   lb_kind = NAT");
@@ -218,6 +223,7 @@ static void dump_vs(void *data)
       syslog(LOG_INFO, "   lb_kind = TUN");
       break;
 #endif
+#endif
   }
 
   if (vs->s_svr) {
@@ -225,8 +231,8 @@ static void dump_vs(void *data)
                    , ip_ntoa(SVR_IP(vs->s_svr))
                    , ntohs(SVR_PORT(vs->s_svr)));
   }
-
-  dump_list(vs->rs);
+  if (!LIST_ISEMPTY(vs->rs))
+    dump_list(vs->rs);
 }
 void alloc_vs(char *ip, char *port)
 {
@@ -242,6 +248,7 @@ void alloc_vs(char *ip, char *port)
   }
   new->delay_loop = KEEPALIVED_DEFAULT_DELAY;
   strncpy(new->timeout_persistence, "0", 1);
+  new->virtualhost = NULL;
 
   list_add(conf_data->vs, new);
 }
@@ -284,7 +291,6 @@ void alloc_rs(char *ip, char *port)
 
   if (LIST_ISEMPTY(vs->rs))
     vs->rs = alloc_list(free_rs, dump_rs);
-
   list_add(vs->rs, new);
 }
 
@@ -313,20 +319,24 @@ void free_data(void)
 }
 void dump_data(void)
 {
-  if (conf_data->lvs_id             && 
-      conf_data->smtp_server        &&
-      conf_data->smtp_connection_to &&
+  if (conf_data->lvs_id             ||
+      conf_data->smtp_server        ||
+      conf_data->smtp_connection_to ||
       conf_data->email_from) {
     syslog(LOG_INFO, "------< Global definitions >------");
+  }
+  if (conf_data->lvs_id)
     syslog(LOG_INFO, " LVS ID = %s", conf_data->lvs_id);
+  if (conf_data->smtp_server)
     syslog(LOG_INFO, " Smtp server = %s", ip_ntoa(conf_data->smtp_server));
+  if (conf_data->smtp_connection_to)
     syslog(LOG_INFO, " Smtp server connection timeout = %d"
                    , conf_data->smtp_connection_to);
+  if (conf_data->email_from) {
     syslog(LOG_INFO, " Email notification from = %s"
                    , conf_data->email_from);
     dump_list(conf_data->email);
   }
-
   if (conf_data->ssl) {
     syslog(LOG_INFO, "------< SSL definitions >------");
     dump_ssl();
@@ -335,13 +345,13 @@ void dump_data(void)
     syslog(LOG_INFO, "------< VRRP Topology >------");
     dump_list(conf_data->vrrp);
   }
+#ifdef _WITH_LVS_
   if (!LIST_ISEMPTY(conf_data->vs)) {
     syslog(LOG_INFO, "------< LVS Topology >------");
     syslog(LOG_INFO, " System is compiled with LVS v%d.%d.%d"
                    , NVERSION(IP_VS_VERSION_CODE));
     dump_list(conf_data->vs);
   }
-#ifdef _WITH_LVS_
   dump_checkers_queue();
 #endif
 }
diff --git a/data.h b/data.h
index 721e08a..9de6c26 100644 (file)
--- a/data.h
+++ b/data.h
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: data.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: data.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -31,6 +31,7 @@
 #include <arpa/inet.h>
 #include <openssl/ssl.h>
 
+#ifdef _WITH_LVS_
 #ifdef _KRNL_2_2_
   #include <linux/ip_masq.h>
   #include <net/ip_masq.h>
@@ -39,6 +40,9 @@
   #define SCHED_MAX_LENGTH IP_VS_SCHEDNAME_MAXLEN
 #endif
 #include <net/ip_vs.h>
+#else
+  #define SCHED_MAX_LENGTH   1
+#endif
 
 /* local includes */
 #include "list.h"
@@ -76,10 +80,11 @@ typedef struct _virtual_server {
   uint16_t             service_type;
   int                  delay_loop;
   char                 sched[SCHED_MAX_LENGTH];
+  char                 timeout_persistence[MAX_TIMEOUT_LENGTH];
   unsigned             loadbalancing_kind;
   uint32_t             nat_mask;
-  char                 timeout_persistence[MAX_TIMEOUT_LENGTH];
   uint32_t             granularity_persistence;
+  char                 *virtualhost;
   real_server          *s_svr;
   list                 rs;
 } virtual_server;
@@ -105,6 +110,8 @@ typedef struct _data {
 #define ISALIVE(R)   ((R)->alive)
 #define SVR_IP(H)    ((H)->addr_ip)
 #define SVR_PORT(H)  ((H)->addr_port)
+#define VHOST(V)     ((V)->virtualhost)
+#define LAST_RS_TYPE(V)     ((V)->last_rs_type)
 
 /* prototypes */
 extern void alloc_email(char *addr);
index 0ec297c..350f88f 100644 (file)
@@ -93,6 +93,7 @@ static char *extract_html(char *buffer, int size_buffer)
 static char *build_request(REQ* req)
 {
   char *request;
+  char *vhost;
   int request_len = 0;
 
   request_len = strlen(REQUEST_TEMPLATE) +
@@ -102,10 +103,13 @@ static char *build_request(REQ* req)
   request = xmalloc(request_len);
   if (!request) return NULL;
 
+  vhost = req->host;
+  if (req->virtualhost)
+    vhost = req->virtualhost;
   snprintf(request, request_len
                   , REQUEST_TEMPLATE
                   , req->url
-                  , req->host
+                  , vhost
                   , req->port);
   return request;
 }
@@ -422,10 +426,11 @@ static void usage(const char *prog)
     "  %s --url             -u       Use the specified remote server url.\n"
     "  %s --use-private-key -K       Use the specified SSL private key.\n"
     "  %s --use-password    -P       Use the specified SSL private key password.\n"
+    "  %s --use-virtualhost -V       Use the specified VirtualHost GET query.\n"
     "  %s --use-certificate -C       Use the specified SSL Certificate file.\n"
     "  %s --help            -h       Display this short inlined help screen.\n"
     "  %s --version         -v       Display the version number\n",
-    prog, prog, prog, prog, prog, prog, prog, prog, prog);
+    prog, prog, prog, prog, prog, prog, prog, prog, prog, prog);
 }
 
 /* Command line parser */
@@ -443,6 +448,7 @@ static int parse_cmdline(int argc, char **argv, REQ *req)
     {"port",            'p', POPT_ARG_STRING, &optarg, 'p'},
     {"url",             'u', POPT_ARG_STRING, &optarg, 'u'},
     {"use-private-key", 'K', POPT_ARG_STRING, &optarg, 'K'},
+    {"use-virtualhost", 'V', POPT_ARG_STRING, &optarg, 'V'},
     {"use-password",    'P', POPT_ARG_STRING, &optarg, 'P'},
     {"use-certificate", 'C', POPT_ARG_STRING, &optarg, 'C'},
     {NULL, 0, 0, NULL, 0}
@@ -492,6 +498,9 @@ static int parse_cmdline(int argc, char **argv, REQ *req)
       case 'P':
         req->password = optarg;
         break;
+      case 'V':
+        req->virtualhost = optarg;
+        break;
       case 'C':
         req->cafile = optarg;
         break;
index c40d8fb..6536d6d 100644 (file)
@@ -34,7 +34,7 @@
 
 /* Build version */
 #define PROG    "genhash"
-#define VERSION "0.5.3 (03/22, 2002)"
+#define VERSION "0.5.8 (05/17, 2002)"
 
 /* HTTP/HTTPS GET command */
 #define REQUEST_TEMPLATE "GET %s HTTP/1.0\r\n" \
@@ -54,6 +54,7 @@ typedef struct {
   int ssl;
   char *keyfile;
   char *password;
+  char *virtualhost;
   char *cafile;
 } REQ;
 
index 428a403..873a616 100644 (file)
@@ -7,7 +7,7 @@
  *              library to add/remove server MASQ rules to the kernel 
  *              firewall framework.
  *
- * Version:     $Id: ipfwwrapper.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5795989..935184e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 6d969ca..eb8c040 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.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -52,7 +52,7 @@ int ipvs_cmd(int cmd, virtual_server *vs, real_server *rs)
     syslog(LOG_INFO, "IPVS WRAPPER : Virtual service [%s:%d] illegal timeout."
                    , ip_ntoa(SVR_IP(vs))
                    , ntohs(SVR_PORT(vs)));
-  if (urule.timeout != 0 || vs->granularity_persistence)
+  if (ctl.u.vs_user.timeout != 0 || vs->granularity_persistence)
     ctl.u.vs_user.vs_flags = IP_VS_SVC_F_PERSISTENT;
   
   /* VS specific */
@@ -260,38 +260,16 @@ int ipvs_cmd(int cmd, virtual_server *vs, real_server *rs)
 /*
  * IPVS synchronization daemon state transition
  */
-int ipvs_syncd_goto_master_thread(thread *thread)
-{
-  char *ifname = THREAD_ARG(thread);
-  ipvs_syncd_cmd(IPVS_STARTDAEMON, ifname, IPVS_MASTER);
-  return 0;
-}
-
-int ipvs_syncd_master_thread(thread *thread)
+void ipvs_syncd_master(char *ifname)
 {
-  char *ifname = THREAD_ARG(thread);
   ipvs_syncd_cmd(IPVS_STOPDAEMON, ifname, IPVS_BACKUP);
-  thread_add_timer(master, ipvs_syncd_goto_master_thread
-                         , ifname
-                         , IPVS_CMD_DELAY);
-  return 0;
-}
-
-int ipvs_syncd_goto_backup_thread(thread *thread)
-{
-  char *ifname = THREAD_ARG(thread);
-  ipvs_syncd_cmd(IPVS_STARTDAEMON, ifname, IPVS_BACKUP);
-  return 0;
+  ipvs_syncd_cmd(IPVS_STARTDAEMON, ifname, IPVS_MASTER);
 }
 
-int ipvs_syncd_backup_thread(thread *thread)
+void ipvs_syncd_backup(char *ifname)
 {
-  char *ifname = THREAD_ARG(thread);
   ipvs_syncd_cmd(IPVS_STOPDAEMON, ifname, IPVS_MASTER);
-  thread_add_timer(master, ipvs_syncd_goto_backup_thread
-                         , ifname
-                         , IPVS_CMD_DELAY);
-  return 0;
+  ipvs_syncd_cmd(IPVS_STARTDAEMON, ifname, IPVS_BACKUP);
 }
 
 /*
index 8c176d4..a5796ec 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include <netinet/udp.h>
 #include <netinet/tcp.h>
 
+#ifdef _WITH_LVS_
 #ifdef _KRNL_2_2_
   #include <linux/ip_fw.h>
   #include <net/ip_masq.h>
 #endif
 #include <net/ip_vs.h>
+#endif
 
 /* locale includes */
 #include "scheduler.h"
@@ -69,7 +71,7 @@ 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 int ipvs_syncd_master_thread(thread *thread);
-extern int ipvs_syncd_backup_thread(thread *thread);
+extern void ipvs_syncd_master(char *ifname);
+extern void ipvs_syncd_backup(char *ifname);
 
 #endif
index 8db83ff..55e648e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $id: ipwrapper.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $id: ipwrapper.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 
 extern data *conf_data;
 
-int clear_service_vs(virtual_server *vs)
+static int clear_service_rs(virtual_server *vs, list l)
 {
   element e;
 
-  for (e = LIST_HEAD(vs->rs); e; ELEMENT_NEXT(e)) {
-    /* IPVS cleaning server entry */
-    if (!ipvs_cmd(LVS_CMD_DEL_DEST, vs, e->data))
+  for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+    if (!ipvs_cmd(LVS_CMD_DEL_DEST, vs, ELEMENT_DATA(e)))
       return 0;
-
 #ifdef _KRNL_2_2_
-    /* IPFW cleaning server entry if granularity = /32 */
+    /* 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_DEL, vs, e->data))
+      if(!ipfw_cmd(IP_FW_CMD_DEL, vs, ELEMENT_DATA(e)))
         return 0;
 #endif
   }
+  return 1;
+}
 
+int clear_service_vs(virtual_server *vs)
+{
+  /* Processing real server queue */
+  if (!LIST_ISEMPTY(vs->rs))
+    if (!clear_service_rs(vs, vs->rs))
+      return 0;
   if (!ipvs_cmd(LVS_CMD_DEL, vs, NULL))
     return 0;
   return 1;
@@ -155,30 +163,38 @@ void perform_svr_state(int alive, virtual_server *vs, real_server *rs)
   }
 }
 
-int init_service_vs(virtual_server *vs)
+static int init_service_rs(virtual_server *vs, list l)
 {
   element e;
 
-  /* Init the IPVS root */
-  if (!ipvs_cmd(LVS_CMD_ADD, vs, NULL))
-    return 0;
-
-  for (e = LIST_HEAD(vs->rs); e; ELEMENT_NEXT(e)) {
-    if (!ipvs_cmd(LVS_CMD_ADD_DEST, vs, e->data))
+  for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+    if (!ipvs_cmd(LVS_CMD_ADD_DEST, vs, ELEMENT_DATA(e)))
       return 0;
-
 #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, e->data))
+      if(!ipfw_cmd(IP_FW_CMD_ADD, vs, ELEMENT_DATA(e)))
         return 0;
 #endif
   }
   return 1;
 }
 
+int init_service_vs(virtual_server *vs)
+{
+  /* Init the IPVS root */
+  if (!ipvs_cmd(LVS_CMD_ADD, vs, NULL))
+    return 0;
+
+  /* Processing real server queue */
+  if (!LIST_ISEMPTY(vs->rs))
+    if (!init_service_rs(vs, vs->rs))
+      return 0;
+  return 1;
+}
+
 int init_services(void)
 {
   element e;
index 1774034..785c512 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5542de2..f3cb98e 100644 (file)
--- a/layer4.c
+++ b/layer4.c
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: layer4.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index f49e26d..221d216 100644 (file)
--- a/layer4.h
+++ b/layer4.h
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: layer4.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/list.c b/list.c
index 0124e52..69ac1ba 100644 (file)
--- a/list.c
+++ b/list.c
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: list.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
diff --git a/list.h b/list.h
index c035d2c..1b5168c 100644 (file)
--- a/list.h
+++ b/list.h
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: list.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/main.c b/main.c
index 3ec75ec..6b2e0a8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: main.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/main.h b/main.h
index 4ca375a..5097fbf 100644 (file)
--- a/main.h
+++ b/main.h
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: main.h,v 0.5.8 2002/05/21 16:09:46 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 0x000507
-#define DATE_CODE    0x160402
+#define VERSION_CODE 0x000508
+#define DATE_CODE    0x150502
 
 #define KEEPALIVED_VERSION(version)    \
        (version >> 16) & 0xFF,         \
index 64148fd..74a63a7 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -6,7 +6,7 @@
  * Part:        Memory management framework. This framework is used to
  *              find any memory leak.
  *
- * Version:     $Id: memory.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: memory.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index a3abf57..810ae43 100644 (file)
--- a/memory.h
+++ b/memory.h
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: memory.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 26ac9e6..8bd6ed8 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: parser.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -172,12 +172,19 @@ static vector alloc_strvec(char *string)
 
   while (1) {
     start = cp;
-    while (!isspace((int) *cp) && *cp != '\0')
+    if (*cp == '"') {
       cp++;
-    strlen = cp - start;
-    token = MALLOC(strlen + 1);
-    memcpy(token, start, strlen);
-    *(token + strlen) = '\0';
+      token = MALLOC(2);
+      *(token)     = '"';
+      *(token + 1) = '\0';
+    } else {
+      while (!isspace((int) *cp) && *cp != '\0' && *cp != '"')
+        cp++;
+      strlen = cp - start;
+      token = MALLOC(strlen + 1);
+      memcpy(token, start, strlen);
+      *(token + strlen) = '\0';
+    }
 
     /* Alloc & set the slot */
     vector_alloc_slot(strvec);
@@ -246,10 +253,27 @@ void *set_value(vector strvec)
 {
   char *str = VECTOR_SLOT(strvec, 1);
   int size = strlen(str);
-  void *alloc;
-
-  alloc = MALLOC(size+1);
-  memcpy(alloc, str, size);
+  int i = 0;
+  int len = 0;
+  char *alloc = NULL;
+
+  if (*str == '"') {
+    for (i = 2; i < VECTOR_SIZE(strvec); i++) {
+      str = VECTOR_SLOT(strvec, i);
+      len += strlen(str);
+      if (!alloc)
+        alloc = (char *)MALLOC(sizeof(char *) * (len + 1));
+      else {
+        alloc = REALLOC(alloc, sizeof(char *) * (len + 1));
+        strncat(alloc, " ", 1);
+      }
+      if (*str != '"')
+        strncat(alloc, str, strlen(str));
+    }
+  } else {
+    alloc = MALLOC(sizeof(char *) * (size + 1));
+    memcpy(alloc, str, size);
+  }
   return alloc;
 }
 
@@ -471,6 +495,7 @@ static void lbalgo_handler(vector strvec)
 }
 static void lbkind_handler(vector strvec)
 {
+#ifdef _WITH_LVS_
   virtual_server *vs = LIST_TAIL_DATA(conf_data->vs);
   char *str = VECTOR_SLOT(strvec, 1);
 
@@ -496,6 +521,7 @@ static void lbkind_handler(vector strvec)
       else
         syslog(LOG_DEBUG, "PARSER : unknown [%s] routing method."
                         , str);
+#endif
 }
 static void natmask_handler(vector strvec)
 {
@@ -521,6 +547,11 @@ static void proto_handler(vector strvec)
   char *str = VECTOR_SLOT(strvec, 1);
   vs->service_type = (!strcmp(str, "TCP"))?IPPROTO_TCP:IPPROTO_UDP;
 }
+static void virtualhost_handler(vector strvec)
+{
+  virtual_server *vs = LIST_TAIL_DATA(conf_data->vs);
+  vs->virtualhost = set_value(strvec);
+}
 
 /* Sorry Servers handlers */
 static void ssvr_handler(vector strvec)
@@ -626,6 +657,7 @@ void init_keywords(void)
     install_keyword("auth_pass",               &vrrp_auth_pass_handler);
   install_sublevel_end();
 
+#ifdef _WITH_LVS_
   /* Virtual server mapping */
   install_keyword_root("virtual_server",       &vs_handler);
   install_keyword("delay_loop",                &delay_handler);
@@ -635,18 +667,18 @@ void init_keywords(void)
   install_keyword("persistence_timeout",       &pto_handler);
   install_keyword("persistence_granularity",   &pgr_handler);
   install_keyword("protocol",                  &proto_handler);
+  install_keyword("virtualhost",               &virtualhost_handler);
 
   /* Real server mapping */
   install_keyword("sorry_server",              &ssvr_handler);
   install_keyword("real_server",               &rs_handler);
   install_sublevel();
-  install_keyword("weight",                    &weight_handler);
+    install_keyword("weight",                  &weight_handler);
 
   /* Checkers mapping */
-#ifdef _WITH_LVS_
-  install_checkers_keyword();
-#endif
+    install_checkers_keyword();
   install_sublevel_end();
+#endif
 }
 
 void init_data(char *conf_file)
index f9b966b..00a64b1 100644 (file)
--- a/parser.h
+++ b/parser.h
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: parser.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index db03209..309485f 100644 (file)
--- a/pidfile.c
+++ b/pidfile.c
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: pidfile.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b226d71..1622b1d 100644 (file)
--- a/pidfile.h
+++ b/pidfile.h
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: pidfile.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
similarity index 77%
rename from samples/keepalived.conf.ssl
rename to samples/keepalived.conf.HTTP_GET.port
index 049443b..f41e409 100644 (file)
@@ -10,7 +10,7 @@ global_defs {
    lvs_id LVS_DEVEL
 }
 
-virtual_server 192.168.200.100 80 {
+virtual_server 192.168.200.100 443 {
     delay_loop 6
     lb_algo rr 
     lb_kind NAT
@@ -18,13 +18,14 @@ virtual_server 192.168.200.100 80 {
     persistence_timeout 50
     protocol TCP
 
-    real_server 192.168.201.100 80 {
+    real_server 192.168.201.100 443 {
         weight 1
         SSL_GET {
             url { 
               path /
-              digest FF20AD2481F97B1754EF3E12ECD3A9CC
+              digest ff20ad2481f97b1754ef3e12ecd3a9cc
             }
+            connect_port    443
             connect_timeout 3
             nb_get_retry 3
             delay_before_retry 3
diff --git a/samples/keepalived.conf.fwmark b/samples/keepalived.conf.fwmark
new file mode 100644 (file)
index 0000000..3a2ad44
--- /dev/null
@@ -0,0 +1,30 @@
+! Sample configuration for use Linux FWMARK
+
+global_defs {
+  lvs_id io
+}
+
+virtual_server fwmark 1 {
+  delay_loop 6
+   lb_algo rr
+  lb_kind NAT
+  persistence_timeout 900
+  protocol TCP
+
+  real_server 192.168.201.100 {
+    weight 1
+    TCP_CHECK {
+      connect_timeout 3
+    }
+  }
+
+  real_server 192.168.201.101 {
+    weight 1
+    TCP_CHECK {
+      connect_timeout 3
+    }
+  }
+}
+
+
+
index d4db20e..79ac075 100644 (file)
@@ -18,46 +18,6 @@ virtual_server 10.10.10.2 1358 {
     persistence_timeout 50
     protocol TCP
 
-    sorry_server 192.168.200.200 1358
-
-    real_server 192.168.200.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
-        }
-    }
-
     real_server 192.168.200.6 1358 {
         weight 1
         MISC_CHECK {
@@ -67,53 +27,3 @@ virtual_server 10.10.10.2 1358 {
 
 }
 
-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
-            }
-            connect_timeout 3
-            nb_get_retry 3
-            delay_before_retry 3
-        }
-    }
-}
diff --git a/samples/keepalived.conf.misc_check_arg b/samples/keepalived.conf.misc_check_arg
new file mode 100644 (file)
index 0000000..3ebee9d
--- /dev/null
@@ -0,0 +1,29 @@
+! 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
+    nat_mask 255.255.255.0
+    persistence_timeout 50
+    protocol TCP
+
+    real_server 192.168.200.6 1358 {
+        weight 1
+        MISC_CHECK {
+          misc_path "/usr/local/bin/script.sh arg1 arg2"
+        }
+    }
+
+}
+
diff --git a/samples/keepalived.conf.real_server_group b/samples/keepalived.conf.real_server_group
new file mode 100644 (file)
index 0000000..df0917c
--- /dev/null
@@ -0,0 +1,36 @@
+! Sample configuration for real server group declaration
+! Note yet implemented .....
+
+global_defs {
+  lvs_id io
+}
+
+real_server_group G1 {
+  real_server 192.168.201.100 80 {
+    weight 1
+  }
+  real_server 192.168.201.101 80 {
+    weight 1
+  }
+}
+
+virtual_server 192.168.200.10 80 {
+  delay_loop 6
+  lb_algo rr
+  lb_kind NAT
+  persistence_timeout 900
+  protocol TCP
+!  virtualhost www.cplusfrn.com
+
+  real_group G1 {
+    HTTP_GET {
+      url {
+        path /
+        digest ff20ad2481f97b1754ef3e12ecd3a9cc
+      }
+      connect_timeout 3
+      nb_get_retry 3
+      delay_before_retry 3
+    }
+  }
+}
diff --git a/samples/keepalived.conf.virtualhost b/samples/keepalived.conf.virtualhost
new file mode 100644 (file)
index 0000000..f899887
--- /dev/null
@@ -0,0 +1,38 @@
+! 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 192.168.200.100 80 {
+    delay_loop 6
+    lb_algo rr 
+    lb_kind NAT
+    persistence_timeout 50
+    protocol TCP
+    virtualhost www.firewall.loc    # The VirtualHost string to use
+                                    # in the GET query.
+
+    real_server 192.168.201.100 80 {
+        weight 1
+        SSL_GET {
+            url { 
+              path /
+              digest ff20ad2481f97b1754ef3e12ecd3a9cc
+            }
+            url { 
+              path /mrtg/
+              digest 9b3a0c85a887a256d6939da88aabd8cd
+            }
+            connect_timeout 3
+            nb_get_retry 3
+            delay_before_retry 3
+        }
+    }
+}
index 42c4ed6..238bf04 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.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: scheduler.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5c9c609..decaa07 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: scheduler.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/smtp.c b/smtp.c
index d83319c..592c1f4 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -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.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: smtp.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/smtp.h b/smtp.h
index 3717776..c09665d 100644 (file)
--- a/smtp.h
+++ b/smtp.h
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: smtp.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/timer.c b/timer.c
index 720fb97..d3d85c8 100644 (file)
--- a/timer.c
+++ b/timer.c
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: timer.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
diff --git a/timer.h b/timer.h
index 936b224..3fd00b5 100644 (file)
--- a/timer.h
+++ b/timer.h
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: timer.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/utils.c b/utils.c
index 0c6a2d9..351d436 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: utils.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/utils.h b/utils.h
index 6f186a4..beeb3d5 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: utils.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 3a3b89f..3e92ba8 100644 (file)
--- a/vector.c
+++ b/vector.c
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vector.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 6c22fb4..0f09e31 100644 (file)
--- a/vector.h
+++ b/vector.h
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vector.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/vrrp.c b/vrrp.c
index b4e8cea..67ae2e9 100644 (file)
--- a/vrrp.c
+++ b/vrrp.c
@@ -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.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -362,7 +362,7 @@ static int vrrp_in_chk(vrrp_rt *vrrp, char *buffer)
   if (hd->auth_type == VRRP_AUTH_PASS) {
     char *pw = (char *)ip + ntohs(ip->tot_len)
                           - sizeof(vrrp->auth_data);
-    if (memcmp(pw, vrrp->auth_data, sizeof(vrrp->auth_data))) {
+    if (strncmp(pw, vrrp->auth_data, strlen(vrrp->auth_data)) != 0) {
       syslog(LOG_INFO, "receive an invalid passwd!");
       return VRRP_PACKET_KO;
     }
@@ -765,9 +765,7 @@ void vrrp_state_goto_master(vrrp_rt *vrrp)
 #ifdef _HAVE_IPVS_SYNCD_
   /* Check if sync daemon handling is needed */
   if (vrrp->lvs_syncd_if)
-    thread_add_timer(master, ipvs_syncd_master_thread
-                           , vrrp->lvs_syncd_if
-                           , IPVS_CMD_DELAY);
+    ipvs_syncd_master(vrrp->lvs_syncd_if);
 #endif
 
   if (vrrp->wantstate == VRRP_STATE_MAST) {
@@ -809,9 +807,7 @@ void vrrp_state_leave_master(vrrp_rt *vrrp)
 #ifdef _HAVE_IPVS_SYNCD_
   /* Check if sync daemon handling is needed */
   if (vrrp->lvs_syncd_if)
-    thread_add_timer(master, ipvs_syncd_backup_thread
-                           , vrrp->lvs_syncd_if
-                           , IPVS_CMD_DELAY);
+    ipvs_syncd_backup(vrrp->lvs_syncd_if);
 #endif
 
   /* set the new vrrp state */
@@ -918,6 +914,10 @@ int vrrp_state_master_rx(vrrp_rt *vrrp, char *buf, int buflen)
     vrrp->ms_down_timer = 3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
     vrrp->state = VRRP_STATE_BACK;
     return 1;
+  } else if (hd->priority < vrrp->priority) {
+    /* We receive a lower prio adv we just refresh remote ARP cache */
+    vrrp_send_gratuitous_arp(vrrp);
+    return 0;
   }
 
   return 0;
diff --git a/vrrp.h b/vrrp.h
index 0b0bef6..08ffe8c 100644 (file)
--- a/vrrp.h
+++ b/vrrp.h
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Based on the Jerome Etienne, <jetienne@arobas.net> code.
index c3e73d5..8c3a16c 100644 (file)
--- a/vrrp_if.c
+++ b/vrrp_if.c
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 65435b7..1226874 100644 (file)
--- a/vrrp_if.h
+++ b/vrrp_if.h
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 18c6f34..1af10f7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 4586f23..9e73b7a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 7c0a18e..86615e7 100644 (file)
@@ -7,7 +7,7 @@
  *              authentication data encryption using HMAC MD5 according to
  *              RFCs 2085 & 2104.
  *
- * Version:     $Id: vrrp_ipsecah.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 6c8204b..1372956 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index b1eb8cf..143c3a6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 9e83336..670d573 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 0ad699c..202c3f8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -57,6 +57,12 @@ static void vrrp_init_state(list l)
 
     if (vrrp->priority == VRRP_PRIO_OWNER ||
         vrrp->wantstate == VRRP_STATE_MAST) {
+#ifdef _HAVE_IPVS_SYNCD_
+      /* Check if sync daemon handling is needed */
+      if (vrrp->lvs_syncd_if)
+        ipvs_syncd_cmd(IPVS_STARTDAEMON, vrrp->lvs_syncd_if
+                                       , IPVS_MASTER);
+#endif
       vrrp->state = VRRP_STATE_GOTO_MASTER;
     } else {
       vrrp->ms_down_timer = 3 * vrrp->adver_int
index 204af22..3abdce6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 0.5.8 2002/05/21 16:09:46 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *