1 Star 0 Fork 20

src-oepkgs-oE-rv/keepalived

forked from src-openEuler/keepalived 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0010-vrrp-Don-t-segfault-when-a-VRID-is-changed-on-a-VMAC.patch 2.86 KB
一键复制 编辑 原始数据 按行查看 历史
Randy.Wang 提交于 2021-06-10 09:43 . add upstream patch
From d00153b11938f973816d39fabfd7edb6c69e46e8 Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Tue, 17 Nov 2020 16:14:18 +0000
Subject: [PATCH 447/691] vrrp: Don't segfault when a VRID is changed on a VMAC
when reloading
With many thanks to Louis Scalbert (@louis-oui) for identifying the
issue and providing a patch that formed the basis of this patch.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
---
keepalived/vrrp/vrrp_daemon.c | 16 ++++++++--------
keepalived/vrrp/vrrp_if.c | 18 ++++++++++--------
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/keepalived/vrrp/vrrp_daemon.c b/keepalived/vrrp/vrrp_daemon.c
index ea950c9..aa3052d 100644
--- a/keepalived/vrrp/vrrp_daemon.c
+++ b/keepalived/vrrp/vrrp_daemon.c
@@ -551,6 +551,14 @@ start_vrrp(data_t *prev_global_data)
}
}
+ /* Init & start the VRRP packet dispatcher */
+ if (!reload && global_data->vrrp_startup_delay) {
+ log_message(LOG_INFO, "Delaying startup for %g seconds", global_data->vrrp_startup_delay / TIMER_HZ_DOUBLE);
+ thread_add_timer(master, vrrp_dispatcher_init, NULL,
+ global_data->vrrp_startup_delay);
+ } else
+ thread_add_event(master, vrrp_dispatcher_init, NULL, 0);
+
/* Complete VRRP initialization */
if (!vrrp_complete_init()) {
stop_vrrp(KEEPALIVED_EXIT_CONFIG);
@@ -610,14 +618,6 @@ start_vrrp(data_t *prev_global_data)
if (__test_bit(DUMP_CONF_BIT, &debug))
dump_data_vrrp(NULL);
- /* Init & start the VRRP packet dispatcher */
- if (!reload && global_data->vrrp_startup_delay) {
- log_message(LOG_INFO, "Delaying startup for %g seconds", global_data->vrrp_startup_delay / TIMER_HZ_DOUBLE);
- thread_add_timer(master, vrrp_dispatcher_init, NULL,
- global_data->vrrp_startup_delay);
- } else
- thread_add_event(master, vrrp_dispatcher_init, NULL, 0);
-
/* Set the process priority and non swappable if configured */
set_process_priorities(global_data->vrrp_realtime_priority,
#if HAVE_DECL_RLIMIT_RTTIME == 1
diff --git a/keepalived/vrrp/vrrp_if.c b/keepalived/vrrp/vrrp_if.c
index 6847df9..d40f9f1 100644
--- a/keepalived/vrrp/vrrp_if.c
+++ b/keepalived/vrrp/vrrp_if.c
@@ -1311,14 +1311,16 @@ cleanup_lost_interface(interface_t *ifp)
#endif
/* Find the sockpool entry. If none, then we have closed the socket */
- if (vrrp->sockets->fd_in != -1) {
- thread_cancel_read(master, vrrp->sockets->fd_in);
- close(vrrp->sockets->fd_in);
- vrrp->sockets->fd_in = -1;
- }
- if (vrrp->sockets->fd_out != -1) {
- close(vrrp->sockets->fd_out);
- vrrp->sockets->fd_out = -1;
+ if (vrrp->sockets) {
+ if (vrrp->sockets->fd_in != -1) {
+ thread_cancel_read(master, vrrp->sockets->fd_in);
+ close(vrrp->sockets->fd_in);
+ vrrp->sockets->fd_in = -1;
+ }
+ if (vrrp->sockets->fd_out != -1) {
+ close(vrrp->sockets->fd_out);
+ vrrp->sockets->fd_out = -1;
+ }
}
if (IF_ISUP(ifp))
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-oepkgs-oe-rv/keepalived.git
git@gitee.com:src-oepkgs-oe-rv/keepalived.git
src-oepkgs-oe-rv
keepalived
keepalived
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385