!42 upgrade keepalived to 2.2.8

From: @sunsuwan 
Reviewed-by: @robertxw 
Signed-off-by: @robertxw
This commit is contained in:
openeuler-ci-bot 2024-02-18 07:11:09 +00:00 committed by Gitee
commit 5b58b08613
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
12 changed files with 9 additions and 581 deletions

View File

@ -1,39 +0,0 @@
From 7977fec0be89ae6fe87405b3f8da2f0b5e415e3d Mon Sep 17 00:00:00 2001
From: Vincent Bernat <vincent@bernat.ch>
Date: Tue, 23 Nov 2021 06:50:59 +0100
Subject: [PATCH] dbus: fix policy to not be overly broad
The DBus policy did not restrict the message destination, allowing any
user to inspect and manipulate any property.
CVE-2021-44225
https://nvd.nist.gov/vuln/detail/CVE-2021-44225
Reference:https://github.com/acassen/keepalived/commit/7977fec0be89ae6fe87405b3f8da2f0b5e415e3d.patch
Conflict:NA
Signed-off-by: Vincent Bernat <vincent@bernat.ch>
---
keepalived/dbus/org.keepalived.Vrrp1.conf | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/keepalived/dbus/org.keepalived.Vrrp1.conf b/keepalived/dbus/org.keepalived.Vrrp1.conf
index 2b78a575c..b5ced6085 100644
--- a/keepalived/dbus/org.keepalived.Vrrp1.conf
+++ b/keepalived/dbus/org.keepalived.Vrrp1.conf
@@ -3,12 +3,15 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
- <allow own="org.keepalived.Vrrp1"/>
- <allow send_destination="org.keepalived.Vrrp1"/>
+ <allow own="org.keepalived.Vrrp1" />
+ <allow send_destination="org.keepalived.Vrrp1" />
</policy>
<policy context="default">
- <allow send_interface="org.freedesktop.DBus.Introspectable" />
- <allow send_interface="org.freedesktop.DBus.Peer" />
- <allow send_interface="org.freedesktop.DBus.Properties" />
+ <allow send_destination="org.keepalived.Vrrp1"
+ send_interface="org.freedesktop.DBus.Introspectable" />
+ <allow send_destination="org.keepalived.Vrrp1"
+ send_interface="org.freedesktop.DBus.Peer" />
+ <allow send_destination="org.keepalived.Vrrp1"
+ send_interface="org.freedesktop.DBus.Properties" />
</policy>
</busconfig>

View File

@ -1,33 +0,0 @@
From f46327dc6e2daab91b8f164fc0e77fcb4cb80c6a Mon Sep 17 00:00:00 2001
From: Arthur Grosser <15238252+agrrto@users.noreply.github.com>
Date: Fri, 27 May 2022 15:22:25 +0200
Subject: [PATCH] Fix segfault when receive netlink message for static default
route added
This extends acassen@069a039 where the problem was fixed for virtual
routes.
Conflict: NA
Reference: https://github.com/acassen/keepalived/commit/f46327dc6e2daab91b8f164fc0e77fcb4cb80c6a
---
keepalived/core/keepalived_netlink.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/keepalived/core/keepalived_netlink.c b/keepalived/core/keepalived_netlink.c
index ea8843f..5c078d2 100644
--- a/keepalived/core/keepalived_netlink.c
+++ b/keepalived/core/keepalived_netlink.c
@@ -321,7 +321,10 @@ route_is_ours(struct rtmsg* rt, struct rtattr *tb[RTA_MAX + 1], vrrp_t** ret_vrr
tos != route->tos)
continue;
- if (compare_addr(family, RTA_DATA(tb[RTA_DST]), route->dst))
+ if (!tb[RTA_DST])
+ memset(&default_addr, 0, sizeof(default_addr));
+
+ if (compare_addr(family, tb[RTA_DST] ? RTA_DATA(tb[RTA_DST]) : &default_addr, route->dst))
continue;
return route;
--
2.23.0

View File

