From 7f924dfd574431a5a8694f50a6d9490b1be09f5a Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Jan 26 2014 09:31:46 +0000 Subject: import keepalived-1.2.10-2.el7.src.rpm --- diff --git a/.keepalived.metadata b/.keepalived.metadata index 1460181..4dc0ac8 100644 --- a/.keepalived.metadata +++ b/.keepalived.metadata @@ -1 +1 @@ -1cad8639cc97f2fa7dcc9e832193ad51a30a2f63 SOURCES/keepalived-1.2.8.tar.gz +a74a98994b60a9eacba6c057f22ec40fd66d39fb SOURCES/keepalived-1.2.10.tar.gz diff --git a/SOURCES/0001-ipvs-make-nlerr2syserr-libnl-dependent.patch b/SOURCES/0001-ipvs-make-nlerr2syserr-libnl-dependent.patch new file mode 100644 index 0000000..03b3014 --- /dev/null +++ b/SOURCES/0001-ipvs-make-nlerr2syserr-libnl-dependent.patch @@ -0,0 +1,34 @@ +From 71e762fb29a8ba218c90a48e0e160b2bb8b74326 Mon Sep 17 00:00:00 2001 +From: Alexandre Cassen +Date: Mon, 6 Jan 2014 15:04:28 +0100 +Subject: [PATCH 1/7] ipvs: make nlerr2syserr libnl dependent + +nlerr2syserr() is only used when libnl is present... simply reflect +this in libipvs. +--- + keepalived/libipvs-2.6/libipvs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/keepalived/libipvs-2.6/libipvs.c b/keepalived/libipvs-2.6/libipvs.c +index 223e76b..8ccf94d 100644 +--- a/keepalived/libipvs-2.6/libipvs.c ++++ b/keepalived/libipvs-2.6/libipvs.c +@@ -54,6 +54,7 @@ static int family, try_nl = 1; + CHECK_IPV4(s, ret); \ + CHECK_PE(s, ret); + ++#ifdef LIBIPVS_USE_NL + #ifndef FALLBACK_LIBNL1 + static int nlerr2syserr(int err) + { +@@ -79,7 +80,6 @@ static int nlerr2syserr(int err) + } + #endif + +-#ifdef LIBIPVS_USE_NL + struct nl_msg *ipvs_nl_message(int cmd, int flags) + { + struct nl_msg *msg; +-- +1.8.1.4 + diff --git a/SOURCES/0002-fix-libnl-libnl-3-logic-in-configure-script.patch b/SOURCES/0002-fix-libnl-libnl-3-logic-in-configure-script.patch new file mode 100644 index 0000000..7cca210 --- /dev/null +++ b/SOURCES/0002-fix-libnl-libnl-3-logic-in-configure-script.patch @@ -0,0 +1,213 @@ +From b14b99adf4132eab1ecf8d1d4e83fadf5ada1076 Mon Sep 17 00:00:00 2001 +From: Ryan O'Hara +Date: Mon, 6 Jan 2014 11:21:03 -0600 +Subject: [PATCH 2/7] Fix libnl/libnl-3 logic in configure script + +This patch causes the configure script to prefer libnl-3 over +libnl(1). The configure script will first check for libnl-3 and +libnl-genl-3. If both are found, use them. If not, check for +libnl(1). This is useful when building on systems that have both +libnl-3 and libnl(1) installed. It also fixes some redundant libraries +in LIBS. +--- + configure | 103 ++++++++++++++++++++++++++++++----------------------------- + configure.in | 43 +++++++++++++------------ + 2 files changed, 74 insertions(+), 72 deletions(-) + +diff --git a/configure b/configure +index b35331f..be6574e 100755 +--- a/configure ++++ b/configure +@@ -3896,50 +3896,8 @@ else + as_fn_error $? "OpenSSL libraries are required" "$LINENO" 5 + fi + +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_socket_modify_cb in -lnl" >&5 +-$as_echo_n "checking for nl_socket_modify_cb in -lnl... " >&6; } +-if ${ac_cv_lib_nl_nl_socket_modify_cb+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- ac_check_lib_save_LIBS=$LIBS +-LIBS="-lnl $LIBS" +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ + +-/* Override any GCC internal prototype to avoid an error. +- Use char because int might match the return type of a GCC +- builtin and then its argument prototype would still apply. */ +-#ifdef __cplusplus +-extern "C" +-#endif +-char nl_socket_modify_cb (); +-int +-main () +-{ +-return nl_socket_modify_cb (); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_lib_nl_nl_socket_modify_cb=yes +-else +- ac_cv_lib_nl_nl_socket_modify_cb=no +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +-LIBS=$ac_check_lib_save_LIBS +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nl_nl_socket_modify_cb" >&5 +-$as_echo "$ac_cv_lib_nl_nl_socket_modify_cb" >&6; } +-if test "x$ac_cv_lib_nl_nl_socket_modify_cb" = xyes; then : +- +- USE_NL="LIBIPVS_USE_NL" +- CFLAGS="$CFLAGS -DFALLBACK_LIBNL1" +- LIBS="$LIBS -lnl" +- +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_socket_alloc in -lnl-3" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_socket_alloc in -lnl-3" >&5 + $as_echo_n "checking for nl_socket_alloc in -lnl-3... " >&6; } + if ${ac_cv_lib_nl_3_nl_socket_alloc+:} false; then : + $as_echo_n "(cached) " >&6 +@@ -3977,10 +3935,7 @@ fi + $as_echo "$ac_cv_lib_nl_3_nl_socket_alloc" >&6; } + if test "x$ac_cv_lib_nl_3_nl_socket_alloc" = xyes; then : + +- USE_NL="LIBIPVS_USE_NL" +- CFLAGS="$CFLAGS $(pkg-config --libs --cflags libnl-3.0)" +- LIBS="$LIBS -lnl-3" +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for genl_connect in -lnl-genl-3" >&5 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for genl_connect in -lnl-genl-3" >&5 + $as_echo_n "checking for genl_connect in -lnl-genl-3... " >&6; } + if ${ac_cv_lib_nl_genl_3_genl_connect+:} false; then : + $as_echo_n "(cached) " >&6 +@@ -4018,19 +3973,65 @@ fi + $as_echo "$ac_cv_lib_nl_genl_3_genl_connect" >&6; } + if test "x$ac_cv_lib_nl_genl_3_genl_connect" = xyes; then : + +- LIBS="$LIBS -lnl-3 -lnl-genl-3" ++ USE_NL="LIBIPVS_USE_NL" ++ CFLAGS="$CFLAGS $(pkg-config libnl-genl-3.0)" ++ LIBS="$LIBS $(pkg-config --libs libnl-genl-3.0)" ++ ++else ++ ++ as_fn_error $? "libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3." "$LINENO" 5 ++ ++fi ++ + + else + +- as_fn_error $? "libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3." "$LINENO" 5 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_socket_modify_cb in -lnl" >&5 ++$as_echo_n "checking for nl_socket_modify_cb in -lnl... " >&6; } ++if ${ac_cv_lib_nl_nl_socket_modify_cb+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lnl $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ + ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char nl_socket_modify_cb (); ++int ++main () ++{ ++return nl_socket_modify_cb (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_nl_nl_socket_modify_cb=yes ++else ++ ac_cv_lib_nl_nl_socket_modify_cb=no + fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nl_nl_socket_modify_cb" >&5 ++$as_echo "$ac_cv_lib_nl_nl_socket_modify_cb" >&6; } ++if test "x$ac_cv_lib_nl_nl_socket_modify_cb" = xyes; then : + ++ USE_NL="LIBIPVS_USE_NL" ++ CFLAGS="$CFLAGS -DFALLBACK_LIBNL1" ++ LIBS="$LIBS $(pkg-config --libs libnl-1)" + + else + +- USE_NL="LIBIPVS_DONTUSE_NL" +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: keepalived will be built without libnl support." >&5 ++ USE_NL="LIBIPVS_DONTUSE_NL" ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: keepalived will be built without libnl support." >&5 + $as_echo "$as_me: WARNING: keepalived will be built without libnl support." >&2;} + + fi +diff --git a/configure.in b/configure.in +index 3daf3ee..3d4a191 100644 +--- a/configure.in ++++ b/configure.in +@@ -55,29 +55,30 @@ dnl ----[ Checks for libraries ]---- + AC_CHECK_LIB(crypt, crypt,,AC_MSG_ERROR([crypt() function is required])) + 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(nl, nl_socket_modify_cb, ++ ++AC_CHECK_LIB(nl-3, nl_socket_alloc, + [ +- USE_NL="LIBIPVS_USE_NL" +- CFLAGS="$CFLAGS -DFALLBACK_LIBNL1" +- LIBS="$LIBS -lnl" ++ AC_CHECK_LIB(nl-genl-3, genl_connect, ++ [ ++ USE_NL="LIBIPVS_USE_NL" ++ CFLAGS="$CFLAGS $(pkg-config libnl-genl-3.0)" ++ LIBS="$LIBS $(pkg-config --libs libnl-genl-3.0)" ++ ], ++ [ ++ AC_MSG_ERROR([libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3.]) ++ ]) + ], +- [AC_CHECK_LIB(nl-3, nl_socket_alloc, +- [ +- USE_NL="LIBIPVS_USE_NL" +- CFLAGS="$CFLAGS $(pkg-config --libs --cflags libnl-3.0)" +- LIBS="$LIBS -lnl-3" +- AC_CHECK_LIB(nl-genl-3, genl_connect, +- [ +- LIBS="$LIBS -lnl-3 -lnl-genl-3" +- ], +- [ +- AC_MSG_ERROR([libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3.]) +- ]) +- ], +- [ +- USE_NL="LIBIPVS_DONTUSE_NL" +- AC_MSG_WARN([keepalived will be built without libnl support.]) +- ]) ++ [ ++ AC_CHECK_LIB(nl, nl_socket_modify_cb, ++ [ ++ USE_NL="LIBIPVS_USE_NL" ++ CFLAGS="$CFLAGS -DFALLBACK_LIBNL1" ++ LIBS="$LIBS $(pkg-config --libs libnl-1)" ++ ], ++ [ ++ USE_NL="LIBIPVS_DONTUSE_NL" ++ AC_MSG_WARN([keepalived will be built without libnl support.]) ++ ]) + ]) + + dnl ----[ Kernel version check ]---- +-- +1.8.1.4 + diff --git a/SOURCES/0003-libipvs-libnl-3-include-fix.patch b/SOURCES/0003-libipvs-libnl-3-include-fix.patch new file mode 100644 index 0000000..5a186ea --- /dev/null +++ b/SOURCES/0003-libipvs-libnl-3-include-fix.patch @@ -0,0 +1,93 @@ +From e2562e4bc40e6092d07e0e2ad8d43fdf9d79e463 Mon Sep 17 00:00:00 2001 +From: Alexandre Cassen +Date: Tue, 7 Jan 2014 08:37:22 +0100 +Subject: [PATCH 3/7] libipvs: libnl-3 include fix + +when libnl-3 is present use proper include path. On most system libnl-3 +include path is /usr/include/libnl3. +--- + configure | 4 ++++ + configure.in | 3 +++ + keepalived/libipvs-2.6/Makefile.in | 2 +- + 3 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index be6574e..90cca7d 100755 +--- a/configure ++++ b/configure +@@ -622,6 +622,7 @@ ac_includes_default="\ + ac_subst_vars='LTLIBOBJS + LIBOBJS + VRRP_SUPPORT ++INCLUDE_NL + USE_NL + IPVS_SUPPORT + VERSION_DATE +@@ -3976,6 +3977,7 @@ if test "x$ac_cv_lib_nl_genl_3_genl_connect" = xyes; then : + USE_NL="LIBIPVS_USE_NL" + CFLAGS="$CFLAGS $(pkg-config libnl-genl-3.0)" + LIBS="$LIBS $(pkg-config --libs libnl-genl-3.0)" ++ INCLUDE_NL="-I/usr/include/libnl3" + + else + +@@ -4027,6 +4029,7 @@ if test "x$ac_cv_lib_nl_nl_socket_modify_cb" = xyes; then : + USE_NL="LIBIPVS_USE_NL" + CFLAGS="$CFLAGS -DFALLBACK_LIBNL1" + LIBS="$LIBS $(pkg-config --libs libnl-1)" ++ INCLUDE_NL="" + + else + +@@ -4462,6 +4465,7 @@ fi + + + ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 + $as_echo_n "checking for an ANSI C-conforming const... " >&6; } + if ${ac_cv_c_const+:} false; then : +diff --git a/configure.in b/configure.in +index 3d4a191..364890d 100644 +--- a/configure.in ++++ b/configure.in +@@ -63,6 +63,7 @@ AC_CHECK_LIB(nl-3, nl_socket_alloc, + USE_NL="LIBIPVS_USE_NL" + CFLAGS="$CFLAGS $(pkg-config libnl-genl-3.0)" + LIBS="$LIBS $(pkg-config --libs libnl-genl-3.0)" ++ INCLUDE_NL="-I/usr/include/libnl3" + ], + [ + AC_MSG_ERROR([libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3.]) +@@ -74,6 +75,7 @@ AC_CHECK_LIB(nl-3, nl_socket_alloc, + USE_NL="LIBIPVS_USE_NL" + CFLAGS="$CFLAGS -DFALLBACK_LIBNL1" + LIBS="$LIBS $(pkg-config --libs libnl-1)" ++ INCLUDE_NL="" + ], + [ + USE_NL="LIBIPVS_DONTUSE_NL" +@@ -277,6 +279,7 @@ AC_SUBST(VERSION) + AC_SUBST(VERSION_DATE) + AC_SUBST(IPVS_SUPPORT) + AC_SUBST(USE_NL) ++AC_SUBST(INCLUDE_NL) + AC_SUBST(VRRP_SUPPORT) + + dnl ----[ Checks for typedefs, structures, and compiler characteristics ]---- +diff --git a/keepalived/libipvs-2.6/Makefile.in b/keepalived/libipvs-2.6/Makefile.in +index 14cfa95..dfefc7d 100644 +--- a/keepalived/libipvs-2.6/Makefile.in ++++ b/keepalived/libipvs-2.6/Makefile.in +@@ -1,7 +1,7 @@ + # Makefile for libipvs + + CC = @CC@ +-CFLAGS = @CFLAGS@ @CPPFLAGS@ -D@USE_NL@ -Wall -Wunused ++CFLAGS = @CFLAGS@ @CPPFLAGS@ @INCLUDE_NL@ -D@USE_NL@ -Wall -Wunused + + export OBJS += libipvs.a + +-- +1.8.1.4 + diff --git a/SOURCES/0004-lib-extend-command-lib-string-parser.patch b/SOURCES/0004-lib-extend-command-lib-string-parser.patch new file mode 100644 index 0000000..7dab0bb --- /dev/null +++ b/SOURCES/0004-lib-extend-command-lib-string-parser.patch @@ -0,0 +1,91 @@ +From dcdc2aeafb04d09b9d7ba412d8b417c9fd072c2a Mon Sep 17 00:00:00 2001 +From: Alexandre Cassen +Date: Tue, 7 Jan 2014 15:38:57 +0100 +Subject: [PATCH 4/7] lib: extend command lib string parser + +Extend cmd_make_strvec to support quoted string as a single slot and +commented string at the end of parsed string. +--- + lib/Makefile.in | 2 +- + lib/command.c | 34 +++++++++++++++++++++++----------- + 2 files changed, 24 insertions(+), 12 deletions(-) + +diff --git a/lib/Makefile.in b/lib/Makefile.in +index 9eb929e..ee4691f 100644 +--- a/lib/Makefile.in ++++ b/lib/Makefile.in +@@ -42,6 +42,6 @@ logger.o: logger.c logger.h + list_head.o: list_head.c list_head.h + buffer.o: buffer.c buffer.h memory.h + command.o: command.c command.h vector.h memory.h vty.h timer.h \ +- config.h ++ config.h logger.h + vty.o: vty.c vty.h scheduler.h timer.h utils.h command.h logger.h \ + memory.h +diff --git a/lib/command.c b/lib/command.c +index eff59de..4814594 100644 +--- a/lib/command.c ++++ b/lib/command.c +@@ -35,7 +35,7 @@ + #include "timer.h" + + /* Command vector which includes some level of command lists. Normally +- * each daemon maintains each own cmdvec. */ ++ * each daemon maintains its own cmdvec. */ + vector_t *cmdvec = NULL; + + desc_t desc_cr; +@@ -156,7 +156,9 @@ sort_node(void) + + /* Breaking up string into each command piece. I assume given + * character is separated by a space character. Return value is a +- * vector which includes char ** data element. */ ++ * vector which includes char ** data element. It supports ++ * quoted string as a single slot and commented string at ++ * the end of parsed string */ + vector_t * + cmd_make_strvec(const char *string) + { +@@ -187,20 +189,30 @@ cmd_make_strvec(const char *string) + /* Copy each command piece and set into vector. */ + while (1) { + start = cp; +- while (!(isspace((int) *cp) || *cp == '\r' || *cp == '\n') && +- *cp != '\0') ++ if (*cp == '"') { + cp++; +- strlen = cp - start; +- token = (char *) MALLOC(strlen + 1); +- memcpy(token, start, strlen); +- *(token + strlen) = '\0'; +- vector_set(strvec, token); ++ token = MALLOC(2); ++ *(token) = '"'; ++ *(token + 1) = '\0'; ++ } else { ++ while (!(isspace((int) *cp) || *cp == '\r' || *cp == '\n') && ++ *cp != '\0' && *cp != '"') ++ cp++; ++ strlen = cp - start; ++ token = (char *) MALLOC(strlen + 1); ++ memcpy(token, start, strlen); ++ *(token + strlen) = '\0'; ++ } ++ ++ /* Alloc & set the slot */ ++ vector_alloc_slot(strvec); ++ vector_set_slot(strvec, token); + +- while ((isspace ((int) *cp) || *cp == '\n' || *cp == '\r') && ++ while ((isspace((int) *cp) || *cp == '\n' || *cp == '\r') && + *cp != '\0') + cp++; + +- if (*cp == '\0') ++ if (*cp == '\0' || *cp == '!' || *cp == '#') + return strvec; + } + } +-- +1.8.1.4 + diff --git a/SOURCES/0005-lib-cosmetics-at-command.c.patch b/SOURCES/0005-lib-cosmetics-at-command.c.patch new file mode 100644 index 0000000..246b372 --- /dev/null +++ b/SOURCES/0005-lib-cosmetics-at-command.c.patch @@ -0,0 +1,309 @@ +From 8db312d415bab144c9e5b6fd41ced3c020fcaa82 Mon Sep 17 00:00:00 2001 +From: Alexandre Cassen +Date: Tue, 7 Jan 2014 15:58:12 +0100 +Subject: [PATCH 5/7] lib: cosmetics at command.c + +Extend command framework to support logger and remove some dead code. +some cosmetics too. +--- + lib/command.c | 86 +++++++++++++++++++++-------------------------------------- + lib/command.h | 24 +++++------------ + 2 files changed, 37 insertions(+), 73 deletions(-) + +diff --git a/lib/command.c b/lib/command.c +index 4814594..04079b5 100644 +--- a/lib/command.c ++++ b/lib/command.c +@@ -33,6 +33,7 @@ + #include "vty.h" + #include "command.h" + #include "timer.h" ++#include "logger.h" + + /* Command vector which includes some level of command lists. Normally + * each daemon maintains its own cmdvec. */ +@@ -310,8 +311,8 @@ cmd_make_descvec(const char *string, const char *descstr) + + if (*cp == '|') { + if (!multiple) { +- fprintf (stderr, "Command parse error!: %s\n", string); +- exit (1); ++ log_message(LOG_ERR, "Command parse error!: %s\n", string); ++ exit(1); + } + cp++; + } +@@ -407,9 +408,9 @@ install_element(node_type_t ntype, cmd_element_t *cmd) + cnode = vector_slot(cmdvec, ntype); + + if (cnode == NULL) { +- fprintf (stderr, "Command node %d doesn't exist, please check it\n", +- ntype); +- exit (1); ++ log_message(LOG_ERR, "Command node %d doesn't exist, please check it\n" ++ , ntype); ++ exit(1); + } + + vector_set(cnode->cmd_vector, cmd); +@@ -417,7 +418,7 @@ install_element(node_type_t ntype, cmd_element_t *cmd) + if (cmd->strvec == NULL) + cmd->strvec = cmd_make_descvec(cmd->string, cmd->doc); + +- cmd->cmdsize = cmd_cmdsize (cmd->strvec); ++ cmd->cmdsize = cmd_cmdsize(cmd->strvec); + } + + static const unsigned char itoa64[] = +@@ -489,9 +490,9 @@ config_write_host(vty_t *vty) + static vector_t * + cmd_node_vector(vector_t *v, node_type_t ntype) + { +- cmd_node_t *cnode = vector_slot(v, ntype); ++ cmd_node_t *cnode = vector_slot(v, ntype); + +- return cnode->cmd_vector; ++ return cnode->cmd_vector; + } + + /* Completion match types. */ +@@ -825,8 +826,8 @@ cmd_filter_by_completion(char *command, vector_t *v, unsigned int index) + + /* If command and cmd_element string does not match set NULL to vector */ + for (i = 0; i < vector_active (v); i++) { +- if ((cmd_element = vector_slot (v, i)) != NULL) { +- if (index >= vector_active (cmd_element->strvec)) { ++ if ((cmd_element = vector_slot(v, i)) != NULL) { ++ if (index >= vector_active(cmd_element->strvec)) { + vector_slot(v, i) = NULL; + } else { + unsigned int j; +@@ -911,12 +912,12 @@ cmd_filter_by_string(char *command, vector_t *v, unsigned int index) + match_type = no_match; + + /* If command and cmd_element string does not match set NULL to vector */ +- for (i = 0; i < vector_active (v); i++) { ++ for (i = 0; i < vector_active(v); i++) { + if ((cmd_element = vector_slot (v, i)) != NULL) { + /* If given index is bigger than max string vector of command, + * set NULL */ +- if (index >= vector_active (cmd_element->strvec)) { +- vector_slot (v, i) = NULL; ++ if (index >= vector_active(cmd_element->strvec)) { ++ vector_slot(v, i) = NULL; + } else { + unsigned int j; + int matched = 0; +@@ -1161,9 +1162,9 @@ cmd_unique_string(vector_t *v, const char *str) + unsigned int i; + char *match; + +- for (i = 0; i < vector_active (v); i++) { +- if ((match = vector_slot (v, i)) != NULL) { +- if (strcmp (match, str) == 0) { ++ for (i = 0; i < vector_active(v); i++) { ++ if ((match = vector_slot(v, i)) != NULL) { ++ if (strcmp(match, str) == 0) { + return 0; + } + } +@@ -1180,9 +1181,9 @@ desc_unique_string(vector_t *v, const char *str) + unsigned int i; + desc_t *desc; + +- for (i = 0; i < vector_active (v); i++) { +- if ((desc = vector_slot (v, i)) != NULL) { +- if (strcmp (desc->cmd, str) == 0) { ++ for (i = 0; i < vector_active(v); i++) { ++ if ((desc = vector_slot(v, i)) != NULL) { ++ if (strcmp(desc->cmd, str) == 0) { + return 1; + } + } +@@ -1418,7 +1419,7 @@ cmd_complete_command_real(vector_t *vline, vty_t *vty, int *status) + int ret; + + /* First try completion match, if there is exactly match return 1 */ +- match = cmd_filter_by_completion (command, cmd_vector, i); ++ match = cmd_filter_by_completion(command, cmd_vector, i); + + /* If there is exact match then filter ambiguous match else check + * ambiguousness. */ +@@ -1434,8 +1435,8 @@ cmd_complete_command_real(vector_t *vline, vty_t *vty, int *status) + matchvec = vector_init(INIT_MATCHVEC_SIZE); + + /* Now we got into completion */ +- for (i = 0; i < vector_active (cmd_vector); i++) { +- if ((cmd_element = vector_slot (cmd_vector, i))) { ++ for (i = 0; i < vector_active(cmd_vector); i++) { ++ if ((cmd_element = vector_slot(cmd_vector, i))) { + const char *string; + vector_t *strvec = cmd_element->strvec; + +@@ -1560,28 +1561,6 @@ cmd_complete_command(vector_t *vline, vty_t *vty, int *status) + node_type_t + node_parent(node_type_t node) + { +-#if 0 +- node_type_t ret; +- +- assert(node > CONFIG_NODE); +- +- switch (node) { +- case BGP_VPNV4_NODE: +- case BGP_IPV4_NODE: +- case BGP_IPV4M_NODE: +- case BGP_IPV6_NODE: +- case BGP_IPV6M_NODE: +- ret = BGP_NODE; +- break; +- case KEYCHAIN_KEY_NODE: +- ret = KEYCHAIN_NODE; +- break; +- default: +- ret = CONFIG_NODE; +- } +- +- return ret; +-#endif + return CONFIG_NODE; + } + +@@ -1628,8 +1607,8 @@ cmd_execute_command_real(vector_t *vline, vty_t *vty, cmd_element_t **cmd) + matched_count = 0; + incomplete_count = 0; + +- for (i = 0; i < vector_active (cmd_vector); i++) { +- if ((cmd_element = vector_slot (cmd_vector, i))) { ++ for (i = 0; i < vector_active(cmd_vector); i++) { ++ if ((cmd_element = vector_slot(cmd_vector, i))) { + if (match == vararg_match || index >= cmd_element->cmdsize) { + matched_element = cmd_element; + matched_count++; +@@ -1718,7 +1697,7 @@ cmd_execute_command(vector_t *vline, vty_t *vty, cmd_element_t **cmd, int vtysh) + } + + +- saved_ret = ret = cmd_execute_command_real (vline, vty, cmd); ++ saved_ret = ret = cmd_execute_command_real(vline, vty, cmd); + + if (vtysh) + return saved_ret; +@@ -1957,10 +1936,10 @@ DEFUN(config_exit, + } + + /* quit is alias of exit. */ +-ALIAS (config_exit, +- config_quit_cmd, +- "quit", +- "Exit current mode and down to previous mode\n") ++ALIAS(config_exit, ++ config_quit_cmd, ++ "quit", ++ "Exit current mode and down to previous mode\n") + + /* End of configuration. */ + DEFUN(config_end, +@@ -2038,7 +2017,7 @@ DEFUN(config_list, + + for (i = 0; i < vector_active (cnode->cmd_vector); i++) + if ((cmd = vector_slot (cnode->cmd_vector, i)) != NULL && +- !(cmd->attr == CMD_ATTR_DEPRECATED || cmd->attr == CMD_ATTR_HIDDEN)) ++ cmd->attr != CMD_ATTR_HIDDEN) + vty_out(vty, " %s%s", cmd->string, VTY_NEWLINE); + + return CMD_SUCCESS; +@@ -2612,7 +2591,6 @@ cmd_init(void) + install_element(VIEW_NODE, &config_terminal_no_length_cmd); + install_element(VIEW_NODE, &echo_cmd); + +-// install_element(ENABLE_NODE, &config_exit_cmd); + install_default(ENABLE_NODE); + install_element(ENABLE_NODE, &config_disable_cmd); + install_element(ENABLE_NODE, &config_terminal_cmd); +@@ -2626,8 +2604,6 @@ cmd_init(void) + install_element(ENABLE_NODE, &echo_cmd); + + install_default(CONFIG_NODE); +-// install_element(CONFIG_NODE, &config_exit_cmd); +- + + install_element(CONFIG_NODE, &hostname_cmd); + install_element(CONFIG_NODE, &no_hostname_cmd); +diff --git a/lib/command.h b/lib/command.h +index 34091a9..71191a1 100644 +--- a/lib/command.h ++++ b/lib/command.h +@@ -64,6 +64,7 @@ typedef enum _node_type { + + VTY_NODE, /* Vty node. */ + ++ GLOBAL_NODE, /* Global daemon commands. */ + CHECK_NODE, /* Checker framework commands. */ + VRRP_NODE, /* VRRP framework commands. */ + } node_type_t; +@@ -118,8 +119,7 @@ typedef struct _desc { + */ + + enum { +- CMD_ATTR_DEPRECATED = 1, +- CMD_ATTR_HIDDEN, ++ CMD_ATTR_HIDDEN = 1, + }; + + #define CMD_SUCCESS 0 +@@ -187,9 +187,6 @@ enum { + #define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) + +-#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ +- DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) +- + /* DEFUN_NOSH for commands that vtysh should ignore */ + #define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \ + DEFUN(funcname, cmdname, cmdstr, helpstr) +@@ -213,9 +210,6 @@ enum { + #define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) + +-#define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ +- DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) +- + /* ALIAS macro which define existing command's alias. */ + #define ALIAS(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) +@@ -226,27 +220,21 @@ enum { + #define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0) + +-#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ +- DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0) +- + #define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) + + #define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) + +-#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ +- DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon) +- + #define CMD_OPTION(S) ((S[0]) == '[') + #define CMD_VARIABLE(S) (((S[0]) >= 'A' && (S[0]) <= 'Z') || ((S[0]) == '<')) + #define CMD_VARARG(S) ((S[0]) == '.') + #define CMD_RANGE(S) ((S[0] == '<')) + +-#define CMD_IPV4(S) ((strcmp ((S), "A.B.C.D") == 0)) +-#define CMD_IPV4_PREFIX(S) ((strcmp ((S), "A.B.C.D/M") == 0)) +-#define CMD_IPV6(S) ((strcmp ((S), "X:X::X:X") == 0)) +-#define CMD_IPV6_PREFIX(S) ((strcmp ((S), "X:X::X:X/M") == 0)) ++#define CMD_IPV4(S) ((strcmp((S), "A.B.C.D") == 0)) ++#define CMD_IPV4_PREFIX(S) ((strcmp((S), "A.B.C.D/M") == 0)) ++#define CMD_IPV6(S) ((strcmp((S), "X:X::X:X") == 0)) ++#define CMD_IPV6_PREFIX(S) ((strcmp((S), "X:X::X:X/M") == 0)) + + /* Common descriptions. */ + #define SHOW_STR "Show running system information\n" +-- +1.8.1.4 + diff --git a/SOURCES/0006-lib-extend-vty-to-support-logger.patch b/SOURCES/0006-lib-extend-vty-to-support-logger.patch new file mode 100644 index 0000000..91835d5 --- /dev/null +++ b/SOURCES/0006-lib-extend-vty-to-support-logger.patch @@ -0,0 +1,157 @@ +From 8b6e812dcee8a54b4b6ad4116cb0782730079952 Mon Sep 17 00:00:00 2001 +From: Alexandre Cassen +Date: Tue, 7 Jan 2014 16:10:46 +0100 +Subject: [PATCH 6/7] lib: extend vty to support logger + +add support to logger and some cosmetics. +--- + lib/vty.c | 52 +++++++++++++++++++++++++--------------------------- + lib/vty.h | 2 +- + 2 files changed, 26 insertions(+), 28 deletions(-) + +diff --git a/lib/vty.c b/lib/vty.c +index e8c6dc6..b84b232 100644 +--- a/lib/vty.c ++++ b/lib/vty.c +@@ -1600,7 +1600,7 @@ vty_timeout(thread_t *thread) + } + + /* Read up configuration file from file_name. */ +-static void ++static int + vty_read_file(FILE *confp) + { + int ret; +@@ -1617,19 +1617,20 @@ vty_read_file(FILE *confp) + if (!((ret == CMD_SUCCESS) || (ret == CMD_ERR_NOTHING_TODO))) { + switch (ret) { + case CMD_ERR_AMBIGUOUS: +- fprintf(stderr, "Ambiguous command.\n"); ++ log_message(LOG_ERR, "Ambiguous command.\n"); + break; + case CMD_ERR_NO_MATCH: +- fprintf(stderr, "There is no such command.\n"); ++ log_message(LOG_ERR, "There is no such command.\n"); + break; + } +- fprintf(stderr, "Error occured during reading below line.\n%s\n" +- , vty->buf); ++ log_message(LOG_ERR, "Error occured during reading below line.\n%s\n" ++ , vty->buf); + vty_close(vty); +- exit(1); ++ return -1; + } + + vty_close(vty); ++ return 0; + } + + static FILE * +@@ -1703,7 +1704,7 @@ vty_use_backup_config(char *fullpath) + } + + /* Read up configuration file from file_name. */ +-void ++int + vty_read_config(char *config_file, char *config_default_dir) + { + char cwd[MAXPATHLEN]; +@@ -1717,9 +1718,9 @@ vty_read_config(char *config_file, char *config_default_dir) + if (!IS_DIRECTORY_SEP(config_file[0])) { + retpath = getcwd(cwd, MAXPATHLEN); + if (!retpath) { +- fprintf(stderr, "%s: failed to get current working directory: %s\n" +- , __func__, strerror(errno)); +- exit(1); ++ log_message(LOG_ERR, "%s: failed to get current working directory: %s\n" ++ , __func__, strerror(errno)); ++ return -1; + } + tmp = MALLOC(strlen(cwd) + strlen(config_file) + 2); + sprintf(tmp, "%s/%s", cwd, config_file); +@@ -1731,32 +1732,32 @@ vty_read_config(char *config_file, char *config_default_dir) + confp = fopen(fullpath, "r"); + + if (confp == NULL) { +- fprintf(stderr, "%s: failed to open configuration file %s: %s\n" +- , __func__, fullpath, strerror (errno)); ++ log_message(LOG_ERR, "%s: failed to open configuration file %s: %s\n" ++ , __func__, fullpath, strerror (errno)); + + confp = vty_use_backup_config(fullpath); + if (confp) { +- fprintf(stderr, "WARNING: using backup configuration file!\n"); ++ log_message(LOG_ERR, "WARNING: using backup configuration file!\n"); + } else { +- fprintf(stderr, "can't open configuration file [%s]\n" +- , config_file); +- exit(1); ++ log_message(LOG_ERR, "can't open configuration file [%s]\n" ++ , config_file); ++ return -1; + } + } + } else { + confp = fopen(config_default_dir, "r"); + if (confp == NULL) { +- fprintf(stderr, "%s: failed to open configuration file %s: %s\n" +- , __func__, config_default_dir, strerror(errno)); ++ log_message(LOG_ERR, "%s: failed to open configuration file %s: %s\n" ++ , __func__, config_default_dir, strerror(errno)); + + confp = vty_use_backup_config(config_default_dir); + if (confp) { +- fprintf(stderr, "WARNING: using backup configuration file!\n"); ++ log_message(LOG_ERR, "WARNING: using backup configuration file!\n"); + fullpath = config_default_dir; + } else { +- fprintf(stderr, "can't open configuration file [%s]\n" +- , config_default_dir); +- exit (1); ++ log_message(LOG_ERR, "can't open configuration file [%s]\n" ++ , config_default_dir); ++ return -1; + } + } else { + fullpath = config_default_dir; +@@ -1764,12 +1765,10 @@ vty_read_config(char *config_file, char *config_default_dir) + } + + vty_read_file(confp); +- + fclose(confp); +- + host_config_set(fullpath); +- + FREE_PTR(tmp); ++ return 0; + } + + int +@@ -2038,8 +2037,7 @@ vty_config_write(vty_t *vty) + return CMD_SUCCESS; + } + +-cmd_node_t vty_node = +-{ ++cmd_node_t vty_node = { + VTY_NODE, + "%s(config-line)# ", + 1, +diff --git a/lib/vty.h b/lib/vty.h +index 6134ad3..2c4b44f 100644 +--- a/lib/vty.h ++++ b/lib/vty.h +@@ -181,7 +181,7 @@ extern int vty_listen(struct sockaddr_storage *); + extern void vty_reset(void); + extern vty_t *vty_new(void); + extern int vty_out(vty_t *, const char *, ...) PRINTF_ATTRIBUTE(2, 3); +-extern void vty_read_config(char *, char *); ++extern int vty_read_config(char *, char *); + extern void vty_time_print(vty_t *, int); + extern void vty_serv_sock(const char *, unsigned short, const char *); + extern void vty_close(vty_t *); +-- +1.8.1.4 + diff --git a/SOURCES/0007-autoconf-better-libnl3-detection.patch b/SOURCES/0007-autoconf-better-libnl3-detection.patch new file mode 100644 index 0000000..14d9ce6 --- /dev/null +++ b/SOURCES/0007-autoconf-better-libnl3-detection.patch @@ -0,0 +1,99 @@ +From cba49f220eff2025771da9aab766188ceb66c5bf Mon Sep 17 00:00:00 2001 +From: Alexandre Cassen +Date: Tue, 7 Jan 2014 16:21:58 +0100 +Subject: [PATCH 7/7] autoconf: better libnl3 detection + +use pkg-config facilities to append CFLAGS related instead of hardcoding +libnl3 path in configure script. +--- + configure | 6 +----- + configure.in | 5 +---- + keepalived/libipvs-2.6/Makefile.in | 2 +- + 3 files changed, 3 insertions(+), 10 deletions(-) + +diff --git a/configure b/configure +index 90cca7d..66ce48c 100755 +--- a/configure ++++ b/configure +@@ -622,7 +622,6 @@ ac_includes_default="\ + ac_subst_vars='LTLIBOBJS + LIBOBJS + VRRP_SUPPORT +-INCLUDE_NL + USE_NL + IPVS_SUPPORT + VERSION_DATE +@@ -3975,9 +3974,8 @@ $as_echo "$ac_cv_lib_nl_genl_3_genl_connect" >&6; } + if test "x$ac_cv_lib_nl_genl_3_genl_connect" = xyes; then : + + USE_NL="LIBIPVS_USE_NL" +- CFLAGS="$CFLAGS $(pkg-config libnl-genl-3.0)" ++ CFLAGS="$CFLAGS $(pkg-config --cflags libnl-genl-3.0)" + LIBS="$LIBS $(pkg-config --libs libnl-genl-3.0)" +- INCLUDE_NL="-I/usr/include/libnl3" + + else + +@@ -4029,7 +4027,6 @@ if test "x$ac_cv_lib_nl_nl_socket_modify_cb" = xyes; then : + USE_NL="LIBIPVS_USE_NL" + CFLAGS="$CFLAGS -DFALLBACK_LIBNL1" + LIBS="$LIBS $(pkg-config --libs libnl-1)" +- INCLUDE_NL="" + + else + +@@ -4465,7 +4462,6 @@ fi + + + +- + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 + $as_echo_n "checking for an ANSI C-conforming const... " >&6; } + if ${ac_cv_c_const+:} false; then : +diff --git a/configure.in b/configure.in +index 364890d..7d97616 100644 +--- a/configure.in ++++ b/configure.in +@@ -61,9 +61,8 @@ AC_CHECK_LIB(nl-3, nl_socket_alloc, + AC_CHECK_LIB(nl-genl-3, genl_connect, + [ + USE_NL="LIBIPVS_USE_NL" +- CFLAGS="$CFLAGS $(pkg-config libnl-genl-3.0)" ++ CFLAGS="$CFLAGS $(pkg-config --cflags libnl-genl-3.0)" + LIBS="$LIBS $(pkg-config --libs libnl-genl-3.0)" +- INCLUDE_NL="-I/usr/include/libnl3" + ], + [ + AC_MSG_ERROR([libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3.]) +@@ -75,7 +74,6 @@ AC_CHECK_LIB(nl-3, nl_socket_alloc, + USE_NL="LIBIPVS_USE_NL" + CFLAGS="$CFLAGS -DFALLBACK_LIBNL1" + LIBS="$LIBS $(pkg-config --libs libnl-1)" +- INCLUDE_NL="" + ], + [ + USE_NL="LIBIPVS_DONTUSE_NL" +@@ -279,7 +277,6 @@ AC_SUBST(VERSION) + AC_SUBST(VERSION_DATE) + AC_SUBST(IPVS_SUPPORT) + AC_SUBST(USE_NL) +-AC_SUBST(INCLUDE_NL) + AC_SUBST(VRRP_SUPPORT) + + dnl ----[ Checks for typedefs, structures, and compiler characteristics ]---- +diff --git a/keepalived/libipvs-2.6/Makefile.in b/keepalived/libipvs-2.6/Makefile.in +index dfefc7d..14cfa95 100644 +--- a/keepalived/libipvs-2.6/Makefile.in ++++ b/keepalived/libipvs-2.6/Makefile.in +@@ -1,7 +1,7 @@ + # Makefile for libipvs + + CC = @CC@ +-CFLAGS = @CFLAGS@ @CPPFLAGS@ @INCLUDE_NL@ -D@USE_NL@ -Wall -Wunused ++CFLAGS = @CFLAGS@ @CPPFLAGS@ -D@USE_NL@ -Wall -Wunused + + export OBJS += libipvs.a + +-- +1.8.1.4 + diff --git a/SPECS/keepalived.spec b/SPECS/keepalived.spec index d6db158..545de43 100644 --- a/SPECS/keepalived.spec +++ b/SPECS/keepalived.spec @@ -1,6 +1,6 @@ %bcond_without snmp -%bcond_without sha1 %bcond_without vrrp +%bcond_without sha1 %bcond_with profile %bcond_with debug @@ -8,8 +8,8 @@ Name: keepalived Summary: High Availability monitor built upon LVS, VRRP and service pollers -Version: 1.2.8 -Release: 1%{?dist} +Version: 1.2.10 +Release: 2%{?dist} License: GPLv2+ URL: http://www.keepalived.org/ Group: System Environment/Daemons @@ -17,6 +17,14 @@ Group: System Environment/Daemons Source0: http://www.keepalived.org/software/keepalived-%{version}.tar.gz Source1: keepalived.service +Patch1: 0001-ipvs-make-nlerr2syserr-libnl-dependent.patch +Patch2: 0002-fix-libnl-libnl-3-logic-in-configure-script.patch +Patch3: 0003-libipvs-libnl-3-include-fix.patch +Patch4: 0004-lib-extend-command-lib-string-parser.patch +Patch5: 0005-lib-cosmetics-at-command.c.patch +Patch6: 0006-lib-extend-vty-to-support-logger.patch +Patch7: 0007-autoconf-better-libnl3-detection.patch + Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -27,7 +35,7 @@ BuildRequires: net-snmp-devel %endif BuildRequires: systemd-units BuildRequires: openssl-devel -BuildRequires: libnl-devel +BuildRequires: libnl3-devel BuildRequires: kernel-devel BuildRequires: popt-devel @@ -47,6 +55,13 @@ infrastructures. %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 %build %configure \ @@ -102,6 +117,15 @@ rm -rf %{buildroot} %{_mandir}/man8/keepalived.8* %changelog +* Fri Jan 24 2014 Daniel Mach - 1.2.10-2 +- Mass rebuild 2014-01-24 + +* Tue Jan 14 2014 Ryan O'Hara - 1.2.10-1 +- Rebase to upstream version 1.2.10 (#1052359) + +* Fri Dec 27 2013 Daniel Mach - 1.2.8-2 +- Mass rebuild 2013-12-27 + * Thu Sep 05 2013 Ryan O'Hara - 1.2.8-1 - Update to 1.2.8.