summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mozes <hydrapolic@gmail.com>2018-11-15 10:58:16 +0100
committerMikle Kolyada <zlogene@gentoo.org>2018-11-15 16:49:01 +0300
commitbb99b23e3f30a44d4880944ff42731297a0c5e3e (patch)
treed86ff725cb9396206ba4a0d64744d9461e8f1fed /sys-cluster/keepalived
parentnet-libs/davix: 0.6.7 stable for amd64 and x86 (diff)
downloadgentoo-bb99b23e3f30a44d4880944ff42731297a0c5e3e.tar.gz
gentoo-bb99b23e3f30a44d4880944ff42731297a0c5e3e.tar.bz2
gentoo-bb99b23e3f30a44d4880944ff42731297a0c5e3e.zip
sys-cluster/keepalived: fix crash during shutdown
Bug: https://bugs.gentoo.org/670856 Bug: https://github.com/acassen/keepalived/issues/1061 Package-Manager: Portage-2.3.51, Repoman-2.3.12 Signed-off-by: Tomáš Mózes <hydrapolic@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/10422 Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
Diffstat (limited to 'sys-cluster/keepalived')
-rw-r--r--sys-cluster/keepalived/files/keepalived-2.0.10-snmp-crash-fix.patch122
-rw-r--r--sys-cluster/keepalived/keepalived-2.0.10-r1.ebuild76
2 files changed, 198 insertions, 0 deletions
diff --git a/sys-cluster/keepalived/files/keepalived-2.0.10-snmp-crash-fix.patch b/sys-cluster/keepalived/files/keepalived-2.0.10-snmp-crash-fix.patch
new file mode 100644
index 000000000000..c1a5ab36180c
--- /dev/null
+++ b/sys-cluster/keepalived/files/keepalived-2.0.10-snmp-crash-fix.patch
@@ -0,0 +1,122 @@
+diff --git a/keepalived/check/check_snmp.c b/keepalived/check/check_snmp.c
+index 67ae0e4f9..95c6e6f83 100644
+--- a/keepalived/check/check_snmp.c
++++ b/keepalived/check/check_snmp.c
+@@ -1451,6 +1451,9 @@ static struct variable8 check_vars[] = {
+ void
+ check_snmp_agent_init(const char *snmp_socket)
+ {
++ if (snmp_running)
++ return;
++
+ /* We handle the global oid if we are running SNMP */
+ snmp_agent_init(snmp_socket, true);
+ snmp_register_mib(check_oid, OID_LENGTH(check_oid), "Healthchecker",
+@@ -1462,6 +1465,9 @@ check_snmp_agent_init(const char *snmp_socket)
+ void
+ check_snmp_agent_close()
+ {
++ if (!snmp_running)
++ return;
++
+ snmp_unregister_mib(check_oid, OID_LENGTH(check_oid));
+ snmp_agent_close(true);
+ }
+diff --git a/keepalived/core/snmp.c b/keepalived/core/snmp.c
+index a9472feae..eb5bed20a 100644
+--- a/keepalived/core/snmp.c
++++ b/keepalived/core/snmp.c
+@@ -325,6 +325,9 @@ snmp_unregister_mib(oid *myoid, size_t len)
+ void
+ snmp_agent_init(const char *snmp_socket, bool base_mib)
+ {
++ if (snmp_running)
++ return;
++
+ log_message(LOG_INFO, "Starting SNMP subagent");
+ netsnmp_enable_subagent();
+ snmp_disable_log();
+@@ -378,6 +381,9 @@ snmp_agent_init(const char *snmp_socket, bool base_mib)
+ void
+ snmp_agent_close(bool base_mib)
+ {
++ if (!snmp_running)
++ return;
++
+ if (base_mib)
+ snmp_unregister_mib(global_oid, OID_LENGTH(global_oid));
+ snmp_shutdown(global_name);
+diff --git a/keepalived/vrrp/vrrp_snmp.c b/keepalived/vrrp/vrrp_snmp.c
+index ca9d46768..db696159c 100644
+--- a/keepalived/vrrp/vrrp_snmp.c
++++ b/keepalived/vrrp/vrrp_snmp.c
+@@ -4552,6 +4552,9 @@ vrrp_handles_global_oid(void)
+ void
+ vrrp_snmp_agent_init(const char *snmp_socket)
+ {
++ if (snmp_running)
++ return;
++
+ /* We let the check process handle the global OID if it is running and with snmp */
+ snmp_agent_init(snmp_socket, vrrp_handles_global_oid());
+
+@@ -4581,6 +4584,9 @@ vrrp_snmp_agent_init(const char *snmp_socket)
+ void
+ vrrp_snmp_agent_close(void)
+ {
++ if (!snmp_running)
++ return;
++
+ #ifdef _WITH_SNMP_VRRP_
+ if (global_data->enable_snmp_vrrp)
+ snmp_unregister_mib(vrrp_oid, OID_LENGTH(vrrp_oid));
+diff --git a/lib/scheduler.c b/lib/scheduler.c
+index 0a1c334c3..9090a7f88 100644
+--- a/lib/scheduler.c
++++ b/lib/scheduler.c
+@@ -1630,7 +1630,7 @@ thread_fetch_next_queue(thread_master_t *m)
+ if (!ev->read) {
+ log_message(LOG_INFO, "scheduler: No read thread bound on fd:%d (fl:0x%.4X)"
+ , ev->fd, ep_ev->events);
+- assert(0);
++ continue;
+ }
+ thread_move_ready(m, &m->read, ev->read, THREAD_READY_FD);
+ ev->read = NULL;
+@@ -1641,7 +1641,7 @@ thread_fetch_next_queue(thread_master_t *m)
+ if (!ev->write) {
+ log_message(LOG_INFO, "scheduler: No write thread bound on fd:%d (fl:0x%.4X)"
+ , ev->fd, ep_ev->events);
+- assert(0);
++ continue;
+ }
+ thread_move_ready(m, &m->write, ev->write, THREAD_READY_FD);
+ ev->write = NULL;
+@@ -1710,7 +1710,12 @@ process_threads(thread_master_t *m)
+ thread = thread_trim_head(thread_list);
+ if (!shutting_down ||
+ (thread->type == THREAD_READY_FD &&
+- (thread->u.fd == m->timer_fd || thread->u.fd == m->signal_fd)) ||
++ (thread->u.fd == m->timer_fd ||
++ thread->u.fd == m->signal_fd
++#ifdef _WITH_SNMP_
++ || FD_ISSET(thread->u.fd, &m->snmp_fdset)
++#endif
++ )) ||
+ thread->type == THREAD_CHILD ||
+ thread->type == THREAD_CHILD_TIMEOUT ||
+ thread->type == THREAD_CHILD_TERMINATED ||
+diff --git a/lib/utils.c b/lib/utils.c
+index 6f9ec254d..e5b82b524 100644
+--- a/lib/utils.c
++++ b/lib/utils.c
+@@ -789,7 +789,9 @@ FILE *fopen_safe(const char *path, const char *mode)
+ {
+ int fd;
+ FILE *file;
++#ifdef ENABLE_LOG_FILE_APPEND
+ int flags = O_NOFOLLOW | O_CREAT | O_CLOEXEC;
++#endif
+ int sav_errno;
+ char file_tmp_name[] = "/tmp/keepalivedXXXXXX";
+
diff --git a/sys-cluster/keepalived/keepalived-2.0.10-r1.ebuild b/sys-cluster/keepalived/keepalived-2.0.10-r1.ebuild
new file mode 100644
index 000000000000..5eea98a00f61
--- /dev/null
+++ b/sys-cluster/keepalived/keepalived-2.0.10-r1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools systemd
+
+DESCRIPTION="A strong & robust keepalive facility to the Linux Virtual Server project"
+HOMEPAGE="http://www.keepalived.org/"
+SRC_URI="http://www.keepalived.org/software/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86"
+IUSE="dbus debug ipv6 -json snmp"
+
+RDEPEND="dev-libs/libnl:=
+ dev-libs/openssl:=
+ dev-libs/popt
+ net-libs/libnfnetlink
+ sys-apps/iproute2
+ dbus? ( sys-apps/dbus )
+ json? ( dev-libs/json-c:= )
+ snmp? ( net-analyzer/net-snmp )"
+DEPEND="${RDEPEND}
+ >=sys-kernel/linux-headers-4.4"
+
+DOCS=(
+ README CONTRIBUTORS INSTALL ChangeLog AUTHOR TODO
+ doc/keepalived.conf.SYNOPSIS doc/NOTE_vrrp_vmac.txt
+)
+
+PATCHES=(
+ "${FILESDIR}/${P}-snmp-crash-fix.patch"
+)
+
+src_prepare() {
+ default
+
+ eautoreconf
+}
+
+src_configure() {
+ STRIP=/bin/true \
+ econf \
+ --with-kernel-dir=/usr \
+ --enable-sha1 \
+ --enable-vrrp \
+ $(use_enable dbus) \
+ $(use_enable dbus dbus-create-instance) \
+ $(use_enable debug) \
+ $(use_enable json) \
+ $(use_enable snmp)
+}
+
+src_install() {
+ default
+
+ newinitd "${FILESDIR}"/keepalived.init-r1 keepalived
+ newconfd "${FILESDIR}"/keepalived.confd-r1 keepalived
+
+ systemd_newunit "${FILESDIR}"/${PN}.service ${PN}.service
+ systemd_install_serviced "${FILESDIR}/${PN}.service.conf"
+
+ use snmp && dodoc doc/KEEPALIVED-MIB.txt
+
+ docinto genhash
+ dodoc genhash/README genhash/AUTHOR genhash/ChangeLog
+ # This was badly named by upstream, it's more HOWTO than anything else.
+ newdoc INSTALL INSTALL+HOWTO
+
+ # Security risk to bundle SSL certs
+ rm -v "${ED}"/etc/keepalived/samples/*.pem || die
+ # Clean up sysvinit files
+ rm -rv "${ED}"/etc/sysconfig || die
+}