@ -1,83 +0,0 @@
From 4b269f8131591e3067b54dc1f587592bfca10fba Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Tue, 26 Jul 2022 09:42:01 +0100
Subject: [PATCH] check: fix further memory leaks when configuration is
repeated
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Conflict: adapt path_handler because the pre patch 516032ec39169d05c613de0e8ee10845658748ff reconstructs the configuration resolution
Reference: https://github.com/acassen/keepalived/commit/4b269f8131591e3067b54dc1f587592bfca10fba
---
keepalived/check/check_http.c | 9 +++++++--
keepalived/check/check_parser.c | 6 +-----
keepalived/check/check_smtp.c | 4 +++-
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/keepalived/check/check_http.c b/keepalived/check/check_http.c
index 4b1f3f3..47a9ac1 100644
--- a/keepalived/check/check_http.c
+++ b/keepalived/check/check_http.c
@@ -505,7 +505,7 @@ path_handler(const vector_t *strvec)
http_checker_t *http_get_chk = CHECKER_GET();
url_t *url = list_last_entry(&http_get_chk->url, url_t, e_list);
- url->path = set_value(strvec);
+ set_string(&url->path, strvec, "path");
}
static void
@@ -625,11 +625,16 @@ regex_handler(__attribute__((unused)) const vector_t *strvec)
const vector_t *strvec_qe = alloc_strvec_quoted_escaped(NULL);
if (vector_size(strvec_qe) != 2) {
- log_message(LOG_INFO, "regex missing or too many fields");
+ report_config_error(CONFIG_GENERAL_ERROR, "regex missing or too many fields");
free_strvec(strvec_qe);
return;
}
+ if (conf_regex_pattern) {
+ report_config_error(CONFIG_GENERAL_ERROR, "Duplicate regex specified - replacing %s with %s", conf_regex_pattern, strvec_slot(strvec, 1));
+ FREE_CONST_PTR(conf_regex_pattern);
+ }
+
conf_regex_pattern = PTR_CAST_CONST(unsigned char, set_value(strvec_qe));
free_strvec(strvec_qe);
}
diff --git a/keepalived/check/check_parser.c b/keepalived/check/check_parser.c
index ec8f779..f24215e 100644
--- a/keepalived/check/check_parser.c
+++ b/keepalived/check/check_parser.c
@@ -74,11 +74,7 @@ handle_ssl_file(const vector_t *strvec, const char **file_name, const char *type
return;
}
- if (*file_name) {
- report_config_error(CONFIG_GENERAL_ERROR, "SSL %s already specified - replacing", type);
- FREE_CONST(*file_name);
- }
- *file_name = set_value(strvec);
+ set_string(file_name, strvec, "SSL");
}
static void
diff --git a/keepalived/check/check_smtp.c b/keepalived/check/check_smtp.c
index 034d891..65db135 100644
--- a/keepalived/check/check_smtp.c
+++ b/keepalived/check/check_smtp.c
@@ -273,8 +273,10 @@ smtp_helo_name_handler(const vector_t *strvec)
return;
}
- if (smtp_checker->helo_name)
+ if (smtp_checker->helo_name) {
+ report_config_error(CONFIG_GENERAL_ERROR, "SMTP_CHECK helo name already specified");
FREE_CONST(smtp_checker->helo_name);
+ }
smtp_checker->helo_name = set_value(strvec);
}
--
2.33.0

View File

