* keepalived-0.5.7 released.
* Review autoconf/automake scripts to be more generic on system and code
selection. Added primitives (configure) :
--disable-lvs-syncd : Do not use IPVS sync daemon
--disable-lvs : Do not use IPVS framework
--disable-vrrp : Do not use VRRP framework
--enable-debug : Compile with debugging flags
* Fixed a SSL stream handling bug.
Thanks to Andres Salomon, <dilinger@voxel.net> for pointing the issue.
* Added a global memory counter to track global memory used.
* Fixed configuration parser. read_line. Remove static allocated
temporary read buffer. Only handle stream if line has been spitted into
vector.
* Limit maximum number of VIPs per VRRP Instance to 20. (for fragmentation,
overhead, and others reasons).
* Added IPVS wrapper support to persistence granularity.
Thanks to Mike Zimmerman, <tarmon@spamcop.net> for the suggestion.
* Review smtp notifier to handle VRRP MASTER state transition alert.
Thanks to Paul, <xerox@foonet.net> for the suggestion.
* Review the UserGuide.pdf to fixe some english issues :)
Thanks to Jacques Thomas, <jacktom@noos.fr> for reviewing.
+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
+ selection. Added primitives (configure) :
+ --disable-lvs-syncd : Do not use IPVS sync daemon
+ --disable-lvs : Do not use IPVS framework
+ --disable-vrrp : Do not use VRRP framework
+ --enable-debug : Compile with debugging flags
+ * Fixed a SSL stream handling bug.
+ Thanks to Andres Salomon, <dilinger@voxel.net> for pointing the issue.
+ * Added a global memory counter to track global memory used.
+ * Fixed configuration parser. read_line. Remove static allocated
+ temporary read buffer. Only handle stream if line has been spitted into
+ vector.
+ * Limit maximum number of VIPs per VRRP Instance to 20. (for fragmentation,
+ overhead, and others reasons).
+ * Added IPVS wrapper support to persistence granularity.
+ Thanks to Mike Zimmerman, <tarmon@spamcop.net> for the suggestion.
+ * Review smtp notifier to handle VRRP MASTER state transition alert.
+ Thanks to Paul, <xerox@foonet.net> for the suggestion.
+ * Review the UserGuide.pdf to fixe some english issues :)
+ Thanks to Jacques Thomas, <jacktom@noos.fr> for reviewing.
+
2002-04-13 Alexandre Cassen <acassen@linux-vs.org>
* keepalived-0.5.6 released.
* VRRP : Review in "GOTO_MASTER_STATE" the IP address handling.
# Copyright (C) 2001, 2002 Alexandre Cassen, <acassen@linux-vs.org>
EXEC = keepalived
-KERNEL := _KRNL_2_$(shell uname -r | cut -d'.' -f2)_
+KERNEL := _KRNL_2_$(shell uname -r | cut -d'.' -f2)_
+IPVS_FLAG := @IPVS_SUPPORT@
+VRRP_FLAG := @VRRP_SUPPORT@
-prefix = @prefix@
+prefix = @prefix@
exec_prefix = @exec_prefix@
-sbindir = @sbindir@
+sbindir = @sbindir@
-init_dir = /etc/rc.d/init.d
+init_dir = @SYSTEM_SCRIPT_DIR@
init_script = keepalived.init
src_init_script = etc/rc.d/init.d/$(init_script)
src_conf_file = etc/keepalived/keepalived.conf
keepalived_conf_dir = /etc/keepalived
CC = @CC@
-CFLAGS = @CFLAGS@ -Wall -Wunused -Wstrict-prototypes -D_DEBUG_ -D$(KERNEL)
+CFLAGS = @CFLAGS@ \
+ -Wall -Wunused -Wstrict-prototypes \
+ -D$(KERNEL) -D$(VRRP_FLAG) @DFLAGS@
LDFLAGS = @LIBS@ @LDFLAGS@ @LIBFW@
-OBJS = @LIBOBJS@ \
+IPVSFLAGS = -D$(IPVS_FLAG) -D@IPVS_SYNCD@
+
+CORE_OBJS = @LIBOBJS@ \
main.o \
memory.o \
daemon.o \
+ pidfile.o \
utils.o \
timer.o \
scheduler.o \
data.o \
parser.o \
layer4.o \
+ smtp.o
+
+ifeq ($(IPVS_FLAG),_WITH_LVS_)
+IPVS_OBJS = \
check_api.o \
check_tcp.o \
check_http.o \
check_ssl.o \
check_misc.o \
ipwrapper.o \
- ipvswrapper.o \
- pidfile.o \
- smtp.o \
+ ipvswrapper.o
+endif
+
+ifeq ($(VRRP_FLAG),_WITH_VRRP_)
+VRRP_OBJS = \
vrrp.o \
vrrp_scheduler.o \
vrrp_netlink.o \
vrrp_if.o \
vrrp_ipaddress.o \
vrrp_ipsecah.o
+endif
-INCLUDE= -I/usr/src/linux/include
+INCLUDE = -I/usr/src/linux/include
+OBJS = $(CORE_OBJS) $(IPVS_OBJS) $(VRRP_OBJS)
.c.o:
- $(CC) -o $@ $(CFLAGS) $(INCLUDE) -c $*.c
+ $(CC) -o $@ $(CFLAGS) $(IPVSFLAGS) $(INCLUDE) -c $*.c
all: $(EXEC)
strip $(EXEC)
*
* Part: Checkers registration.
*
- * Version: $Id: check_api.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_api.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
, void *data)
{
virtual_server *vs = LIST_TAIL_DATA(conf_data->vs);
- real_server *rs = LIST_TAIL_DATA(vs->rs);
- checker *chk = (checker *)MALLOC(sizeof(checker));
+ real_server *rs = LIST_TAIL_DATA(vs->rs);
+ checker *chk = (checker *)MALLOC(sizeof(checker));
chk->free = free;
chk->dump = dump;
*
* Part: Checkers arguments structures definitions.
*
- * Version: $Id: check_api.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_api.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: WEB CHECK. Common HTTP/SSL checker primitives.
*
- * Version: $Id: check_http.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_http.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Authors: Alexandre Cassen, <acassen@linux-vs.org>
* Jan Holmberg, <jan@artech.net>
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 = (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->url = alloc_list(free_url, dump_url);
delay = checker->vs->delay_loop;
else
delay = checker->vs->delay_loop - http_get_check->delay_before_retry;
- thread_add_timer(thread->master, http_connect_thread
- , checker
- , delay);
break;
case 2:
delay = http_get_check->delay_before_retry;
- thread_add_timer(thread->master, http_connect_thread
- , checker
- , delay);
break;
}
close(thread->u.fd);
}
+ /* Register next checker thread */
+ thread_add_timer(thread->master, http_connect_thread
+ , checker
+ , delay);
return 0;
}
/* check if server is currently alive */
if (ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "DOWN"
, smtp_msg);
perform_svr_state(DOWN, checker->vs, checker->rs);
{
checker *checker = THREAD_ARG(thread);
http_get_checker *http_get_check = CHECKER_ARG(checker);
+#ifdef _DEBUG_
http_arg *http_arg = HTTP_ARG(http_get_check);
+#endif
int r, di = 0;
unsigned char *digest_tmp;
url *fetched_url;
/* check if server is currently alive */
if (ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "DOWN"
, "=> CHECK failed on service"
" : MD5 digest mismatch <=\n\n");
, ntohs(CHECKER_RPORT(checker))
, http_arg->url_it + 1);
#endif
- return epilog(thread,2,1,0)+1;
+ return epilog(thread,1,1,0)+1;
}
}
return epilog(thread,0,0,0)+1;
if (r == -1) {
/* We have encourred a real read error */
+#ifdef _DEBUG_
+ syslog(LOG_DEBUG, "Read error with server [%s:%d]: %s"
+ , ip_ntoa(CHECKER_RIP(checker))
+ , ntohs(CHECKER_RPORT(checker))
+ , strerror(errno));
+#endif
if (ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "DOWN"
, "=> HTTP CHECK failed on service"
" : cannot receive data <=\n\n");
/* Register asynchronous http/ssl read thread */
if (http_get_check->proto == PROTO_SSL)
- thread_add_event(thread->master, ssl_read_thread
- , checker
- , 0);
+ thread_add_read(thread->master, ssl_read_thread
+ , checker
+ , thread->u.fd
+ , http_get_check->connection_to);
else
thread_add_read(thread->master, http_read_thread
, checker
/* check if server is currently alive */
if (ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "DOWN"
, "=> CHECK failed on service"
" : cannot send data <=\n\n");
{
checker *checker = THREAD_ARG(thread);
http_get_checker *http_get_check = CHECKER_ARG(checker);
+#ifdef _DEBUG_
http_arg *http_arg = HTTP_ARG(http_get_check);
REQ *req = HTTP_REQ(http_arg);
+#endif
int ret = 1;
int status;
/* check if server is currently alive */
if (ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "DOWN"
, "=> CHECK failed on service"
" : connection error <=\n\n");
*/
if (!ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "UP"
, "=> CHECK succeed on service <=\n\n");
perform_svr_state(UP, checker->vs, checker->rs);
*
* Part: check_http.c include file.
*
- * Version: $Id: check_http.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_http.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Authors: Alexandre Cassen, <acassen@linux-vs.org>
* Jan Holmberg, <jan@artech.net>
* Part: MISC CHECK. Perform a system call to run an extra
* system prog or script.
*
- * Version: $Id: check_misc.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_misc.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Authors: Alexandre Cassen, <acassen@linux-vs.org>
* Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
/* everything is good */
if (!checker->rs->alive) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "UP"
, "=> MISC CHECK succeed on service <=\n\n");
perform_svr_state(UP, checker->vs, checker->rs);
} else {
if (checker->rs->alive) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "DOWN"
, "=> MISC CHECK failed on service <=\n\n");
perform_svr_state(DOWN, checker->vs, checker->rs);
*
* Part: check_misc.c include file.
*
- * Version: $Id: check_misc.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_misc.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
* Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
* url, compute a MD5 over this result and match it to the
* expected value.
*
- * Version: $Id: check_ssl.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_ssl.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Authors: Alexandre Cassen, <acassen@linux-vs.org>
* Jan Holmberg, <jan@artech.net>
/* check if server is currently alive */
if (ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "DOWN"
, "=> SSL CHECK failed on service"
" : cannot receive data <=\n\n");
*
* Part: check_http.c include file.
*
- * Version: $Id: check_http.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_http.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Authors: Alexandre Cassen, <acassen@linux-vs.org>
* Jan Holmberg, <jan@artech.net>
*
* Part: TCP checker.
*
- * Version: $Id: check_tcp.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_tcp.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
if (!ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "UP"
, "=> TCP CHECK succeed on service <=\n\n");
perform_svr_state(UP, checker->vs, checker->rs);
if (ISALIVE(checker->rs)) {
smtp_alert(thread->master, checker->rs
+ , NULL
, "DOWN"
, "=> TCP CHECK failed on service <=\n\n");
perform_svr_state(DOWN, checker->vs, checker->rs);
*
* Part: check_tcp.c include file.
*
- * Version: $Id: check_tcp.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: check_tcp.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
+ac_help="$ac_help
+ --disable-lvs-syncd do not use LVS synchronization daemon"
+ac_help="$ac_help
+ --disable-lvs do not use the LVS framework"
+ac_help="$ac_help
+ --disable-vrrp do not use the VRRP framework"
+ac_help="$ac_help
+ --enable-debug compile with debugging flags"
# Initialize some variables set by options.
# The variables have the same names as the options, with
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:529: checking for $ac_word" >&5
+echo "configure:537: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:559: checking for $ac_word" >&5
+echo "configure:567: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:610: checking for $ac_word" >&5
+echo "configure:618: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:650: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 653 "configure"
+#line 661 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:692: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:689: checking whether we are using GNU C" >&5
+echo "configure:697: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:706: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:717: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:725: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:779: checking for a BSD compatible install" >&5
+echo "configure:787: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+if test -d /etc/init.d; then
+ SYSTEM_SCRIPT_DIR="/etc/init.d"
+elif test -d /etc/rc.d/init.d; then
+ SYSTEM_SCRIPT_DIR="/etc/rc.d/init.d"
+fi
+
+
KERNEL_VERSION=`uname -r`
+KERNEL_CODE=`echo $KERNEL_VERSION | cut -d'.' -f2`
IPVS_MODULE="/lib/modules/`uname -r`/kernel/net/ipv4/ipvs/ip_vs.o"
if test -f $IPVS_MODULE; then
if test -f /proc/net/ip_vs; then
IPVS_VERSION=`cat /proc/net/ip_vs | head -1 | awk '{ print $5}'`
+ IPVS_SUPPORT="_WITH_LVS_"
elif test -f /proc/net/ip_masq/vs; then
IPVS_VERSION=`cat /proc/net/ip_masq/vs | head -1 | awk '{ print $5}'`
+ IPVS_SUPPORT="_WITH_LVS_"
else
- echo
- echo "!!!WARN!!! Your kernel need to be patched with LVS code !!!WARN!!!"
- echo
- exit 1
+ IPVS_VERSION="0.0.0"
+ IPVS_SUPPORT="_WITHOUT_LVS_"
fi
VERSION=`cat VERSION`
+IPVS_MAJOR=`echo $IPVS_VERSION | cut -d'.' -f1`
+IPVS_MINOR=`echo $IPVS_VERSION | cut -d'.' -f2`
+IPVS_PATCH=`echo $IPVS_VERSION | cut -d'.' -f3`
+
+# Check whether --enable-lvs-syncd or --disable-lvs-syncd was given.
+if test "${enable_lvs_syncd+set}" = set; then
+ enableval="$enable_lvs_syncd"
+ :
+fi
+
+# Check whether --enable-lvs or --disable-lvs was given.
+if test "${enable_lvs+set}" = set; then
+ enableval="$enable_lvs"
+ :
+fi
+
+# Check whether --enable-vrrp or --disable-vrrp was given.
+if test "${enable_vrrp+set}" = set; then
+ enableval="$enable_vrrp"
+ :
+fi
+
+# Check whether --enable-debug or --disable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval="$enable_debug"
+ :
+fi
+
+
+if test "${enable_lvs}" = "no"; then
+ if test "${enable_vrrp}" = "no"; then
+ echo
+ echo " !!!WARN!!! Keepalived MUST be compiled at least with LVS or VRRP framework !!!WARN!!!"
+ echo
+ exit 1
+ fi
+fi
+
+VRRP_SUPPORT="_WITH_VRRP_"
+if test "${enable_lvs}" = "no"; then
+ IPVS_SUPPORT="_WITHOUT_LVS_"
+fi
+if test "${enable_vrrp}" = "no"; then
+ VRRP_SUPPORT="_WITHOUT_VRRP_"
+fi
+if test "${enable_debug}" = "yes"; then
+ DFLAGS="-D_DEBUG_"
+
+fi
+
+
+
+
+
+IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+if test ${IPVS_MAJOR} -eq 0; then
+ if test ${IPVS_MINOR} -eq 9; then
+ if test ${IPVS_PATCH} -ge 2; then
+ if test "${KERNEL_CODE}" = "4"; then
+ IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+ fi
+ fi
+ fi
+fi
+if test ${IPVS_MAJOR} -ge 1; then
+ if test "${KERNEL_CODE}" = "4"; then
+ IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+ fi
+fi
+if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_"; then
+ IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+fi
+if test "${enable_lvs_syncd}" = "no"; then
+ IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+fi
+
+
echo $ac_n "checking for MD5_Init in -lcrypto""... $ac_c" 1>&6
-echo "configure:852: checking for MD5_Init in -lcrypto" >&5
+echo "configure:945: checking for MD5_Init in -lcrypto" >&5
ac_lib_var=`echo crypto'_'MD5_Init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lcrypto $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 860 "configure"
+#line 953 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
MD5_Init()
; return 0; }
EOF
-if { (eval echo configure:871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for SSL_CTX_new in -lssl""... $ac_c" 1>&6
-echo "configure:900: checking for SSL_CTX_new in -lssl" >&5
+echo "configure:993: checking for SSL_CTX_new in -lssl" >&5
ac_lib_var=`echo ssl'_'SSL_CTX_new | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lssl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 908 "configure"
+#line 1001 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
SSL_CTX_new()
; return 0; }
EOF
-if { (eval echo configure:919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for poptGetContext in -lpopt""... $ac_c" 1>&6
-echo "configure:948: checking for poptGetContext in -lpopt" >&5
+echo "configure:1041: checking for poptGetContext in -lpopt" >&5
ac_lib_var=`echo popt'_'poptGetContext | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpopt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 956 "configure"
+#line 1049 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
poptGetContext()
; return 0; }
EOF
-if { (eval echo configure:967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
-KERNEL_CODE=`echo $KERNEL_VERSION | cut -d'.' -f2`
if test "${KERNEL_CODE}" = "2"; then
LIBFW="libipfwc/libipfwc.a"
LIBOBJS="$LIBOBJS ipfwwrapper.o"
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1003: checking how to run the C preprocessor" >&5
+echo "configure:1095: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1018 "configure"
+#line 1110 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1116: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1035 "configure"
+#line 1127 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1041: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1133: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1052 "configure"
+#line 1144 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1150: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1083: checking for ANSI C header files" >&5
+echo "configure:1175: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1088 "configure"
+#line 1180 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1096: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1188: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1113 "configure"
+#line 1205 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1131 "configure"
+#line 1223 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 1152 "configure"
+#line 1244 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
exit (0); }
EOF
-if { (eval echo configure:1163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1187: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:1279: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1192 "configure"
+#line 1284 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:1208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1232: checking for $ac_hdr" >&5
+echo "configure:1324: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1237 "configure"
+#line 1329 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1275: checking for $ac_hdr" >&5
+echo "configure:1367: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1280 "configure"
+#line 1372 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1313: checking for working const" >&5
+echo "configure:1405: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1318 "configure"
+#line 1410 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:1367: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1459: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1388: checking for pid_t" >&5
+echo "configure:1480: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1393 "configure"
+#line 1485 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1421: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:1513: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1426 "configure"
+#line 1518 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:1435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1527: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1458: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1550: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 1464 "configure"
+#line 1556 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 1482 "configure"
+#line 1574 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1504: checking return type of signal handlers" >&5
+echo "configure:1596: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1509 "configure"
+#line 1601 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
int i;
; return 0; }
EOF
-if { (eval echo configure:1526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1618: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
for ac_func in gettimeofday select socket strerror strtol uname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1547: checking for $ac_func" >&5
+echo "configure:1639: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1552 "configure"
+#line 1644 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@SYSTEM_SCRIPT_DIR@%$SYSTEM_SCRIPT_DIR%g
+s%@DFLAGS@%$DFLAGS%g
+s%@IPVS_SUPPORT@%$IPVS_SUPPORT%g
+s%@VRRP_SUPPORT@%$VRRP_SUPPORT%g
+s%@IPVS_SYNCD@%$IPVS_SYNCD%g
s%@LIBFW@%$LIBFW%g
s%@LIBOBJS@%$LIBOBJS%g
s%@CPP@%$CPP%g
Keepalived configuration
------------------------
-Keepalived version : ${VERSION}
-Linux Kernel release : ${KERNEL_VERSION}
-IPVS version code : ${IPVS_VERSION}
-Compiler : ${CC}
-Compiler flags : ${CFLAGS}
-Extra Lib : $LIBS
-Lib objects : $LIBOBJS
-Firewall Lib : $LIBFW
-
+Keepalived version : ${VERSION}
+Compiler : ${CC}
+Compiler flags : ${CFLAGS}
+Compiler flags : ${CFLAGS}
+Linux Kernel release : ${KERNEL_VERSION}
+Startup scripts location : ${SYSTEM_SCRIPT_DIR}
EOF
+
+if test -n "$LIBS"; then
+ echo "Extra Lib : $LIBS"
+fi
+if test -n "$LIBOBJS"; then
+ echo "Lib objects : $LIBOBJS"
+fi
+if test -n "$LIBFW"; then
+ echo "Firewall Lib : $LIBFW"
+fi
+
+if test "${IPVS_SUPPORT}" = "_WITH_LVS_"; then
+ echo "Use IPVS Framework : Yes"
+ echo "IPVS version code : ${IPVS_VERSION}"
+ if test "${IPVS_SYNCD}" = "_HAVE_IPVS_SYNCD_"; then
+ echo "IPVS sync daemon support : Yes"
+ elif test "${IPVS_SYNCD}" = "_WITHOUT_IPVS_SYNCD_"; then
+ echo "IPVS sync daemon support : No"
+ fi
+else
+ echo "Use IPVS Framework : No"
+ echo "IPVS sync daemon support : No"
+fi
+
+if test "${VRRP_SUPPORT}" = "_WITH_VRRP_"; then
+ echo "Use VRRP Framework : Yes"
+else
+ echo "Use VRRP Framework : No"
+fi
+if test "${DFLAGS}" = "-D_DEBUG_"; then
+ echo "Use Debug flags : Yes"
+else
+ echo "Use Debug flags : No"
+fi
+echo
AC_PROG_CC
AC_PROG_INSTALL
+dnl ----[ Checks for system init script dir ]----
+if test -d /etc/init.d; then
+ SYSTEM_SCRIPT_DIR="/etc/init.d"
+elif test -d /etc/rc.d/init.d; then
+ SYSTEM_SCRIPT_DIR="/etc/rc.d/init.d"
+fi
+AC_SUBST(SYSTEM_SCRIPT_DIR)
+
dnl ----[ Checks for kernel support ]----
KERNEL_VERSION=`uname -r`
+KERNEL_CODE=`echo $KERNEL_VERSION | cut -d'.' -f2`
IPVS_MODULE="/lib/modules/`uname -r`/kernel/net/ipv4/ipvs/ip_vs.o"
if test -f $IPVS_MODULE; then
if test -f /proc/net/ip_vs; then
IPVS_VERSION=`cat /proc/net/ip_vs | head -1 | awk '{ print $5}'`
+ IPVS_SUPPORT="_WITH_LVS_"
elif test -f /proc/net/ip_masq/vs; then
IPVS_VERSION=`cat /proc/net/ip_masq/vs | head -1 | awk '{ print $5}'`
+ IPVS_SUPPORT="_WITH_LVS_"
else
- echo
- echo "!!!WARN!!! Your kernel need to be patched with LVS code !!!WARN!!!"
- echo
- exit 1
+ IPVS_VERSION="0.0.0"
+ IPVS_SUPPORT="_WITHOUT_LVS_"
fi
VERSION=`cat VERSION`
+dnl ----[ Split IPVS NVERSION code ]----
+IPVS_MAJOR=`echo $IPVS_VERSION | cut -d'.' -f1`
+IPVS_MINOR=`echo $IPVS_VERSION | cut -d'.' -f2`
+IPVS_PATCH=`echo $IPVS_VERSION | cut -d'.' -f3`
+
+dnl ----[ Keepalived specific configure options ]----
+AC_ARG_ENABLE(lvs-syncd,
+ [ --disable-lvs-syncd do not use LVS synchronization daemon])
+AC_ARG_ENABLE(lvs,
+ [ --disable-lvs do not use the LVS framework])
+AC_ARG_ENABLE(vrrp,
+ [ --disable-vrrp do not use the VRRP framework])
+AC_ARG_ENABLE(debug,
+ [ --enable-debug compile with debugging flags])
+
+if test "${enable_lvs}" = "no"; then
+ if test "${enable_vrrp}" = "no"; then
+ echo
+ echo " !!!WARN!!! Keepalived MUST be compiled at least with LVS or VRRP framework !!!WARN!!!"
+ echo
+ exit 1
+ fi
+fi
+
+VRRP_SUPPORT="_WITH_VRRP_"
+if test "${enable_lvs}" = "no"; then
+ IPVS_SUPPORT="_WITHOUT_LVS_"
+fi
+if test "${enable_vrrp}" = "no"; then
+ VRRP_SUPPORT="_WITHOUT_VRRP_"
+fi
+if test "${enable_debug}" = "yes"; then
+ DFLAGS="-D_DEBUG_"
+ AC_SUBST(DFLAGS)
+fi
+
+AC_SUBST(IPVS_SUPPORT)
+AC_SUBST(VRRP_SUPPORT)
+
+dnl ----[ LVS syncd support probe ]---
+dnl Sync daemon is supported since LVS 0.9.2 for kernel 2.4
+
+IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+if test ${IPVS_MAJOR} -eq 0; then
+ if test ${IPVS_MINOR} -eq 9; then
+ if test ${IPVS_PATCH} -ge 2; then
+ if test "${KERNEL_CODE}" = "4"; then
+ IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+ fi
+ fi
+ fi
+fi
+if test ${IPVS_MAJOR} -ge 1; then
+ if test "${KERNEL_CODE}" = "4"; then
+ IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+ fi
+fi
+if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_"; then
+ IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+fi
+if test "${enable_lvs_syncd}" = "no"; then
+ IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+fi
+AC_SUBST(IPVS_SYNCD)
+
dnl ----[ Checks for libraries ]----
AC_CHECK_LIB(crypto, MD5_Init,,AC_MSG_ERROR([OpenSSL libraries are required]))
AC_CHECK_LIB(ssl, SSL_CTX_new,,AC_MSG_ERROR([OpenSSL libraries are required]))
AC_CHECK_LIB(popt, poptGetContext,,AC_MSG_ERROR([Popt libraries is required]))
dnl ----[ Create object list ]----
-KERNEL_CODE=`echo $KERNEL_VERSION | cut -d'.' -f2`
if test "${KERNEL_CODE}" = "2"; then
LIBFW="libipfwc/libipfwc.a"
LIBOBJS="$LIBOBJS ipfwwrapper.o"
Keepalived configuration
------------------------
-Keepalived version : ${VERSION}
-Linux Kernel release : ${KERNEL_VERSION}
-IPVS version code : ${IPVS_VERSION}
-Compiler : ${CC}
-Compiler flags : ${CFLAGS}
-Extra Lib : $LIBS
-Lib objects : $LIBOBJS
-Firewall Lib : $LIBFW
-
+Keepalived version : ${VERSION}
+Compiler : ${CC}
+Compiler flags : ${CFLAGS}
+Compiler flags : ${CFLAGS}
+Linux Kernel release : ${KERNEL_VERSION}
+Startup scripts location : ${SYSTEM_SCRIPT_DIR}
EOF
+
+dnl ----[ display optional vars ]----
+if test -n "$LIBS"; then
+ echo "Extra Lib : $LIBS"
+fi
+if test -n "$LIBOBJS"; then
+ echo "Lib objects : $LIBOBJS"
+fi
+if test -n "$LIBFW"; then
+ echo "Firewall Lib : $LIBFW"
+fi
+
+if test "${IPVS_SUPPORT}" = "_WITH_LVS_"; then
+ echo "Use IPVS Framework : Yes"
+ echo "IPVS version code : ${IPVS_VERSION}"
+ if test "${IPVS_SYNCD}" = "_HAVE_IPVS_SYNCD_"; then
+ echo "IPVS sync daemon support : Yes"
+ elif test "${IPVS_SYNCD}" = "_WITHOUT_IPVS_SYNCD_"; then
+ echo "IPVS sync daemon support : No"
+ fi
+else
+ echo "Use IPVS Framework : No"
+ echo "IPVS sync daemon support : No"
+fi
+
+if test "${VRRP_SUPPORT}" = "_WITH_VRRP_"; then
+ echo "Use VRRP Framework : Yes"
+else
+ echo "Use VRRP Framework : No"
+fi
+if test "${DFLAGS}" = "-D_DEBUG_"; then
+ echo "Use Debug flags : Yes"
+else
+ echo "Use Debug flags : No"
+fi
+dnl ----[ end configure ]---
+echo
*
* Part: Main program structure.
*
- * Version: $Id: main.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: main.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: Daemon process handling.
*
- * Version: $Id: daemon.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: daemon.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: Dynamic data structure definition.
*
- * Version: $Id: data.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: data.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
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)
{
, vs->delay_loop
, vs->sched);
if (atoi(vs->timeout_persistence) > 0)
- syslog(LOG_INFO, " persistence = %s"
+ 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");
free_list(conf_data->vrrp);
free_list(conf_data->vs);
-// FREE(conf_data->lvs_id);
-// FREE(conf_data->email_from);
+ FREE_PTR(conf_data->lvs_id);
+ FREE_PTR(conf_data->email_from);
FREE(conf_data);
}
void dump_data(void)
, NVERSION(IP_VS_VERSION_CODE));
dump_list(conf_data->vs);
}
+#ifdef _WITH_LVS_
dump_checkers_queue();
+#endif
}
*
* Part: Dynamic data structure definition.
*
- * Version: $Id: data.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: data.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
unsigned loadbalancing_kind;
uint32_t nat_mask;
char timeout_persistence[MAX_TIMEOUT_LENGTH];
+ uint32_t granularity_persistence;
real_server *s_svr;
list rs;
} virtual_server;
* library to add/remove server MASQ rules to the kernel
* firewall framework.
*
- * Version: $Id: ipfwwrapper.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: ipfwwrapper.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: ipfwwrapper.c include file.
*
- * Version: $Id: ipfwwrapper.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: ipfwwrapper.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
* Part: IPVS Kernel wrapper. Use setsockopt call to add/remove
* server to/from the loadbalanced server pool.
*
- * Version: $Id: ipvswrapper.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: ipvswrapper.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
strncpy(ctl.m_tname, vs->sched, IP_MASQ_TNAME_MAX);
ctl.u.vs_user.weight = -1;
ctl.u.vs_user.masq_flags = vs->loadbalancing_kind;
- ctl.u.vs_user.netmask = ((u_int32_t) 0xffffffff); /* f:f:f:f for default netmask */
+ ctl.u.vs_user.netmask = ((u_int32_t) 0xffffffff);
ctl.u.vs_user.protocol = vs->service_type;
- if(!parse_timeout(vs->timeout_persistence, &ctl.u.vs_user.timeout)) {
+ if(!parse_timeout(vs->timeout_persistence, &ctl.u.vs_user.timeout))
syslog(LOG_INFO, "IPVS WRAPPER : Virtual service [%s:%d] illegal timeout."
, ip_ntoa(SVR_IP(vs))
, ntohs(SVR_PORT(vs)));
- }
- ctl.u.vs_user.vs_flags = (ctl.u.vs_user.timeout!=0)?IP_VS_SVC_F_PERSISTENT:0;
+ if (urule.timeout != 0 || vs->granularity_persistence)
+ ctl.u.vs_user.vs_flags = IP_VS_SVC_F_PERSISTENT;
/* VS specific */
if (vs->vfwmark) {
ctl.u.vs_user.vport = SVR_PORT(vs);
}
+ if (ctl.m_cmd == IP_MASQ_CMD_ADD || ctl.m_cmd == IP_MASQ_CMD_DEL)
+ if (vs->granularity_persistence)
+ ctl.u.vs_user.netmask = vs->granularity_persistence;
+
/* SVR specific */
if (ctl.m_cmd == IP_MASQ_CMD_ADD_DEST || ctl.m_cmd == IP_MASQ_CMD_DEL_DEST) {
ctl.u.vs_user.weight = rs->weight;
int ipvs_syncd_cmd(int cmd, char *ifname, int state)
{
+#ifdef _HAVE_IPVS_SYNCD_
+
struct ip_vs_rule_user urule;
int result = 0;
int sockfd;
close(sockfd);
return IPVS_SUCCESS;
+
+#else
+ syslog(LOG_INFO, "IPVS WRAPPER : Sync daemon not supported on kernel v2.2");
+ return IPVS_ERROR;
+#endif
}
int ipvs_cmd(int cmd, virtual_server *vs, real_server *rs)
strncpy(urule.sched_name, vs->sched, IP_VS_SCHEDNAME_MAXLEN);
urule.weight = 1;
urule.conn_flags = vs->loadbalancing_kind;
- urule.netmask = ((u_int32_t) 0xffffffff);
+ urule.netmask = ((u_int32_t) 0xffffffff);
urule.protocol = vs->service_type;
if (!parse_timeout(vs->timeout_persistence, &urule.timeout))
syslog(LOG_INFO, "IPVS WRAPPER : Virtual service [%s:%d] illegal timeout."
, ip_ntoa(SVR_IP(vs))
, ntohs(SVR_PORT(vs)));
- urule.vs_flags = (urule.timeout != 0)?IP_VS_SVC_F_PERSISTENT:0;
+ if (urule.timeout != 0 || vs->granularity_persistence)
+ urule.vs_flags = IP_VS_SVC_F_PERSISTENT;
/* VS specific */
if (vs->vfwmark) {
urule.vaddr = SVR_IP(vs);
urule.vport = SVR_PORT(vs);
}
+
+ if (cmd == IP_VS_SO_SET_ADD || cmd == IP_VS_SO_SET_DEL)
+ if (vs->granularity_persistence)
+ urule.netmask = vs->granularity_persistence;
+
/* SVR specific */
if (cmd == IP_VS_SO_SET_ADDDEST || cmd == IP_VS_SO_SET_DELDEST) {
urule.weight = rs->weight;
*
* Part: ipvswrapper.c include file.
*
- * Version: $Id: ipvswrapper.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: ipvswrapper.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
#define IPVS_SUCCESS 1
#define IPVS_CMD_DELAY 3
-#ifdef _KRNL_2_2_
- #define IPVS_STARTDAEMON 1
- #define IPVS_STOPDAEMON 2
- #define IPVS_MASTER 3
- #define IPVS_BACKUP 4
-#else
+#ifdef _HAVE_IPVS_SYNCD_
#define IPVS_STARTDAEMON IP_VS_SO_SET_STARTDAEMON
#define IPVS_STOPDAEMON IP_VS_SO_SET_STOPDAEMON
#define IPVS_MASTER IP_VS_STATE_MASTER
#define IPVS_BACKUP IP_VS_STATE_BACKUP
+#else
+ #define IPVS_STARTDAEMON 1
+ #define IPVS_STOPDAEMON 2
+ #define IPVS_MASTER 3
+ #define IPVS_BACKUP 4
#endif
extern thread_master *master;
*
* Part: Manipulation functions for IPVS & IPFW wrappers.
*
- * Version: $id: ipwrapper.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $id: ipwrapper.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: ipwrapper.c include file.
*
- * Version: $Id: ipwrapper.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: ipwrapper.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
* Part: Layer4 checkers handling. Register worker threads &
* upper layer checkers.
*
- * Version: $Id: layer4.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: layer4.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: layer4.c include file.
*
- * Version: $Id: layer4.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: layer4.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: List structure manipulation.
*
- * Version: $Id: list.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: list.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: list.c include file.
*
- * Version: $Id: list.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: list.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: Main program structure.
*
- * Version: $Id: main.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: main.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*/
#include "main.h"
-#include "daemon.h"
-#include "memory.h"
-#include "parser.h"
-#include "vrrp_if.h"
/* SIGHUP handler */
void sighup(int sig)
/* Signal handling initialization */
signal_init();
- /* Create the master thread */
- master = thread_make_master();
-
/* Init interface queue */
init_interface_queue();
/* Parse the configuration file */
+#ifdef _WITH_LVS_
init_checkers_queue();
+#endif
init_keywords();
init_data(conf_file);
if (!conf_data) {
syslog(LOG_INFO, "Stopping "VERSION_STRING);
closelog();
- thread_destroy_master(master);
#ifdef _DEBUG_
keepalived_free_final();
#endif
}
/* SSL load static data & initialize common ctx context */
+#ifdef _WITH_LVS_
if (!init_ssl_ctx()) {
closelog();
- thread_destroy_master(master);
#ifdef _DEBUG_
keepalived_free_final();
#endif
exit(0);
}
+#endif
if (debug & 4)
dump_data();
+#ifdef _WITH_LVS_
if (!init_services()) {
syslog(LOG_INFO, "Stopping "VERSION_STRING);
closelog();
free_data();
exit(0);
}
+#endif
+
+ /* Create the master thread */
+ master = thread_make_master();
/* register workers threads */
+ kernel_netlink_init();
+ if_mii_poller_init();
+#ifdef _WITH_LVS_
register_checkers_thread();
+#endif
vrrp_complete_init();
register_vrrp_thread();
syslog(LOG_INFO, "Stopping "VERSION_STRING);
/* Just cleanup memory & exit */
- free_checkers_queue();
thread_destroy_master(master);
+#ifdef _WITH_LVS_
+ free_checkers_queue();
clear_services();
+#endif
shutdown_vrrp_instances();
free_interface_queue();
free_data();
*
* Part: Main program include file.
*
- * Version: $Id: main.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: main.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
#include <popt.h>
/* local includes */
+#include "daemon.h"
+#include "memory.h"
+#include "parser.h"
#include "utils.h"
#include "pidfile.h"
#include "data.h"
#include "scheduler.h"
#include "ipwrapper.h"
-#include "smtp.h"
-#include "vrrp.h"
#include "check_api.h"
+#include "vrrp.h"
+#include "vrrp_if.h"
#include "vrrp_netlink.h"
/* global var */
thread_master *master;
unsigned int debug;
+unsigned long mem_allocated = 0;
data *conf_data;
/* extern prototypes */
-extern void clear_ssl(SSL_DATA *ssl);
-extern int init_ssl_ctx(void);
+#ifdef _WITH_LVS_
+ extern void clear_ssl(SSL_DATA *ssl);
+ extern int init_ssl_ctx(void);
+#endif
extern void register_vrrp_thread(void);
/* Build version */
#define PROG "Keepalived"
-#define VERSION_CODE 0x000506
-#define DATE_CODE 0x0d0402
+#define VERSION_CODE 0x000507
+#define DATE_CODE 0x160402
#define KEEPALIVED_VERSION(version) \
(version >> 16) & 0xFF, \
* Part: Memory management framework. This framework is used to
* find any memory leak.
*
- * Version: $Id: memory.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: memory.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Authors: Alexandre Cassen, <acassen@linux-vs.org>
* Jan Holmberg, <jan@artech.net>
#include "memory.h"
-
void *xalloc(unsigned long size)
{
void *mem;
-
- if ((mem = malloc(size)))
+ if ((mem = malloc(size))) {
memset(mem, 0, size);
+ mem_allocated += size;
+ }
return mem;
}
+void xfree(void *p)
+{
+ mem_allocated -= sizeof(p);
+ free(p);
+}
/* KeepAlived memory management. in debug mode,
* help finding eventual memory leak.
*
* Part: memory.c include file.
*
- * Version: $Id: memory.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: memory.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Authors: Alexandre Cassen, <acassen@linux-vs.org>
* Jan Holmberg, <jan@artech.net>
/* extern types */
extern unsigned int debug;
+extern unsigned long mem_allocated;
+extern void *xalloc(unsigned long size);
+extern void xfree(void *p);
/* Local defines */
#ifdef _DEBUG_
#else
#define MALLOC(n) (xalloc(n))
-#define FREE(p) (free(p))
+#define FREE(p) (xfree(p))
#define REALLOC(p,n) (realloc((p),(n)))
#endif
* data structure representation the conf file representing
* the loadbalanced server pool.
*
- * Version: $Id: parser.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: parser.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
#include "parser.h"
#include "memory.h"
#include "vrrp.h"
+#include "vrrp_if.h"
#include "check_api.h"
/* global defs */
static int sublevel = 0;
static FILE *stream;
extern data *conf_data;
+extern unsigned long mem_allocated;
static void keyword_alloc(vector keywords, char *string, void (*handler)(vector))
{
static void free_keywords(vector keywords)
{
- int i;
struct keyword *keyword;
+ int i;
for (i = 0; i < VECTOR_SIZE(keywords); i++) {
keyword = VECTOR_SLOT(keywords, i);
cp = string;
/* Skip white spaces */
- while ((isspace((int) *cp) || *cp == '\r' || *cp == '\n') &&
- *cp != '\0')
+ while (isspace((int) *cp) && *cp != '\0')
cp++;
/* Return if there is only white spaces */
while (1) {
start = cp;
- while (!(isspace((int) *cp) || *cp == '\r' || *cp == '\n') &&
- *cp != '\0')
+ while (!isspace((int) *cp) && *cp != '\0')
cp++;
strlen = cp - start;
token = MALLOC(strlen + 1);
vector_alloc_slot(strvec);
vector_set_slot(strvec, token);
- while ((isspace((int) *cp) || *cp == '\n' || *cp == '\r') &&
- *cp != '\0')
+ while (isspace((int) *cp) && *cp != '\0')
cp++;
if (*cp == '\0' || *cp == '!' || *cp == '#')
return strvec;
}
}
-static char *read_line(char *buf, int size)
+static int read_line(char *buf, int size)
{
- return(fgets(buf, size, stream));
+ int ch;
+ int count = 0;
+
+ while ((ch = fgetc(stream)) != EOF && (int) ch != '\n'
+ && (int) ch != '\r') {
+ if (count < size)
+ buf[count] = (int) ch;
+ else
+ break;
+ count++;
+ }
+ return (ch == EOF)?0:1;
}
vector read_value_block(void)
{
- char buf[BUFSIZ];
+ char *buf;
int i;
char *str = NULL;
char *dup;
vector vec = NULL;
vector elements = vector_alloc();
- while (read_line(buf, BUFSIZ)) {
+ buf = (char *)MALLOC(MAXBUF);
+ while (read_line(buf, MAXBUF)) {
vec = alloc_strvec(buf);
- str = VECTOR_SLOT(vec, 0);
- if (!strcmp(str, EOB)) {
+ if (vec) {
+ str = VECTOR_SLOT(vec, 0);
+ if (!strcmp(str, EOB)) {
+ free_strvec(vec);
+ break;
+ }
+
+ if (VECTOR_SIZE(vec))
+ for (i = 0; i < VECTOR_SIZE(vec); i++) {
+ str = VECTOR_SLOT(vec, i);
+ dup = (char *)MALLOC(strlen(str)+1);
+ memcpy(dup, str, strlen(str));
+ vector_alloc_slot(elements);
+ vector_set_slot(elements, dup);
+ }
free_strvec(vec);
- break;
}
-
- if (VECTOR_SIZE(vec))
- for (i = 0; i < VECTOR_SIZE(vec); i++) {
- str = VECTOR_SLOT(vec, i);
- dup = (char *)MALLOC(strlen(str)+1);
- memcpy(dup, str, strlen(str));
- vector_alloc_slot(elements);
- vector_set_slot(elements, dup);
- }
- free_strvec(vec);
+ memset(buf, 0, MAXBUF);
}
-
+
+ FREE(buf);
return elements;
}
memcpy(vrrp->notify_file, str, size);
vrrp->notify_exec = 1;
}
+static void vrrp_smtp_handler(vector strvec)
+{
+ vrrp_rt *vrrp = LIST_TAIL_DATA(conf_data->vrrp);
+ vrrp->smtp_alert = 1;
+}
static void vrrp_lvs_syncd_handler(vector strvec)
{
vrrp_rt *vrrp = LIST_TAIL_DATA(conf_data->vrrp);
}
static void vrrp_vip_handler(vector strvec)
{
- vector vips = read_value_block();
- int i;
+ vector vips = read_value_block();
+ vrrp_rt *vrrp = LIST_TAIL_DATA(conf_data->vrrp);
char *str;
-
- for (i = 0; i < VECTOR_SIZE(vips); i++) {
+ int i;
+ int nbvip = 0;
+
+ if (VECTOR_SIZE(vips) > VRRP_MAX_VIP) {
+ syslog(LOG_INFO, "VRRP_Instance(%s) use %d VIPs, trunc to the first %d VIPs."
+ , vrrp->iname
+ , VECTOR_SIZE(vips)
+ , VRRP_MAX_VIP);
+ syslog(LOG_INFO, " => Declare another VRRP instance to handle all the VIPs");
+ nbvip = VRRP_MAX_VIP;
+ } else
+ nbvip = VECTOR_SIZE(vips);
+
+ for (i = 0; i < nbvip; i++) {
str = VECTOR_SLOT(vips, i);
alloc_vrrp_vip(str);
}
int size = sizeof(vs->timeout_persistence);
memcpy(vs->timeout_persistence, str, size);
-
+}
+static void pgr_handler(vector strvec)
+{
+ virtual_server *vs = LIST_TAIL_DATA(conf_data->vs);
+ vs->granularity_persistence = inet_addr(VECTOR_SLOT(strvec, 1));
}
static void proto_handler(vector strvec)
{
int i;
struct keyword *keyword;
char *str;
- char buf[BUFSIZ];
+ char *buf;
vector strvec;
- if (!read_line(buf, BUFSIZ))
+ buf = MALLOC(MAXBUF);
+ if (!read_line(buf, MAXBUF)) {
+ FREE(buf);
return;
+ }
strvec = alloc_strvec(buf);
+ FREE(buf);
if (!strvec) {
process_stream(keywords);
install_keyword("preempt", &vrrp_preempt_handler);
install_keyword("debug", &vrrp_debug_handler);
install_keyword("notify", &vrrp_notify_handler);
+ install_keyword("smtp_alert", &vrrp_smtp_handler);
install_keyword("lvs_sync_daemon_interface", &vrrp_lvs_syncd_handler);
install_keyword("authentication", NULL);
install_sublevel();
install_keyword("lb_kind", &lbkind_handler);
install_keyword("nat_mask", &natmask_handler);
install_keyword("persistence_timeout", &pto_handler);
+ install_keyword("persistence_granularity", &pgr_handler);
install_keyword("protocol", &proto_handler);
/* Real server mapping */
install_keyword("weight", &weight_handler);
/* Checkers mapping */
+#ifdef _WITH_LVS_
install_checkers_keyword();
+#endif
+ install_sublevel_end();
}
void init_data(char *conf_file)
process_stream(keywords);
/* Dump configuration *
-
vector_dump(keywords);
dump_keywords(keywords, 0);
- free_keywords(keywords);
*/
fclose(stream);
free_keywords(keywords);
+
+ syslog(LOG_INFO, "Configuration is using : %lu Bytes"
+ , mem_allocated);
}
*
* Part: cfreader.c include file.
*
- * Version: $Id: parser.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: parser.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
/* Global definitions */
#define CONF "/etc/keepalived/keepalived.conf"
#define EOB "}"
+#define MAXBUF 1024
/* ketword definition */
struct keyword {
*
* Part: pidfile utility.
*
- * Version: $Id: pidfile.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: pidfile.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: pidfile.c include file.
*
- * Version: $Id: pidfile.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: pidfile.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
vrrp_instance VI_1 {
state MASTER
interface eth0
+ smtp_alert
virtual_router_id 51
priority 100
advert_int 1
vrrp_instance VI_2 {
interface eth0
+ smtp_alert
virtual_router_id 50
priority 50
advert_int 1
vrrp_instance VI_3 {
state MASTER
interface eth1
+ smtp_alert
virtual_router_id 52
priority 100
advert_int 1
vrrp_instance VI_4 {
interface eth1
+ smtp_alert
virtual_router_id 53
priority 50
advert_int 1
* the thread management routine (thread.c) present in the
* very nice zebra project (http://www.zebra.org).
*
- * Version: $Id: scheduler.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: scheduler.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
if (ret < 0) {
if (errno != EINTR) {
/* Real error. */
-#ifdef DEBUG
+#ifdef _DEBUG_
syslog(LOG_DEBUG, "select error: %s", strerror (errno));
#endif
assert (0);
*
* Part: scheduler.c include file.
*
- * Version: $Id: scheduler.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: scheduler.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
* 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.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: smtp.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
smtp_arg = THREAD_ARG(thread);
+ /* Return if no smtp server is defined */
+ if (conf_data->smtp_server == 0) {
+ free_smtp_all(smtp_arg);
+ return 0;
+ }
+
if ( (fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1 ) {
#ifdef _DEBUG_
syslog(LOG_DEBUG, "SMTP connect fail to create socket.");
void smtp_alert(thread_master *master
, real_server *rs
+ , vrrp_rt *vrrp
, const char *subject
, const char *body)
{
/* format subject if rserver is specified */
if (rs)
- snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH, "[%s] %s:%d - %s"
- , conf_data->lvs_id
- , ip_ntoa(SVR_IP(rs))
- , ntohs(SVR_PORT(rs))
- , subject);
- else
+ snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH
+ , "[%s] Realserver %s:%d - %s"
+ , conf_data->lvs_id
+ , ip_ntoa(SVR_IP(rs))
+ , ntohs(SVR_PORT(rs))
+ , subject);
+ else if (vrrp)
+ snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH
+ , "[%s] VRRP Instance %s - %s"
+ , conf_data->lvs_id
+ , vrrp->iname
+ , subject);
+ else if (conf_data->lvs_id)
snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH, "[%s] %s"
, conf_data->lvs_id
, subject);
+ else
+ snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH, "%s"
+ , subject);
strncpy(smtp_arg->body, body, MAX_BODY_LENGTH);
*
* Part: smtp.c include file.
*
- * Version: $Id: smtp.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: smtp.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
#include "data.h"
#include "scheduler.h"
#include "layer4.h"
+#include "vrrp.h"
/* global defs */
#define SMTP_PORT 25
/* Prototypes defs */
extern void smtp_alert(thread_master *
, real_server *
+ , vrrp_rt *
, const char *
, const char *);
#endif
*
* Part: Timer manipulations.
*
- * Version: $Id: timer.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: timer.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: timer.c include file.
*
- * Version: $Id: timer.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: timer.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: General program utils.
*
- * Version: $Id: utils.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: utils.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: utils.h include file.
*
- * Version: $Id: utils.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: utils.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: Vector structure manipulation.
*
- * Version: $Id: vector.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vector.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: vector.c include file.
*
- * Version: $Id: vector.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vector.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
* master fails, a backup server takes over.
* The original implementation has been made by jerome etienne.
*
- * Version: $Id: vrrp.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
, vrrp->notify_exec);
}
+#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);
+#endif
if (vrrp->wantstate == VRRP_STATE_MAST) {
vrrp->state = VRRP_STATE_MAST;
, vrrp->notify_exec);
}
+#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);
+#endif
/* set the new vrrp state */
switch (vrrp->wantstate) {
vrrp->state == VRRP_STATE_DUMMY_MAST)
vrrp_restore_interface(vrrp, 1);
+#ifdef _HAVE_IPVS_SYNCD_
/* Stop stalled syncd */
if (vrrp->lvs_syncd_if)
ipvs_syncd_cmd(IPVS_STOPDAEMON, NULL, 0);
+#endif
}
}
*
* Part: vrrp.c program include file.
*
- * Version: $Id: vrrp.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
* Based on the Jerome Etienne, <jetienne@arobas.net> code.
int fd; /* the socket descriptor */
int debug; /* Debug level 0-4 */
+
+ /* State transition notification */
+ int smtp_alert;
int notify_exec;
char notify_file[FILENAME_MAX];
#define VRRP_PACKET_DROP 2
#define VRRP_PACKET_NULL 3
#define VRRP_PACKET_OTHER 4 /* Muliple VRRP on LAN, Identify "other" VRRP */
-#define VRRP_PACKET_TEMP_LEN 256
-#define VRRP_AUTH_LEN 8
+/* VRRP Packet fixed lenght */
+#define VRRP_MAX_VIP 20
+#define VRRP_PACKET_TEMP_LEN 512
+#define VRRP_AUTH_LEN 8
#define VRRP_IS_BAD_VID(id) ((id)<1 || (id)>255) /* rfc2338.6.1.vrid */
#define VRRP_IS_BAD_PRIORITY(p) ((p)<1 || (p)>255) /* rfc2338.6.1.prio */
#define VRRP_IS_BAD_ADVERT_INT(d) ((d)<1)
-
#define VRRP_IS_BAD_DEBUG_INT(d) ((d)<0 || (d)>4)
-
#define VRRP_TIMER_SKEW(srv) ((256-(srv)->priority)*TIMER_HZ/256)
#define VRRP_MIN(a, b) ((a) < (b)?(a):(b))
*
* Part: Interfaces manipulation.
*
- * Version: $Id: vrrp_if.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_if.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
init_if_queue();
netlink_interface_lookup();
init_if_mii();
- kernel_netlink_init();
// dump_list(if_queue);
-
+}
+void if_mii_poller_init(void)
+{
/* Register NIC Heartbeat monitoring thread */
thread_add_timer(master, if_monitor_thread
, NULL
*
* Part: vrrp_if.c include file.
*
- * Version: $Id: vrrp_if.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_if.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
extern interface *if_get_by_ifname(const char *ifname);
extern int if_mii_linkbeat(const interface *ifp);
extern int if_mii_probe(const char *ifname);
+extern void if_mii_poller_init(void);
extern void if_add_queue(interface *ifp);
extern int if_monitor_thread(thread *thread);
extern void init_interface_queue(void);
*
* Part: NETLINK IPv4 address manipulation.
*
- * Version: $Id: vrrp_ipaddress.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_ipaddress.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: vrrp_ipaddress.c include file.
*
- * Version: $Id: vrrp_ipaddress.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_ipaddress.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
* authentication data encryption using HMAC MD5 according to
* RFCs 2085 & 2104.
*
- * Version: $Id: vrrp_ipsecah.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_ipsecah.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: vrrp_ipsecah.c include file.
*
- * Version: $Id: vrrp_ipsecah.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_ipsecah.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: NETLINK kernel command channel.
*
- * Version: $Id: vrrp_netlink.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_netlink.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: vrrp_netlink.c include file.
*
- * Version: $Id: vrrp_netlink.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_netlink.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
*
* Part: Sheduling framework for vrrp code.
*
- * Version: $Id: vrrp_scheduler.c,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_scheduler.c,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*
#include "memory.h"
#include "list.h"
#include "data.h"
+#include "smtp.h"
extern thread_master *master;
extern data *conf_data;
+/* SMTP alert notifier */
+static void vrrp_smtp_notifier(vrrp_rt *vrrp)
+{
+ if (vrrp->smtp_alert)
+ smtp_alert(master, NULL, vrrp
+ , "Transition to MASTER state"
+ , "=> VRRP Instance is now owning VRRP VIPs <=\n\n");
+}
+
/*
* Initialize state handling
* --rfc2338.6.4.1
} else {
vrrp->ms_down_timer = 3 * vrrp->adver_int
+ VRRP_TIMER_SKEW(vrrp);
+#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_BACKUP);
+#endif
vrrp->state = VRRP_STATE_BACK;
}
}
/* Then jump to master state */
vrrp->wantstate = VRRP_STATE_MAST;
vrrp_state_goto_master(vrrp);
+ vrrp_smtp_notifier(vrrp);
}
static void vrrp_handle_leave_master(vrrp_rt *vrrp
/* handle master state transition */
vrrp_state_goto_master(vrrp);
+ vrrp_smtp_notifier(vrrp);
}
}
/* Otherwise, we transit to init state */
if (vrrp->init_state == VRRP_STATE_BACK)
vrrp->state = VRRP_STATE_BACK;
- else
+ else {
vrrp_handle_goto_master(vrrp);
+ vrrp_smtp_notifier(vrrp);
+ }
}
}
}
*
* Part: vrrp_scheduler.c include file.
*
- * Version: $Id: vrrp_scheduler.h,v 0.5.6 2002/04/13 06:21:33 acassen Exp $
+ * Version: $Id: vrrp_scheduler.h,v 0.5.7 2002/05/02 22:18:07 acassen Exp $
*
* Author: Alexandre Cassen, <acassen@linux-vs.org>
*