Hello community, here is the log from the commit of package keepalived for openSUSE:Factory checked in at 2018-02-22 15:03:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/keepalived (Old) and /work/SRC/openSUSE:Factory/.keepalived.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "keepalived" Thu Feb 22 15:03:34 2018 rev:21 rq:578944 version:1.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/keepalived/keepalived.changes 2018-01-22 16:22:25.110989062 +0100 +++ /work/SRC/openSUSE:Factory/.keepalived.new/keepalived.changes 2018-02-22 15:03:38.587420084 +0100 @@ -1,0 +2,66 @@ +Thu Feb 22 10:07:17 UTC 2018 - [email protected] + +- add linux-4.15.patch + +------------------------------------------------------------------- +Wed Feb 21 14:52:29 UTC 2018 - [email protected] + +- update to 1.4.1: + * Improve and fix use of getopt_long(). + We musn't use a long option val of 1, since getopt_long() can return + that value. + getopt_long() also returns longindex == 0 when there is no matching + long option, and there needs to be careful checking if there is an + error to work out whether a long or short option was used, which is + needed for meaningful error messages. + * Write assert() messages to syslog. + assert()s are nasty things, but at least let's get the benefit of + them, and write the messages to syslog, rather than losing them down + stderr. + * Enable sorry server at startup if quorum down due to alpha mode + If alpha mode is configured on sufficient checkers so that a + virtual server doesn't have a quorum, we need to add the sorry + server at startup, otherwise it won't be added until a quorum has + been achieved and subsequently lost again. In the case where some + of the checkers remain in the down state at startup, this would have + meant that the sorry server never got added. + * For virtual servers, ensure quorum <= number of real servers + If the quorum were gigher than the number of real servers, the + quorum for the real server to come up could never be achieved, so + if the quorum is greater than the number of real servers, reduce it + to the number of real servers. + * Fix some SNMP keepalived checker integer types and default values. + Some virtual server and real server values were being sent to SNMP + with a signed type whereas the value is unsigned, so set the type + field correctly. + Some virtual server and real server values that apply to checkers + are set to nonsense default values in order to determine if a + value has been specified. Handle these values when reporting them + to SNMP replying with 0 rather than a nonsense value. + * Fix some MALLOC/FREE issues with notify FIFOs. + * Add instance_name/config_id to alert emails' subjects if configured. + If multiple instances of keepalived are running, either different + instance_names and/or config_ids, it is useful to know which + keepalived instance the email relates to. + * Ensure that email body string isn't unterminated. + Using strncpy() needs to ensure that there is a nul termination byte, + so this commits adds always writing a nul byte to the end of the buffer. + * Remove duplicate fault notification. + * Fix problem with scripts found via PATH with a '/' in parameters. + Recent discussions on issue #101 led to discovering that if an + executable without a fully qualified name was specified as a script + and there was a '/' character in the parameters, then the path + resolution would not work. + * Send SNMP traps when go from backup to fault due to sync group. + Commit 020a9ab added executing notify_fault for vrrp instances + transitioning from backup to fault state due to another instance + in the sync group going to fault state. This commit adds sending + SNMP traps in the same circumstance. + * Revert "Add instance_name/config_id to alert emails' subjects if + configured". This should be handled by setting router_id + * Add config option to send smtp-alerts to file rather than send emails + This is useful for debugging purposes. + * Add additional entry to Travis-CI build matrix. + * Fix segfault if no sorry server configured for a virtual server. + +------------------------------------------------------------------- Old: ---- keepalived-1.4.0.tar.gz New: ---- keepalived-1.4.1.tar.gz linux-4.15.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ keepalived.spec ++++++ --- /var/tmp/diff_new_pack.yYoZsP/_old 2018-02-22 15:03:41.099329038 +0100 +++ /var/tmp/diff_new_pack.yYoZsP/_new 2018-02-22 15:03:41.103328894 +0100 @@ -30,15 +30,17 @@ %bcond_with json Name: keepalived -Version: 1.4.0 +Version: 1.4.1 Release: 0 Summary: A keepalive facility for Linux License: GPL-2.0+ Group: Productivity/Networking/Routing Url: http://www.keepalived.org/ -Source: %{name}-%{version}.tar.gz +Source: http://www.keepalived.org/software/%{name}-%{version}.tar.gz Source2: keepalive-rpmlintrc Patch1: keepalive-init.patch +# PATCH-FIX-UPSTREAM: https://github.com/acassen/keepalived/commit/947248af144bcab6376ccddab8dc40f313b14281.patch +Patch2: linux-4.15.patch BuildRequires: libnfnetlink-devel %if %{with json} BuildRequires: libjson-c-devel @@ -94,6 +96,7 @@ %prep %setup -q %patch1 -p1 +%patch2 -p1 chmod 644 doc/samples/* %build ++++++ keepalived-1.4.0.tar.gz -> keepalived-1.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/ChangeLog new/keepalived-1.4.1/ChangeLog --- old/keepalived-1.4.0/ChangeLog 2017-12-29 18:41:40.000000000 +0100 +++ new/keepalived-1.4.1/ChangeLog 2018-01-27 11:26:07.000000000 +0100 @@ -1,3 +1,86 @@ +2018-01-27 Alexandre Cassen <[email protected]> + * keepalived-1.4.1 released. + * Improve and fix use of getopt_long(). + We musn't use a long option val of 1, since getopt_long() can return + that value. + getopt_long() also returns longindex == 0 when there is no matching + long option, and there needs to be careful checking if there is an + error to work out whether a long or short option was used, which is + needed for meaningful error messages. + * Write assert() messages to syslog. + assert()s are nasty things, but at least let's get the benefit of + them, and write the messages to syslog, rather than losing them down + stderr. + * Enable sorry server at startup if quorum down due to alpha mode + If alpha mode is configured on sufficient checkers so that a + virtual server doesn't have a quorum, we need to add the sorry + server at startup, otherwise it won't be added until a quorum has + been achieved and subsequently lost again. In the case where some + of the checkers remain in the down state at startup, this would have + meant that the sorry server never got added. + * For virtual servers, ensure quorum <= number of real servers + If the quorum were gigher than the number of real servers, the + quorum for the real server to come up could never be achieved, so + if the quorum is greater than the number of real servers, reduce it + to the number of real servers. + * Fix some SNMP keepalived checker integer types and default values. + Some virtual server and real server values were being sent to SNMP + with a signed type whereas the value is unsigned, so set the type + field correctly. + Some virtual server and real server values that apply to checkers + are set to nonsense default values in order to determine if a + value has been specified. Handle these values when reporting them + to SNMP replying with 0 rather than a nonsense value. + * Fix some MALLOC/FREE issues with notify FIFOs. + * Add instance_name/config_id to alert emails' subjects if configured. + If multiple instances of keepalived are running, either different + instance_names and/or config_ids, it is useful to know which + keepalived instance the email relates to. + * Ensure that email body string isn't unterminated. + Using strncpy() needs to ensure that there is a nul termination byte, + so this commits adds always writing a nul byte to the end of the buffer. + * Remove duplicate fault notification. + * Fix problem with scripts found via PATH with a '/' in parameters. + Recent discussions on issue #101 led to discovering that if an + executable without a fully qualified name was specified as a script + and there was a '/' character in the parameters, then the path + resolution would not work. + * Send SNMP traps when go from backup to fault due to sync group. + Commit 020a9ab added executing notify_fault for vrrp instances + transitioning from backup to fault state due to another instance + in the sync group going to fault state. This commit adds sending + SNMP traps in the same circumstance. + * Revert "Add instance_name/config_id to alert emails' subjects if + configured". This should be handled by setting router_id + * Add config option to send smtp-alerts to file rather than send emails + This is useful for debugging purposes. + * Add additional entry to Travis-CI build matrix. + * Fix segfault if no sorry server configured for a virtual server. + Issue #751 identified a segfault in vs_end_handler(), and it + transpires that the forwarding method of the sorry server was being + checked without first testing that a sorry server had been configured. + * Improve the log message when a master receives higher priority advert. + The log message reported in issue #754 + "VRRP_Instance(VI_1) Received advert with higher priority 253, ours 253" + is somewhat misleading since 253 == 253. + This commit improves the log message in this case be reporting that + the sender's IP address is higher and the priority is equal. It also + states the it was a master receiving the advert. + * First stage of making --enable-debug work + Issue #582 identified that compiling with --enable-debug produced + an executable that didn't work. + This commit largely makes that option work, but there needs to be + more work to make signals work. + * Generalise handling of signals. + * Don't assume json header files are in /usr/include/json-c + Use pkg-config to find the location of the json header files + when testing for the presence of the header files in configure. + * Add file updated by configure.ac change. + * Log more helpful message when healthchecker activated or suspended + Include the realserver in the log message + * Fix building with musl libc. + * fix spelling mistakes about keyword promote_secondaries in man page. + 2017-12-29 Alexandre Cassen <[email protected]> * keepalived-1.4.0 released. * Add Linux build and runtime versions to -v output. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/configure new/keepalived-1.4.1/configure --- old/keepalived-1.4.0/configure 2017-12-29 19:00:58.000000000 +0100 +++ new/keepalived-1.4.1/configure 2018-01-27 11:29:10.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Keepalived 1.4.0. +# Generated by GNU Autoconf 2.69 for Keepalived 1.4.1. # # Report bugs to <[email protected]>. # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='Keepalived' PACKAGE_TARNAME='keepalived' -PACKAGE_VERSION='1.4.0' -PACKAGE_STRING='Keepalived 1.4.0' +PACKAGE_VERSION='1.4.1' +PACKAGE_STRING='Keepalived 1.4.1' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='http://www.keepalived.org/' @@ -832,6 +832,7 @@ enable_mem_check enable_mem_check_log enable_debug +enable_smtp_alert_debug enable_stacktrace enable_profile enable_conversion_checks @@ -1403,7 +1404,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Keepalived 1.4.0 to adapt to many kinds of systems. +\`configure' configures Keepalived 1.4.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1470,7 +1471,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Keepalived 1.4.0:";; + short | recursive ) echo "Configuration of Keepalived 1.4.1:";; esac cat <<\_ACEOF @@ -1523,6 +1524,8 @@ --enable-mem-check compile with memory alloc checking --enable-mem-check-log compile with memory alloc checking writing to syslog --enable-debug compile with debugging flags + --enable-smtp-alert-debug + compile with smtp-alert debugging --enable-stacktrace compile with stacktrace support --enable-profile compile with profiling flags --enable-conversion-checks @@ -1628,7 +1631,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Keepalived configure 1.4.0 +Keepalived configure 1.4.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2284,7 +2287,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Keepalived $as_me 1.4.0, which was +It was created by Keepalived $as_me 1.4.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3147,7 +3150,7 @@ # Define the identity of the package. PACKAGE='keepalived' - VERSION='1.4.0' + VERSION='1.4.1' cat >>confdefs.h <<_ACEOF @@ -3586,6 +3589,11 @@ enableval=$enable_debug; fi +# Check whether --enable-smtp-alert-debug was given. +if test "${enable_smtp_alert_debug+set}" = set; then : + enableval=$enable_smtp_alert_debug; +fi + # Check whether --enable-stacktrace was given. if test "${enable_stacktrace+set}" = set; then : enableval=$enable_stacktrace; @@ -6526,6 +6534,31 @@ done +# glibc uses unsigned int as 3rd parameter to __assert_fail(), musl uses int. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <assert.h> + #include <stdlib.h> + + void __assert_fail(const char * a, const char *b, unsigned int l, const char *c) + { + exit(a[0] + b[0] + c[0] + l == 0); + } + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + LINE_type="unsigned int" +else + LINE_type="int" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +cat >>confdefs.h <<_ACEOF +#define LINE_type $LINE_type +_ACEOF + + if test -n "$enable_dynamic_linking"; then enable_libiptc_dynamic=$enable_dynamic_linking enable_libipset_dynamic=$enable_dynamic_linking @@ -9301,20 +9334,24 @@ CPPFLAGS="$SAV_CPPFLAGS" if test "${enable_json}" = yes; then - for ac_header in json-c/json.h + JSON_HEADERS=$($PKG_CONFIG --cflags-only-I json-c) + SAV_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $JSON_HEADERS" + for ac_header in json.h do : - ac_fn_c_check_header_mongrel "$LINENO" "json-c/json.h" "ac_cv_header_json_c_json_h" "$ac_includes_default" -if test "x$ac_cv_header_json_c_json_h" = xyes; then : + ac_fn_c_check_header_mongrel "$LINENO" "json.h" "ac_cv_header_json_h" "$ac_includes_default" +if test "x$ac_cv_header_json_h" = xyes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_JSON_C_JSON_H 1 +#define HAVE_JSON_H 1 _ACEOF else - as_fn_error $? "unable to find json-c/json.h" "$LINENO" 5 + as_fn_error $? "unable to find json.h" "$LINENO" 5 fi done + CPPFLAGS="$SAV_CPPFLAGS" $as_echo "#define _WITH_JSON_ 1 " >>confdefs.h @@ -10300,6 +10337,16 @@ fi +if test "${enable_smtp_alert_debug}" = yes; then + +$as_echo "#define _SMTP_ALERT_DEBUG_ 1 " >>confdefs.h + + ENABLE_SMTP_ALERT_DEBUG=Yes + BUILD_OPTIONS="$BUILD_OPTIONS SMTP_ALERT_DEBUG" +else + ENABLE_SMTP_ALERT_DEBUG=No +fi + if test "${enable_stacktrace}" = yes; then $as_echo "#define _WITH_STACKTRACE_ 1 " >>confdefs.h @@ -11072,7 +11119,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Keepalived $as_me 1.4.0, which was +This file was extended by Keepalived $as_me 1.4.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11139,7 +11186,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Keepalived config.status 1.4.0 +Keepalived config.status 1.4.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -12052,6 +12099,7 @@ fi echo "SHA1 support : ${SHA1_SUPPORT}" echo "Use Debug flags : ${ENABLE_DEBUG}" +echo "smtp-alert debugging : ${ENABLE_SMTP_ALERT_DEBUG}" echo "Use Json output : ${ENABLE_JSON}" echo "Stacktrace support : ${ENABLE_STACKTRACE}" echo "Memory alloc check : ${MEM_CHECK}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/configure.ac new/keepalived-1.4.1/configure.ac --- old/keepalived-1.4.0/configure.ac 2017-12-29 18:58:25.000000000 +0100 +++ new/keepalived-1.4.1/configure.ac 2018-01-27 11:27:37.000000000 +0100 @@ -88,7 +88,7 @@ dnl ----[ Process this file with autoconf to produce a configure script ]---- AC_PREREQ([2.63]) -AC_INIT([Keepalived], [1.4.0], [[email protected]], [], [http://www.keepalived.org/]) +AC_INIT([Keepalived], [1.4.1], [[email protected]], [], [http://www.keepalived.org/]) AM_INIT_AUTOMAKE([-Wall -Werror -Woverride foreign]) AC_CONFIG_SRCDIR([keepalived/core/main.c]) @@ -186,6 +186,8 @@ [AS_HELP_STRING([--enable-mem-check-log], [compile with memory alloc checking writing to syslog])]) AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [compile with debugging flags])]) +AC_ARG_ENABLE(smtp-alert-debug, + [AS_HELP_STRING([--enable-smtp-alert-debug], [compile with smtp-alert debugging])]) AC_ARG_ENABLE(stacktrace, [AS_HELP_STRING([--enable-stacktrace], [compile with stacktrace support])]) AC_ARG_ENABLE(profile, @@ -374,6 +376,19 @@ dnl - pipe2() since Linux 2.6.27 and glibc 2.9. AC_CHECK_FUNCS([pipe2], [add_build_opt([PIPE2])]) +# glibc uses unsigned int as 3rd parameter to __assert_fail(), musl uses int. +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #include <assert.h> + #include <stdlib.h> + + void __assert_fail(const char * a, const char *b, unsigned int l, const char *c) + { + exit(a[0] + b[0] + c[0] + l == 0); + } + ]])], + [LINE_type="unsigned int"], [LINE_type="int"]) +AC_DEFINE_UNQUOTED([LINE_type], [ $LINE_type ], [The type of parameter __line passed to __assert_fail()]) + dnl - Do we want to override dynamic/static linking? if test -n "$enable_dynamic_linking"; then enable_libiptc_dynamic=$enable_dynamic_linking @@ -990,7 +1005,11 @@ dnl ----[ Json output or not ? ]---- if test "${enable_json}" = yes; then - AC_CHECK_HEADERS(json-c/json.h,,AC_MSG_ERROR([unable to find json-c/json.h])) + JSON_HEADERS=$($PKG_CONFIG --cflags-only-I json-c) + SAV_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $JSON_HEADERS" + AC_CHECK_HEADERS(json.h,,AC_MSG_ERROR([unable to find json.h])) + CPPFLAGS="$SAV_CPPFLAGS" AC_DEFINE([_WITH_JSON_], [ 1 ], [Define to 1 to build with json output support]) add_pkg_config([json-c]) ENABLE_JSON=Yes @@ -1339,6 +1358,15 @@ fi AM_CONDITIONAL([DEBUG], [test $ENABLE_DEBUG = Yes]) +dnl ----[ smtp-alert debugging or not ? ]---- +if test "${enable_smtp_alert_debug}" = yes; then + AC_DEFINE([_SMTP_ALERT_DEBUG_], [ 1 ], [Define to 1 to build with smtp-alert debugging support]) + ENABLE_SMTP_ALERT_DEBUG=Yes + add_build_opt([SMTP_ALERT_DEBUG]) +else + ENABLE_SMTP_ALERT_DEBUG=No +fi + dnl ----[ Stacktrace support or not ? ]---- if test "${enable_stacktrace}" = yes; then AC_DEFINE([_WITH_STACKTRACE_], [ 1 ], [Define to 1 to build with stacktrace support]) @@ -1457,6 +1485,7 @@ fi echo "SHA1 support : ${SHA1_SUPPORT}" echo "Use Debug flags : ${ENABLE_DEBUG}" +echo "smtp-alert debugging : ${ENABLE_SMTP_ALERT_DEBUG}" echo "Use Json output : ${ENABLE_JSON}" echo "Stacktrace support : ${ENABLE_STACKTRACE}" echo "Memory alloc check : ${MEM_CHECK}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/doc/man/man5/keepalived.conf.5 new/keepalived-1.4.1/doc/man/man5/keepalived.conf.5 --- old/keepalived-1.4.0/doc/man/man5/keepalived.conf.5 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/doc/man/man5/keepalived.conf.5 2018-01-27 11:17:28.000000000 +0100 @@ -672,7 +672,7 @@ # For example if 10.1.1.2/24 and 10.1.1.3/24 are both configured on an # interface, and one is removed, unless promote_secondaries is set on # the interface the other address will also be removed. - prompte_secondaries + promote_secondaries # routes add|del when changing to MASTER, to BACKUP. # See static_routes for more details diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/check/check_api.c new/keepalived-1.4.1/keepalived/check/check_api.c --- old/keepalived-1.4.0/keepalived/check/check_api.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/check/check_api.c 2018-01-27 11:17:28.000000000 +0100 @@ -563,9 +563,9 @@ } if ((!(checker->vs->ha_suspend_addr_count)) == checker->enabled) { - log_message(LOG_INFO, "%sing healthchecker for service %s", + log_message(LOG_INFO, "%sing healthchecker for service %s for VS %s", !checker->enabled ? "Activat" : "Suspend", - FMT_VS(checker->vs)); + FMT_RS(checker->rs, checker->vs), FMT_VS(checker->vs)); checker->enabled = enable; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/check/check_daemon.c new/keepalived-1.4.1/keepalived/check/check_daemon.c --- old/keepalived-1.4.0/keepalived/check/check_daemon.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/check/check_daemon.c 2018-01-27 11:17:28.000000000 +0100 @@ -209,6 +209,7 @@ register_checkers_thread(); } +#ifndef _DEBUG_ /* Reload thread */ static int reload_check_thread(__attribute__((unused)) thread_t * thread) @@ -280,7 +281,6 @@ } /* CHECK Child respawning thread */ -#ifndef _DEBUG_ static int check_respawn_thread(thread_t * thread) { @@ -385,12 +385,18 @@ */ UNSET_RELOAD; +#ifndef _DEBUG_ /* Signal handling initialization */ check_signal_init(); +#endif /* Start Healthcheck daemon */ start_check(NULL); +#ifdef _DEBUG_ + return 0; +#endif + /* Launch the scheduling I/O multiplexer */ launch_scheduler(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/check/check_data.c new/keepalived-1.4.1/keepalived/check/check_data.c --- old/keepalived-1.4.0/keepalived/check/check_data.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/check/check_data.c 2018-01-27 11:17:28.000000000 +0100 @@ -618,6 +618,13 @@ continue; } + /* Check that the quorum isn't higher than the number of real servers, + * otherwise we will never be able to come up. */ + if (vs->quorum > LIST_SIZE(vs->rs)) { + log_message(LOG_INFO, "Warning - quorum %1$d for %2$s exceeds number of real servers %3$d, reducing quorum to %3$d", vs->quorum, FMT_VS(vs), LIST_SIZE(vs->rs)); + vs->quorum = LIST_SIZE(vs->rs); + } + /* Ensure that no virtual server hysteresis >= quorum */ if (vs->hysteresis >= vs->quorum) { log_message(LOG_INFO, "Virtual server %s: hysteresis %u >= quorum %u; setting hysteresis to %u", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/check/check_parser.c new/keepalived-1.4.1/keepalived/check/check_parser.c --- old/keepalived-1.4.0/keepalived/check/check_parser.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/check/check_parser.c 2018-01-27 11:17:28.000000000 +0100 @@ -120,7 +120,7 @@ /* If the real (sorry) server uses tunnel forwarding, the address family * does not have to match the address family of the virtaul server */ - if (vs->s_svr->forwarding_method != IP_VS_CONN_F_TUNNEL) { + if (vs->s_svr && vs->s_svr->forwarding_method != IP_VS_CONN_F_TUNNEL) { if (vs->af == AF_UNSPEC) vs->af = vs->s_svr->addr.ss_family; else if (vs->af != vs->s_svr->addr.ss_family) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/check/check_snmp.c new/keepalived-1.4.1/keepalived/check/check_snmp.c --- old/keepalived-1.4.0/keepalived/check/check_snmp.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/check/check_snmp.c 2018-01-27 11:17:28.000000000 +0100 @@ -668,13 +668,13 @@ long_ret.u = v->inhibit?2:1; return (u_char*)&long_ret; case CHECK_SNMP_VSRETRY: - long_ret.u = v->retry; + long_ret.u = v->retry == UINT_MAX ? 0 : v->retry; return (u_char*)&long_ret; case CHECK_SNMP_VSDELAYBEFORERETRY: - long_ret.u = v->delay_before_retry / TIMER_HZ; + long_ret.u = v->delay_before_retry == ULONG_MAX ? 0 : v->delay_before_retry / TIMER_HZ; return (u_char*)&long_ret; case CHECK_SNMP_VSWARMUP: - long_ret.u = v->warmup / TIMER_HZ; + long_ret.u = v->warmup == ULONG_MAX ? 0 : v->warmup / TIMER_HZ; return (u_char*)&long_ret; case CHECK_SNMP_VSWEIGHT: long_ret.s = v->weight; @@ -1035,16 +1035,16 @@ long_ret.u = be->alpha?1:2; return (u_char*)&long_ret; case CHECK_SNMP_RSRETRY: - long_ret.u = be->retry; + long_ret.u = be->retry == UINT_MAX ? 0 : be->retry; return (u_char*)&long_ret; case CHECK_SNMP_RSDELAYBEFORERETRY: - long_ret.u = be->delay_before_retry / TIMER_HZ; + long_ret.u = be->delay_before_retry == ULONG_MAX ? 0 : be->delay_before_retry / TIMER_HZ; return (u_char*)&long_ret; case CHECK_SNMP_RSWARMUP: - long_ret.u = be->warmup / TIMER_HZ; + long_ret.u = be->warmup == ULONG_MAX ? 0 : be->warmup / TIMER_HZ; return (u_char*)&long_ret; case CHECK_SNMP_RSDELAYLOOP: - long_ret.u = be->delay_loop / TIMER_HZ; + long_ret.u = be->delay_loop == ULONG_MAX ? 0 : be->delay_loop / TIMER_HZ; return (u_char*)&long_ret; default: return NULL; @@ -1283,11 +1283,11 @@ check_snmp_virtualserver, 3, {3, 1, 55}}, {CHECK_SNMP_VSACTIONWHENDOWN, ASN_INTEGER, RONLY, check_snmp_virtualserver, 3, {3, 1, 56}}, - {CHECK_SNMP_VSRETRY, ASN_INTEGER, RONLY, + {CHECK_SNMP_VSRETRY, ASN_UNSIGNED, RONLY, check_snmp_virtualserver, 3, {3, 1, 57}}, - {CHECK_SNMP_VSDELAYBEFORERETRY, ASN_INTEGER, RONLY, + {CHECK_SNMP_VSDELAYBEFORERETRY, ASN_UNSIGNED, RONLY, check_snmp_virtualserver, 3, {3, 1, 58}}, - {CHECK_SNMP_VSWARMUP, ASN_INTEGER, RONLY, + {CHECK_SNMP_VSWARMUP, ASN_UNSIGNED, RONLY, check_snmp_virtualserver, 3, {3, 1, 59}}, {CHECK_SNMP_VSWEIGHT, ASN_INTEGER, RONLY, check_snmp_virtualserver, 3, {3, 1, 60}}, @@ -1371,19 +1371,19 @@ {CHECK_SNMP_RSRATEOUTBPSHIGH, ASN_UNSIGNED, RONLY, check_snmp_realserver, 3, {4, 1, 39}}, #endif - {CHECK_SNMP_RSLOADBALANCINGKIND, ASN_UNSIGNED, RONLY, + {CHECK_SNMP_RSLOADBALANCINGKIND, ASN_INTEGER, RONLY, check_snmp_realserver, 3, {4, 1, 40}}, {CHECK_SNMP_RSVIRTUALHOST, ASN_OCTET_STR, RONLY, check_snmp_realserver, 3, {4, 1, 41}}, {CHECK_SNMP_RSALPHA, ASN_INTEGER, RONLY, check_snmp_realserver, 3, {4, 1, 42}}, - {CHECK_SNMP_RSRETRY, ASN_INTEGER, RONLY, + {CHECK_SNMP_RSRETRY, ASN_UNSIGNED, RONLY, check_snmp_realserver, 3, {4, 1, 43}}, - {CHECK_SNMP_RSDELAYBEFORERETRY, ASN_INTEGER, RONLY, + {CHECK_SNMP_RSDELAYBEFORERETRY, ASN_UNSIGNED, RONLY, check_snmp_realserver, 3, {4, 1, 44}}, - {CHECK_SNMP_RSWARMUP, ASN_INTEGER, RONLY, + {CHECK_SNMP_RSWARMUP, ASN_UNSIGNED, RONLY, check_snmp_realserver, 3, {4, 1, 45}}, - {CHECK_SNMP_RSDELAYLOOP, ASN_INTEGER, RONLY, + {CHECK_SNMP_RSDELAYLOOP, ASN_UNSIGNED, RONLY, check_snmp_realserver, 3, {4, 1, 46}}, #ifdef _WITH_VRRP_ /* LVS sync daemon configuration */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/check/ipwrapper.c new/keepalived-1.4.1/keepalived/check/ipwrapper.c --- old/keepalived-1.4.0/keepalived/check/ipwrapper.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/check/ipwrapper.c 2018-01-27 11:17:28.000000000 +0100 @@ -320,7 +320,7 @@ /* set quorum state depending on current weight of real servers */ static void -update_quorum_state(virtual_server_t * vs) +update_quorum_state(virtual_server_t * vs, bool init) { long weight_sum = weigh_live_realservers(vs); long up_threshold = vs->quorum + vs->hysteresis; @@ -360,13 +360,18 @@ #endif return; } - else if (vs->quorum_state_up && - (!weight_sum || weight_sum < down_threshold)) { + else if ((vs->quorum_state_up && + (!weight_sum || weight_sum < down_threshold)) || + (init && !vs->quorum_state_up && + vs->s_svr && !ISALIVE(vs->s_svr))) { /* We have just lost quorum for the VS, we need to consider * VS notify_down and sorry_server cases + * or + * We are starting up and need to add the sorry server */ vs->quorum_state_up = false; - log_message(LOG_INFO, "Lost quorum %u-%u=%ld > %ld for VS %s" + log_message(LOG_INFO, "%s %u-%u=%ld > %ld for VS %s" + , init ? "Starting with quorum down" : "Lost quorum" , vs->quorum , vs->hysteresis , down_threshold @@ -443,7 +448,7 @@ /* We may have changed quorum state. If the quorum wasn't up * but is now up, this is where the rs is added. */ - update_quorum_state(vs); + update_quorum_state(vs, false); return true; } @@ -469,7 +474,7 @@ /* we may have got/lost quorum due to quorum setting changed */ /* also update, in case we need the sorry server in alpha mode */ - update_quorum_state(vs); + update_quorum_state(vs, true); return true; } @@ -513,7 +518,7 @@ (vs->quorum_state_up || !vs->s_svr || !ISALIVE(vs->s_svr))) ipvs_cmd(LVS_CMD_EDIT_DEST, vs, rs); if (update_quorum) - update_quorum_state(vs); + update_quorum_state(vs, false); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/core/global_data.c new/keepalived-1.4.1/keepalived/core/global_data.c --- old/keepalived-1.4.0/keepalived/core/global_data.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/core/global_data.c 2018-01-27 11:17:28.000000000 +0100 @@ -243,8 +243,7 @@ log_message(LOG_INFO, "notify FIFO %s has been specified for global and vrrp FIFO - ignoring vrrp FIFO", data->vrrp_notify_fifo.name); FREE_PTR(data->vrrp_notify_fifo.name); data->vrrp_notify_fifo.name = NULL; - FREE_PTR(data->vrrp_notify_fifo.script); - data->vrrp_notify_fifo.script = NULL; + free_notify_script(&data->vrrp_notify_fifo.script); } #endif #ifdef _WITH_LVS_ @@ -259,8 +258,7 @@ log_message(LOG_INFO, "notify FIFO %s has been specified for global and LVS FIFO - ignoring LVS FIFO", data->lvs_notify_fifo.name); FREE_PTR(data->lvs_notify_fifo.name); data->lvs_notify_fifo.name = NULL; - FREE_PTR(data->lvs_notify_fifo.script); - data->lvs_notify_fifo.script = NULL; + free_notify_script(&data->lvs_notify_fifo.script); } #ifdef _WITH_VRRP_ @@ -271,15 +269,12 @@ data->lvs_notify_fifo.script && data->vrrp_notify_fifo.script) { log_message(LOG_INFO, "LVS notify FIFO and vrrp FIFO are the same both with scripts - ignoring LVS FIFO script"); - FREE_PTR(data->lvs_notify_fifo.script); - data->lvs_notify_fifo.script = NULL; + free_notify_script(&data->lvs_notify_fifo.script); } /* If there is a script for global notify FIFO, it must only be run once, so let VRRP run it */ - if (data->notify_fifo.script) { - FREE_PTR(data->notify_fifo.script); - data->notify_fifo.script = NULL; - } + if (data->notify_fifo.script) + free_notify_script(&data->notify_fifo.script); #endif } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/core/global_parser.c new/keepalived-1.4.1/keepalived/core/global_parser.c --- old/keepalived-1.4.0/keepalived/core/global_parser.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/core/global_parser.c 2018-01-27 11:17:28.000000000 +0100 @@ -552,7 +552,7 @@ return; } - fifo->name = MALLOC(strlen(strvec_slot(strvec, 1) + 1)); + fifo->name = MALLOC(strlen(strvec_slot(strvec, 1)) + 1); strcpy(fifo->name, strvec_slot(strvec, 1)); } static void @@ -570,7 +570,7 @@ return; } - id_str = MALLOC(strlen(type) + strlen("notify_fifo")); + id_str = MALLOC(strlen(type) + strlen("notify_fifo") + 1); strcpy(id_str, type); strcat(id_str, "notify_fifo"); fifo->script = notify_script_init(strvec, id_str, global_data->script_security); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/core/main.c new/keepalived-1.4.1/keepalived/core/main.c --- old/keepalived-1.4.0/keepalived/core/main.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/core/main.c 2018-01-27 11:17:28.000000000 +0100 @@ -597,6 +597,9 @@ bool reopen_log = false; int signum; struct utsname uname_buf; + int longindex; + int curind; + bool bad_option = false; struct option long_options[] = { {"use-file", required_argument, NULL, 'f'}, @@ -641,14 +644,18 @@ {"namespace", required_argument, NULL, 's'}, #endif {"config-id", required_argument, NULL, 'i'}, - {"signum", required_argument, NULL, 1 }, + {"signum", required_argument, NULL, 4 }, {"version", no_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0 } }; - while ((c = getopt_long(argc, argv, "vhlndDRS:f:p:i:mMg:G" + /* Unfortunately, if a short option is used, getopt_long() doesn't change the value + * of longindex, so we need to ensure that before calling getopt_long(), longindex + * is set to a know invalid value */ + curind = optind; + while (longindex = -1, (c = getopt_long(argc, argv, ":vhlndDRS:f:p:i:mM::g::G" #if defined _WITH_VRRP_ && defined _WITH_LVS_ "PC" #endif @@ -667,7 +674,15 @@ #if HAVE_DECL_CLONE_NEWNET "s:" #endif - , long_options, NULL)) != EOF) { + , long_options, &longindex)) != -1) { + + /* Check for an empty option argument. For example --use-file= returns + * a 0 length option, which we don't want */ + if (longindex >= 0 && long_options[longindex].has_arg == required_argument && optarg && !optarg[0]) { + c = ':'; + optarg = NULL; + } + switch (c) { case 'v': fprintf(stderr, "%s", version_string); @@ -798,7 +813,7 @@ config_id = MALLOC(strlen(optarg) + 1); strcpy(config_id, optarg); break; - case 1: /* --signum */ + case 4: /* --signum */ signum = get_signum(optarg); if (signum == -1) { fprintf(stderr, "Unknown sigfunc %s\n", optarg); @@ -808,10 +823,25 @@ printf("%d\n", signum); exit(0); break; + case '?': + if (optopt && argv[curind][1] != '-') + fprintf(stderr, "Unknown option -%c\n", optopt); + else + fprintf(stderr, "Unknown option --%s\n", argv[curind]); + bad_option = true; + break; + case ':': + if (optopt && argv[curind][1] != '-') + fprintf(stderr, "Missing parameter for option -%c\n", optopt); + else + fprintf(stderr, "Missing parameter for option --%s\n", long_options[longindex].name); + bad_option = true; + break; default: - exit(0); + exit(1); break; } + curind = optind; } if (optind < argc) { @@ -821,6 +851,9 @@ printf("\n"); } + if (bad_option) + exit(1); + return reopen_log; } @@ -1062,10 +1095,8 @@ /* Init daemon */ start_keepalived(); -#ifndef _DEBUG_ /* Launch the scheduling I/O multiplexer */ launch_scheduler(); -#endif /* Finish daemon process */ stop_keepalived(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/core/smtp.c new/keepalived-1.4.1/keepalived/core/smtp.c --- old/keepalived-1.4.0/keepalived/core/smtp.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/core/smtp.c 2018-01-27 11:17:28.000000000 +0100 @@ -660,9 +660,33 @@ else snprintf(smtp->subject, MAX_HEADERS_LENGTH, "%s", subject); - strncpy(smtp->body, body, MAX_BODY_LENGTH); + strncpy(smtp->body, body, MAX_BODY_LENGTH - 1); + smtp->body[MAX_BODY_LENGTH - 1]= '\0'; + build_to_header_rcpt_addrs(smtp); +#ifdef _SMTP_ALERT_DEBUG_ + FILE *fp = fopen("/tmp/smtp-alert.log", "a"); + struct tm tm; + char time_buf[25]; + int time_buf_len; + + localtime_r(&time_now.tv_sec, &tm); + time_buf_len = strftime(time_buf, sizeof time_buf, "%a %b %e %X %Y", &tm); + + fprintf(fp, "%s: %s -> %s\n" + "%*sSubject: %s\n" + "%*sBody: %s\n\n", + time_buf, global_data->email_from, smtp->email_to, + time_buf_len - 7, "", smtp->subject, + time_buf_len - 7, "", smtp->body); + + fclose(fp); + + free_smtp_all(smtp); + return; +#endif + smtp_connect(smtp); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/vrrp/vrrp.c new/keepalived-1.4.1/keepalived/vrrp/vrrp.c --- old/keepalived-1.4.0/keepalived/vrrp/vrrp.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/vrrp/vrrp.c 2018-01-27 11:17:28.000000000 +0100 @@ -1727,8 +1727,12 @@ (hd->priority == vrrp->effective_priority && addr_cmp > 0)) { - log_message(LOG_INFO, "VRRP_Instance(%s) Received advert with higher priority %d, ours %d" - , vrrp->iname, hd->priority, vrrp->effective_priority); + if (hd->priority > vrrp->effective_priority) + log_message(LOG_INFO, "VRRP_Instance(%s) Master received advert with higher priority %d, ours %d" + , vrrp->iname, hd->priority, vrrp->effective_priority); + else + log_message(LOG_INFO, "VRRP_Instance(%s) Master received advert with same priority %d but higher IP address than ours (%s)" + , vrrp->iname, hd->priority, inet_sockaddrtos(&vrrp->pkt_saddr)); #ifdef _WITH_VRRP_AUTH_ if (proto == IPPROTO_IPSEC_AH) { ah = (ipsec_ah_t *) (buf + sizeof(struct iphdr)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/vrrp/vrrp_daemon.c new/keepalived-1.4.1/keepalived/vrrp/vrrp_daemon.c --- old/keepalived-1.4.0/keepalived/vrrp/vrrp_daemon.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/vrrp/vrrp_daemon.c 2018-01-27 11:17:28.000000000 +0100 @@ -79,7 +79,9 @@ #ifdef _WITH_JSON_ static int print_vrrp_json(thread_t * thread); #endif +#ifndef _DEBUG_ static int reload_vrrp_thread(thread_t * thread); +#endif static char *vrrp_syslog_ident; @@ -349,6 +351,7 @@ VRRP_DISPATCHER); } +#ifndef _DEBUG_ static void sighup_vrrp(__attribute__((unused)) void *v, __attribute__((unused)) int sig) { @@ -466,6 +469,7 @@ return 0; } +#endif static int print_vrrp_data(__attribute__((unused)) thread_t * thread) @@ -598,8 +602,10 @@ */ UNSET_RELOAD; +#ifndef _DEBUG_ /* Signal handling initialization */ vrrp_signal_init(); +#endif #ifdef _LIBNL_DYNAMIC_ libnl_init(); @@ -608,6 +614,10 @@ /* Start VRRP daemon */ start_vrrp(); +#ifdef _DEBUG_ + return 0; +#endif + /* Launch the scheduling I/O multiplexer */ launch_scheduler(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/vrrp/vrrp_scheduler.c new/keepalived-1.4.1/keepalived/vrrp/vrrp_scheduler.c --- old/keepalived-1.4.0/keepalived/vrrp/vrrp_scheduler.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/vrrp/vrrp_scheduler.c 2018-01-27 11:17:28.000000000 +0100 @@ -789,7 +789,6 @@ notify_instance_exec(vrrp, VRRP_STATE_FAULT); vrrp->state = VRRP_STATE_FAULT; vrrp->ms_down_timer = 3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp); - notify_instance_exec(vrrp, VRRP_STATE_FAULT); #ifdef _WITH_SNMP_VRRP_ vrrp_snmp_instance_trap(vrrp); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/keepalived/vrrp/vrrp_sync.c new/keepalived-1.4.1/keepalived/vrrp/vrrp_sync.c --- old/keepalived-1.4.0/keepalived/vrrp/vrrp_sync.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/keepalived/vrrp/vrrp_sync.c 2018-01-27 11:17:28.000000000 +0100 @@ -315,8 +315,13 @@ if (isync != vrrp && isync->state != VRRP_STATE_FAULT) { if (isync->state == VRRP_STATE_MAST) isync->wantstate = VRRP_STATE_GOTO_FAULT; - if (isync->state == VRRP_STATE_BACK) + if (isync->state == VRRP_STATE_BACK) { isync->state = VRRP_STATE_FAULT; + notify_instance_exec(isync, VRRP_STATE_FAULT); +#ifdef _WITH_SNMP_VRRP_ + vrrp_snmp_instance_trap(isync); +#endif + } } } vgroup->state = VRRP_STATE_FAULT; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/Makefile.am new/keepalived-1.4.1/lib/Makefile.am --- old/keepalived-1.4.0/lib/Makefile.am 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/lib/Makefile.am 2018-01-27 11:17:28.000000000 +0100 @@ -17,6 +17,7 @@ liblib_a_SOURCES = memory.c utils.c notify.c timer.c scheduler.c \ vector.c list.c html.c parser.c signals.c logger.c rttables.c \ + assert.c \ bitops.h timer.h scheduler.h rttables.h vector.h parser.h \ signals.h notify.h logger.h list.h memory.h html.h utils.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/Makefile.in new/keepalived-1.4.1/lib/Makefile.in --- old/keepalived-1.4.0/lib/Makefile.in 2017-12-29 19:00:58.000000000 +0100 +++ new/keepalived-1.4.1/lib/Makefile.in 2018-01-27 11:29:10.000000000 +0100 @@ -115,7 +115,7 @@ notify.$(OBJEXT) timer.$(OBJEXT) scheduler.$(OBJEXT) \ vector.$(OBJEXT) list.$(OBJEXT) html.$(OBJEXT) \ parser.$(OBJEXT) signals.$(OBJEXT) logger.$(OBJEXT) \ - rttables.$(OBJEXT) + rttables.$(OBJEXT) assert.$(OBJEXT) am__EXTRA_liblib_a_SOURCES_DIST = old_socket.c old_socket.h liblib_a_OBJECTS = $(am_liblib_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) @@ -295,6 +295,7 @@ noinst_LIBRARIES = liblib.a liblib_a_SOURCES = memory.c utils.c notify.c timer.c scheduler.c \ vector.c list.c html.c parser.c signals.c logger.c rttables.c \ + assert.c \ bitops.h timer.h scheduler.h rttables.h vector.h parser.h \ signals.h notify.h logger.h list.h memory.h html.h utils.h @@ -365,6 +366,7 @@ distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/html.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logger.Po@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/assert.c new/keepalived-1.4.1/lib/assert.c --- old/keepalived-1.4.0/lib/assert.c 1970-01-01 01:00:00.000000000 +0100 +++ new/keepalived-1.4.1/lib/assert.c 2018-01-27 11:17:28.000000000 +0100 @@ -0,0 +1,49 @@ +/* + * Soft: Keepalived is a failover program for the LVS project + * <www.linuxvirtualserver.org>. It monitor & manipulate + * a loadbalanced server pool using multi-layer checks. + * + * Part: assert facility. + * + * Author: Alexandre Cassen, <[email protected]> + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Copyright (C) 2018-2018 Alexandre Cassen, <[email protected]> + */ +#include "config.h" + +#ifndef NDEBUG + +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +#include "logger.h" + +/* This prints an "Assertion failed" message and aborts. */ +void __assert_fail (const char *__assertion, const char *__file, + LINE_type __line, const char *__function) +{ + log_message(LOG_ERR, "assert: %s:%d: %s: Assertion: `%s' failed.", __file, __line, __function, __assertion); + abort(); +} + +#ifdef __USE_GNU +/* Likewise, but prints the error text for ERRNUM. */ +void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) +{ + log_message(LOG_ERR, "assert: %s:%d: %s: Unexpected error: %s.", __file, __line, __function, strerror(__errnum)); + abort(); +} +#endif +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/config.h.in new/keepalived-1.4.1/lib/config.h.in --- old/keepalived-1.4.0/lib/config.h.in 2017-12-29 19:01:07.000000000 +0100 +++ new/keepalived-1.4.1/lib/config.h.in 2018-01-27 11:29:19.000000000 +0100 @@ -200,8 +200,8 @@ /* Define to 1 if ipset supports iface type */ #undef HAVE_IPSET_ATTR_IFACE -/* Define to 1 if you have the <json-c/json.h> header file. */ -#undef HAVE_JSON_C_JSON_H +/* Define to 1 if you have the <json.h> header file. */ +#undef HAVE_JSON_H /* Define to 1 if you have the `crypto' library (-lcrypto). */ #undef HAVE_LIBCRYPTO @@ -477,6 +477,9 @@ /* Define to 1 if libipvs can use netlink */ #undef LIBIPVS_USE_NL +/* The type of parameter __line passed to __assert_fail() */ +#undef LINE_type + /* Define to 1 if <linux/netlink.h> needs <sys/socket.h> */ #undef NETLINK_H_NEEDS_SYS_SOCKET_H @@ -587,6 +590,9 @@ /* Define to 1 to log malloc/free checks to syslog */ #undef _MEM_CHECK_LOG_ +/* Define to 1 to build with smtp-alert debugging support */ +#undef _SMTP_ALERT_DEBUG_ + /* Define to 1 to have keepalived send RFC6257 SNMP responses for VRRPv2 instances */ #undef _SNMP_REPLY_V3_FOR_V2_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/git-commit.h new/keepalived-1.4.1/lib/git-commit.h --- old/keepalived-1.4.0/lib/git-commit.h 2017-12-29 19:01:07.000000000 +0100 +++ new/keepalived-1.4.1/lib/git-commit.h 2018-01-27 11:29:19.000000000 +0100 @@ -1,2 +1,2 @@ -#define GIT_DATE "12/29,2017" -#define GIT_YEAR "2017" +#define GIT_DATE "01/27,2018" +#define GIT_YEAR "2018" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/notify.c new/keepalived-1.4.1/lib/notify.c --- old/keepalived-1.4.0/lib/notify.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/lib/notify.c 2018-01-27 11:17:28.000000000 +0100 @@ -635,6 +635,7 @@ { int flags; char *space = NULL; + char *slash; int ret; struct stat file_buf; bool need_script_protection = false; @@ -652,7 +653,12 @@ if (!script) return 0; - if (!strchr(script->name, '/')) { + if (!full_string) + space = strchr(script->name, ' '); + + slash = strchr(script->name, '/'); + if (!slash || + (space && space < slash)) { /* It is a bare file name, so do a path search */ if ((ret = find_path(script, full_string))) { if (ret == EACCES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/notify.h new/keepalived-1.4.1/lib/notify.h --- old/keepalived-1.4.0/lib/notify.h 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/lib/notify.h 2018-01-27 11:17:28.000000000 +0100 @@ -76,6 +76,7 @@ return; FREE_PTR((*script)->name); FREE_PTR(*script); + *script = NULL; } /* Global variables */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/scheduler.c new/keepalived-1.4.1/lib/scheduler.c --- old/keepalived-1.4.0/lib/scheduler.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/lib/scheduler.c 2018-01-27 11:17:28.000000000 +0100 @@ -761,7 +761,8 @@ exceptfd = m->exceptfd; signal_fd = signal_rfd(); - FD_SET(signal_fd, &readfd); + if (signal_fd != -1) + FD_SET(signal_fd, &readfd); #ifdef _WITH_SNMP_ /* When SNMP is enabled, we may have to select() on additional @@ -782,6 +783,12 @@ /* we have to save errno here because the next syscalls will set it */ old_errno = errno; + if (ret < 0 && old_errno != EINTR) { + /* Real error. */ + DBG("select error: %s", strerror(old_errno)); + assert(0); + } + /* Handle SNMP stuff */ #ifdef _WITH_SNMP_ if (ret > 0) @@ -797,12 +804,6 @@ /* Update current time */ set_time_now(); - if (ret < 0 && old_errno != EINTR) { - /* Real error. */ - DBG("select error: %s", strerror(old_errno)); - assert(0); - } - /* Timeout children */ thread = m->child.head; while (thread) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/keepalived-1.4.0/lib/signals.c new/keepalived-1.4.1/lib/signals.c --- old/keepalived-1.4.0/lib/signals.c 2017-12-29 18:21:03.000000000 +0100 +++ new/keepalived-1.4.1/lib/signals.c 2018-01-27 11:17:28.000000000 +0100 @@ -49,24 +49,35 @@ #include "../keepalived/include/vrrp_json.h" #endif -/* Local Vars */ -static void (*signal_SIGHUP_handler) (void *, int sig); -static void *signal_SIGHUP_v; -static void (*signal_SIGINT_handler) (void *, int sig); -static void *signal_SIGINT_v; -static void (*signal_SIGTERM_handler) (void *, int sig); -static void *signal_SIGTERM_v; -static void (*signal_SIGCHLD_handler) (void *, int sig); -static void *signal_SIGCHLD_v; -static void (*signal_SIGUSR1_handler) (void *, int sig); -static void *signal_SIGUSR1_v; -static void (*signal_SIGUSR2_handler) (void *, int sig); -static void *signal_SIGUSR2_v; #ifdef _WITH_JSON_ -static void (*signal_SIGJSON_handler) (void *, int sig); -static void *signal_SIGJSON_v; + /* We need to include the realtime signals, but + * unfortunately SIGRTMIN/SIGRTMAX are not constants. + * I'm not clear if _NSIG is always defined, so play safe. + * Although we are not meant to use __SIGRTMAX, we are + * using it here as an upper bound, which is eather different. */ + #ifdef _NSIG + #define SIG_MAX _NSIG + #elif defined __SIGRTMAX + #define SIG_MAX __SIGRTMAX + #else + #define SIG_MAX 64 + #endif +#else + /* The signals currently used are HUP, INT, TERM, USR1, + * USR2 and CHLD. */ + #if SIGCHLD > SIGUSR2 + /* Architectures except alpha and sparc - see signal(7) */ + #define SIG_MAX SIGCHLD + #else + /* alpha and sparc */ + #define SIG_MAX SIGUSR2 + #endif #endif +/* Local Vars */ +static void (*signal_handler_func[SIG_MAX]) (void *, int sig); +static void *signal_v[SIG_MAX]; + static int signal_pipe[2] = { -1, -1 }; /* Remember our initial signal disposition */ @@ -138,6 +149,11 @@ struct sigaction sig; struct sigaction osig; + if (signo < 1 || signo > SIG_MAX) { + log_message(LOG_INFO, "Invalid signal number %d passed to signal_set(). Max signal is %d", signo, SIG_MAX); + return NULL; + } + if (func == (void*)SIG_IGN || func == (void*)SIG_DFL) { sig.sa_handler = (void*)func; @@ -168,40 +184,8 @@ ret = sigaction(signo, &sig, &osig); - switch(signo) { - case SIGHUP: - signal_SIGHUP_handler = func; - signal_SIGHUP_v = v; - break; - case SIGINT: - signal_SIGINT_handler = func; - signal_SIGINT_v = v; - break; - case SIGTERM: - signal_SIGTERM_handler = func; - signal_SIGTERM_v = v; - break; - case SIGCHLD: - signal_SIGCHLD_handler = func; - signal_SIGCHLD_v = v; - break; - case SIGUSR1: - signal_SIGUSR1_handler = func; - signal_SIGUSR1_v = v; - break; - case SIGUSR2: - signal_SIGUSR2_handler = func; - signal_SIGUSR2_v = v; - break; -#ifdef _WITH_JSON_ - default: - if (signo == SIGJSON) { - signal_SIGJSON_handler = func; - signal_SIGJSON_v = v; - break; - } -#endif - } + signal_handler_func[signo-1] = func; + signal_v[signo-1] = v; if (ret < 0) return (SIG_ERR); @@ -223,15 +207,10 @@ static void clear_signal_handler_addresses(void) { - signal_SIGHUP_handler = NULL; - signal_SIGINT_handler = NULL; - signal_SIGTERM_handler = NULL; - signal_SIGCHLD_handler = NULL; - signal_SIGUSR1_handler = NULL; - signal_SIGUSR2_handler = NULL; -#ifdef _WITH_JSON_ - signal_SIGJSON_handler = NULL; -#endif + int i; + + for (i = 0; i < SIG_MAX; i++) + signal_handler_func[i] = NULL; } /* Handlers intialization */ @@ -385,41 +364,8 @@ int sig; while(read(signal_pipe[0], &sig, sizeof(int)) == sizeof(int)) { - switch(sig) { - case SIGHUP: - if (signal_SIGHUP_handler) - signal_SIGHUP_handler(signal_SIGHUP_v, SIGHUP); - break; - case SIGINT: - if (signal_SIGINT_handler) - signal_SIGINT_handler(signal_SIGINT_v, SIGINT); - break; - case SIGTERM: - if (signal_SIGTERM_handler) - signal_SIGTERM_handler(signal_SIGTERM_v, SIGTERM); - break; - case SIGCHLD: - if (signal_SIGCHLD_handler) - signal_SIGCHLD_handler(signal_SIGCHLD_v, SIGCHLD); - break; - case SIGUSR1: - if (signal_SIGUSR1_handler) - signal_SIGUSR1_handler(signal_SIGUSR1_v, SIGUSR1); - break; - case SIGUSR2: - if (signal_SIGUSR2_handler) - signal_SIGUSR2_handler(signal_SIGUSR2_v, SIGUSR2); - break; - default: -#ifdef _WITH_JSON_ - if (sig == SIGJSON) { - if (signal_SIGJSON_handler) - signal_SIGJSON_handler(signal_SIGJSON_v, SIGJSON); - break; - } -#endif - break; - } + if (sig >= 1 && sig <= SIG_MAX && signal_handler_func[sig-1]) + signal_handler_func[sig-1](signal_v[sig-1], sig); } } ++++++ linux-4.15.patch ++++++ >From 947248af144bcab6376ccddab8dc40f313b14281 Mon Sep 17 00:00:00 2001 From: Baruch Siach <[email protected]> Date: Fri, 9 Feb 2018 11:55:19 +0200 Subject: [PATCH] Fix build with Linux kernel headers v4.15 Linux kernel version 4.15 changed the libc/kernel headers suppression logic in a way that introduces collisions: In file included from ./../include/vrrp_ipaddress.h:32:0, from ./../include/vrrp_arp.h:31, from vrrp.c:29: /home/peko/autobuild/instance-1/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/in.h:29:3: error: redeclaration of enumerator 'IPPROTO_IP' IPPROTO_IP = 0, /* Dummy protocol for TCP */ ^ /home/peko/autobuild/instance-1/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/netinet/in.h:33:5: note: previous definition of 'IPPROTO_IP' was here IPPROTO_IP = 0, /* Dummy protocol for TCP. */ ^~~~~~~~~~ Include the libc netinet/in.h header first to suppress the kernel header. In addition, add _GNU_SOURCE to vrrp.c for the libc provided in6_pktinfo definition. Signed-off-by: Baruch Siach <[email protected]> --- keepalived/include/vrrp_arp.h | 1 + keepalived/vrrp/vrrp.c | 1 + 2 files changed, 2 insertions(+) diff --git a/keepalived/include/vrrp_arp.h b/keepalived/include/vrrp_arp.h index c2b4e6b5..9dd68f63 100644 --- a/keepalived/include/vrrp_arp.h +++ b/keepalived/include/vrrp_arp.h @@ -24,6 +24,7 @@ #define _VRRP_ARP_H /* system includes */ +#include <netinet/in.h> #include <net/ethernet.h> #include <net/if_arp.h> diff --git a/keepalived/vrrp/vrrp.c b/keepalived/vrrp/vrrp.c index 56395363..eaa9c567 100644 --- a/keepalived/vrrp/vrrp.c +++ b/keepalived/vrrp/vrrp.c @@ -26,6 +26,7 @@ #include "config.h" /* local include */ +#define _GNU_SOURCE #include "vrrp_arp.h" #include "vrrp_ndisc.h" #include "vrrp_scheduler.h"