@ -1,123 +0,0 @@
From 014f037b219d328d501ac90cc046efa9b84b3a32 Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Mon, 25 Jul 2022 18:06:24 +0100
Subject: [PATCH] check: use last entry if duplicate definition
Commits 8a3f145 - "fix mem leaks when virtualhost and snmp_name
are duplicate" and 86bbb2e - "fix mem leaks when virtualhost is
duplicate" changed the behaviour of virtualhost and snmp_name
configuration if there were duplicate definitions to use the
first defined entry, whereas previously the last defined entry
was used, albeit with a memory leak.
This commit retains the memory leak fixes, but reverts the
behaviour to use the last definition rather than the first.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Conflict: adapt the input parameter of set_string function because the pre patch 516032ec39169d05c613de0e8ee10845658748ff reconstructs the configuration resolution
Reference: https://github.com/acassen/keepalived/commit/014f037b219d328d501ac90cc046efa9b84b3a32
---
keepalived/check/check_http.c | 4 ++--
keepalived/check/check_parser.c | 8 ++++----
lib/parser.c | 10 ++++++++++
lib/parser.h | 1 +
4 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/keepalived/check/check_http.c b/keepalived/check/check_http.c
index e5f4dfa..4b1f3f3 100644
--- a/keepalived/check/check_http.c
+++ b/keepalived/check/check_http.c
@@ -463,7 +463,7 @@ virtualhost_handler(const vector_t *strvec)
return;
}
- http_get_chk->virtualhost = set_value(strvec);
+ set_string(&http_get_chk->virtualhost, strvec, "virtualhost");
}
static void
@@ -592,7 +592,7 @@ url_virtualhost_handler(const vector_t *strvec)
return;
}
- url->virtualhost = set_value(strvec);
+ set_string(&url->virtualhost, strvec, "url virtualhost");
}
static void
diff --git a/keepalived/check/check_parser.c b/keepalived/check/check_parser.c
index a962581..ec8f779 100644
--- a/keepalived/check/check_parser.c
+++ b/keepalived/check/check_parser.c
@@ -607,7 +607,7 @@ vs_virtualhost_handler(const vector_t *strvec)
return;
}
- vs->virtualhost = set_value(strvec);
+ set_string(&vs->virtualhost, strvec, "vs virtualhost");
}
#ifdef _WITH_SNMP_CHECKER_
@@ -621,7 +621,7 @@ vs_snmp_name_handler(const vector_t *strvec)
return;
}
- vs->snmp_name = set_value(strvec);
+ set_string(&vs->snmp_name, strvec, "vs snmp_name");
}
#endif
@@ -891,7 +891,7 @@ rs_virtualhost_handler(const vector_t *strvec)
return;
}
- rs->virtualhost = set_value(strvec);
+ set_string(&rs->virtualhost, strvec, "rs virtualhost");
}
#ifdef _WITH_SNMP_CHECKER_
@@ -906,7 +906,7 @@ rs_snmp_name_handler(const vector_t *strvec)
return;
}
- rs->snmp_name = set_value(strvec);
+ set_string(&rs->snmp_name, strvec, "rs snmp_name");
}
#endif
diff --git a/lib/parser.c b/lib/parser.c
index bcabd07..68a6e49 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -804,6 +804,16 @@ read_hex_str(const char *str, uint8_t **data, uint8_t **data_mask)
return len;
}
+void
+set_string(const char **var, const vector_t *strvec, const char *param_name)
+{
+ if (*var) {
+ report_config_error(CONFIG_GENERAL_ERROR, "Duplicate %s - overwriting %s with %s", param_name, *var, strvec_slot(strvec, 1));
+ FREE_CONST_PTR(*var);
+ }
+ *var = set_value(strvec);
+}
+
void
set_random_seed(unsigned int seed)
{
diff --git a/lib/parser.h b/lib/parser.h
index 994eeb3..4fa0988 100644
--- a/lib/parser.h
+++ b/lib/parser.h
@@ -116,6 +116,7 @@ set_value_r(const vector_t *strvec)
#endif
/* Prototypes */
+extern void set_string(const char **, const vector_t *, const char *);
extern void report_config_error(config_err_t, const char *format, ...)
__attribute__((format (printf, 2, 3)));
extern void use_disk_copy_for_config(const char *);
--
2.33.0

View File

@ -1,22 +0,0 @@
From 367c652758bf0b5ce567e775b710cb0164966528 Mon Sep 17 00:00:00 2001
From: Jeltz <89084173+koh6uawi@users.noreply.github.com>
Date: Tue, 4 Apr 2023 15:05:18 +0200
Subject: [PATCH] dbus: fix type of Name property in Interface
---
keepalived/dbus/org.keepalived.Vrrp1.Instance.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/keepalived/dbus/org.keepalived.Vrrp1.Instance.xml b/keepalived/dbus/org.keepalived.Vrrp1.Instance.xml
index ed5798a56..4e6b4f8f7 100644
--- a/keepalived/dbus/org.keepalived.Vrrp1.Instance.xml
+++ b/keepalived/dbus/org.keepalived.Vrrp1.Instance.xml
@@ -25,7 +25,7 @@
<signal name='VrrpStatusChange'>
<arg type='u' name='status' />
</signal>
- <property type='s' name='Name' access='read' />
+ <property type='(s)' name='Name' access='read' />
<property type='(us)' name='State' access='read' />
</interface>
</node>

Binary file not shown.

BIN
keepalived-2.2.8.tar.gz Normal file

Binary file not shown.

View File

@ -8,8 +8,8 @@
%global _hardened_build 1 %global _hardened_build 1
Name: keepalived Name: keepalived
Version: 2.2.4 Version: 2.2.8
Release: 4 Release: 1
Summary: High Availability monitor built upon LVS, VRRP and service pollers Summary: High Availability monitor built upon LVS, VRRP and service pollers
License: GPLv2+ License: GPLv2+
URL: http://www.keepalived.org/ URL: http://www.keepalived.org/
@ -19,16 +19,6 @@ Source2: keepalived-stop-post.sh
Source3: keepalived-start-post.sh Source3: keepalived-start-post.sh
Source4: keepalived-pid-check.sh Source4: keepalived-pid-check.sh
Patch0001: CVE-2021-44225.patch
Patch0002: scheduler-Handle-cancelling-timer-thread-on-ready-qu.patch
Patch0003: vrrp-dbus-Fix-assert-on-shutdown-after-name-lost.patch
Patch0004: vrrp-Resolve-segfault-when-enable_snmp_vrrp-is-added.patch
Patch0005: Fix-segfault-when-receive-netlink-message-for-static.patch
Patch0006: vrrp-deley-freeing-vrrp-instances-until-all-referenc.patch
Patch0007: check-use-last-entry-if-duplicate-definition.patch
Patch0008: check-fix-further-memory-leaks-when-configuration-is.patch
Patch0009: dbus-fix-type-of-name-property-in-interface.patch
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
@ -95,7 +85,7 @@ install -Dd -m 0755 %{buildroot}%{_libexecdir}/keepalived
%doc README %doc README
%license COPYING %license COPYING
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/keepalived %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/keepalived
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/keepalived/keepalived.conf %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/keepalived/keepalived.conf.sample
%attr(0755,root,root) %{_sbindir}/keepalived %attr(0755,root,root) %{_sbindir}/keepalived
%dir %{_sysconfdir}/keepalived/ %dir %{_sysconfdir}/keepalived/
%dir %{_libexecdir}/keepalived/ %dir %{_libexecdir}/keepalived/
@ -112,6 +102,12 @@ install -Dd -m 0755 %{buildroot}%{_libexecdir}/keepalived
%{_mandir}/man* %{_mandir}/man*
%changelog %changelog
* Sun Feb 18 2024 sunsuwan <sunsuwan3@huawei.com> - 2.2.8-1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:upgrade keepalived to 2.2.8
* Thu Aug 10 2023 liubo <liubo335@huawei.com> - 2.2.4-4 * Thu Aug 10 2023 liubo <liubo335@huawei.com> - 2.2.4-4
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA

View File

@ -1,44 +0,0 @@
From 73ba6004b906b1ea022c169b25b9bdab589583e4 Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Fri, 22 Oct 2021 15:16:01 +0100
Subject: [PATCH] scheduler: Handle cancelling timer thread on ready queue
The timer thread on the ready queue, if cancelled, was corrupting
the read list_head, since it assumed it was on a red black tree.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Conflict: NA
Reference: https://github.com/acassen/keepalived/commit/73ba6004b906b1ea022c169b25b9bdab589583e4
---
lib/scheduler.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/scheduler.c b/lib/scheduler.c
index a588f52..ebf5ea3 100644
--- a/lib/scheduler.c
+++ b/lib/scheduler.c
@@ -1527,6 +1527,7 @@ thread_cancel(thread_ref_t thread_cp)
break;
case THREAD_EVENT:
case THREAD_READY:
+ case THREAD_READY_TIMER:
#ifdef USE_SIGNAL_THREADS
case THREAD_SIGNAL:
#endif
@@ -1534,7 +1535,13 @@ thread_cancel(thread_ref_t thread_cp)
case THREAD_CHILD_TERMINATED:
list_del_init(&thread->e_list);
break;
+ case THREAD_TIMER_SHUTDOWN:
+ case THREAD_TERMINATE_START:
+ case THREAD_TERMINATE:
+ log_message(LOG_WARNING, "ERROR - thread_cancel called for THREAD_%s", thread->type == THREAD_TIMER_SHUTDOWN ? "TIMER_SHUTDOWN" : thread->type == THREAD_TERMINATE ? "TERMINATE" : "TERMINATE_START");
+ return;
default:
+ log_message(LOG_WARNING, "ERROR - thread_cancel called for unknown thread type %u", thread->type);
break;
}
--
2.23.0

View File

@ -1,146 +0,0 @@
From 24f8a1e1220e5f1fa762e60669ef1215cc15d138 Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Sun, 17 Apr 2022 14:52:44 +0100
Subject: [PATCH] vrrp: Resolve segfault when enable_snmp_vrrp is added at a
reload
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Conflict: NA
Reference: https://github.com/acassen/keepalived/commit/24f8a1e1220e5f1fa762e60669ef1215cc15d138
---
keepalived/core/snmp.c | 1 +
keepalived/include/vrrp_snmp.h | 3 ++-
keepalived/vrrp/vrrp_daemon.c | 10 ++++++++--
keepalived/vrrp/vrrp_snmp.c | 18 +++++++++---------
4 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/keepalived/core/snmp.c b/keepalived/core/snmp.c
index 421484e..2aae126 100644
--- a/keepalived/core/snmp.c
+++ b/keepalived/core/snmp.c
@@ -496,6 +496,7 @@ snmp_agent_close(bool base_mib)
if (base_mib)
snmp_unregister_mib(global_oid, OID_LENGTH(global_oid));
snmp_shutdown(global_name);
+ shutdown_agent();
snmp_running = false;
}
diff --git a/keepalived/include/vrrp_snmp.h b/keepalived/include/vrrp_snmp.h
index f75d32f..028356a 100644
--- a/keepalived/include/vrrp_snmp.h
+++ b/keepalived/include/vrrp_snmp.h
@@ -26,6 +26,7 @@
#include "config.h"
+#include "global_data.h"
#ifdef _WITH_SNMP_RFC_
#include "timer.h"
#endif
@@ -74,7 +75,7 @@ extern timeval_t snmp_vrrp_start_time;
/* Prototypes */
extern void vrrp_snmp_agent_init(const char *);
-extern void vrrp_snmp_agent_close(void);
+extern void vrrp_snmp_agent_close(const data_t *);
#ifdef _WITH_SNMP_VRRP_
extern void vrrp_snmp_instance_trap(vrrp_t *);
diff --git a/keepalived/vrrp/vrrp_daemon.c b/keepalived/vrrp/vrrp_daemon.c
index 036f9f2..5568a52 100644
--- a/keepalived/vrrp/vrrp_daemon.c
+++ b/keepalived/vrrp/vrrp_daemon.c
@@ -286,7 +286,7 @@ vrrp_terminate_phase2(int exit_status)
global_data->enable_snmp_rfcv3 ||
#endif
snmp_option)
- vrrp_snmp_agent_close();
+ vrrp_snmp_agent_close(global_data);
#endif
#ifdef _WITH_LVS_
@@ -554,13 +554,19 @@ start_vrrp(data_t *prev_global_data)
global_data->enable_snmp_rfcv3 ||
#endif
snmp_option)) {
- if (reload)
+ if (snmp_running)
snmp_epoll_info(master);
else
vrrp_snmp_agent_init(global_data->snmp_socket);
#ifdef _WITH_SNMP_RFC_
snmp_vrrp_start_time = time_now;
#endif
+ } else {
+// We have a problem at reload if VRRP had SNMP and checker didn't, but now checker does.
+// Also race condition if changing so checker does and we dont, from other way round.
+// SOLUTION: Stop snmp before reload and start afterwards. ? A race anyway
+ if (snmp_running)
+ vrrp_snmp_agent_close(old_global_data);
}
#endif
diff --git a/keepalived/vrrp/vrrp_snmp.c b/keepalived/vrrp/vrrp_snmp.c
index fc7749b..aa4c426 100644
--- a/keepalived/vrrp/vrrp_snmp.c
+++ b/keepalived/vrrp/vrrp_snmp.c
@@ -4471,15 +4471,15 @@ vrrp_rfcv3_snmp_proto_err_notify(vrrp_t *vrrp)
#endif
static bool
-vrrp_handles_global_oid(void)
+vrrp_handles_global_oid(const data_t *global_data_in_use)
{
#ifdef _WITH_SNMP_VRRP_
- if (global_data->enable_snmp_vrrp) {
+ if (global_data_in_use->enable_snmp_vrrp) {
#ifdef _WITH_LVS_
if (!running_checker())
return true;
#ifdef _WITH_SNMP_CHECKER_
- if (!global_data->enable_snmp_checker)
+ if (!global_data_in_use->enable_snmp_checker)
return true;
#endif
#else
@@ -4498,7 +4498,7 @@ vrrp_snmp_agent_init(const char *snmp_socket_name)
return;
/* We let the check process handle the global OID if it is running and with snmp */
- snmp_agent_init(snmp_socket_name, vrrp_handles_global_oid());
+ snmp_agent_init(snmp_socket_name, vrrp_handles_global_oid(global_data));
#ifdef _WITH_SNMP_VRRP_
if (global_data->enable_snmp_vrrp)
@@ -4524,22 +4524,22 @@ vrrp_snmp_agent_init(const char *snmp_socket_name)
}
void
-vrrp_snmp_agent_close(void)
+vrrp_snmp_agent_close(const data_t *global_data_in_use)
{
if (!snmp_running)
return;
#ifdef _WITH_SNMP_VRRP_
- if (global_data->enable_snmp_vrrp)
+ if (global_data_in_use->enable_snmp_vrrp)
snmp_unregister_mib(vrrp_oid, OID_LENGTH(vrrp_oid));
#endif
#ifdef _WITH_SNMP_RFCV2_
- if (global_data->enable_snmp_rfcv2)
+ if (global_data_in_use->enable_snmp_rfcv2)
snmp_unregister_mib(vrrp_rfcv2_oid, OID_LENGTH(vrrp_rfcv2_oid));
#endif
#ifdef _WITH_SNMP_RFCV3_
- if (global_data->enable_snmp_rfcv3)
+ if (global_data_in_use->enable_snmp_rfcv3)
snmp_unregister_mib(vrrp_rfcv3_oid, OID_LENGTH(vrrp_rfcv3_oid));
#endif
- snmp_agent_close(vrrp_handles_global_oid());
+ snmp_agent_close(vrrp_handles_global_oid(global_data_in_use));
}
--
2.23.0

View File

@ -1,38 +0,0 @@
From 5721b5b7144d7e0fa71badf4fc2666a0850ea1ee Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Mon, 27 Sep 2021 16:57:54 +0100
Subject: [PATCH] vrrp dbus: Fix assert on shutdown after name lost
When DBus reports that the VRRP name has been lost on the session
bus, keepalived calls g_hash_table_foreach_remove(). However it called
the function again on shutdown causing an assert failure. This commit
ensures that g_hash_table_foreach_remove() is not called on shutdown
if it has already been called due to the name being lost.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Conflict: NA
Reference: https://github.com/acassen/keepalived/commit/5721b5b7144d7e0fa71badf4fc2666a0850ea1ee
---
keepalived/vrrp/vrrp_dbus.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/keepalived/vrrp/vrrp_dbus.c b/keepalived/vrrp/vrrp_dbus.c
index c3b7c2c..0a223b4 100644
--- a/keepalived/vrrp/vrrp_dbus.c
+++ b/keepalived/vrrp/vrrp_dbus.c
@@ -964,8 +964,10 @@ dbus_stop(void)
if (!dbus_running)
return;
- g_hash_table_foreach_remove(objects, remove_object, NULL);
- objects = NULL;
+ if (objects) {
+ g_hash_table_foreach_remove(objects, remove_object, NULL);
+ objects = NULL;
+ }
if (global_connection != NULL) {
path = dbus_object_create_path_vrrp();
--
2.23.0

View File

@ -1,40 +0,0 @@
From 57dfaec99bafb0eb45e634c605daf52bb1cd5d0d Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Thu, 30 Jun 2022 17:14:39 +0100
Subject: [PATCH] vrrp: deley freeing vrrp instances until all references are
freed
Trackers etc have lists for vrrp instances that are tracking them.
Therefore the trackers, and their references, must be freed before the
vrrp instances are freed.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Conflict: NA
Reference: https://github.com/acassen/keepalived/commit/57dfaec99bafb0eb45e634c605daf52bb1cd5d0d
---
keepalived/vrrp/vrrp_data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/keepalived/vrrp/vrrp_data.c b/keepalived/vrrp/vrrp_data.c
index b2c6f69..c144e64 100644
--- a/keepalived/vrrp/vrrp_data.c
+++ b/keepalived/vrrp/vrrp_data.c
@@ -1223,7 +1223,6 @@ free_vrrp_data(vrrp_data_t * data)
free_iproute_list(&data->static_routes);
free_iprule_list(&data->static_rules);
free_static_track_groups_list(&data->static_track_groups);
- free_vrrp_list(&data->vrrp);
free_sync_group_list(&data->vrrp_sync_group);
free_vscript_list(&data->vrrp_script);
free_track_file_list(&data->vrrp_track_files);
@@ -1233,6 +1232,7 @@ free_vrrp_data(vrrp_data_t * data)
#ifdef _WITH_BFD_
free_vrrp_tracked_bfd_list(&data->vrrp_track_bfds);
#endif
+ free_vrrp_list(&data->vrrp);
FREE(data);
}
--
2.23.0