diff --git a/Fail-to-start-if-knet-ping-timers-are-invalid.patch b/Fail-to-start-if-knet-ping-timers-are-invalid.patch deleted file mode 100644 index 3476cba..0000000 --- a/Fail-to-start-if-knet-ping-timers-are-invalid.patch +++ /dev/null @@ -1,466 +0,0 @@ -From 1fb9e940462d393e1946e65dd5b26c416fe0f9e8 Mon Sep 17 00:00:00 2001 -From: zouzhimin -Date: Thu, 26 Oct 2023 15:39:58 +0800 -Subject: [PATCH] Fail to start if knet ping timers are invalid - ---- - exec/totemconfig.c | 16 +++++++++++----- - exec/totemconfig.h | 2 +- - exec/totemknet.c | 37 ++++++++++++++++++++++++++++--------- - exec/totemknet.h | 4 ++-- - exec/totemnet.c | 8 ++++---- - exec/totemnet.h | 4 ++-- - exec/totemsrp.c | 18 ++++++++++-------- - exec/totemudp.c | 8 ++++---- - exec/totemudp.h | 4 ++-- - exec/totemudpu.c | 8 ++++---- - exec/totemudpu.h | 4 ++-- - 11 files changed, 70 insertions(+), 43 deletions(-) - -diff --git a/exec/totemconfig.c b/exec/totemconfig.c -index 568f973..a6394a2 100644 ---- a/exec/totemconfig.c -+++ b/exec/totemconfig.c -@@ -1157,11 +1157,12 @@ static void calc_knet_ping_timers(struct totem_config *totem_config) - * (set to 0), and ips which are only in set1 or set2 remains untouched. - * totempg_node_add/remove is called. - */ --static void compute_and_set_totempg_interfaces(struct totem_interface *set1, -+static int compute_and_set_totempg_interfaces(struct totem_interface *set1, - struct totem_interface *set2) - { - int ring_no, set1_pos, set2_pos; - struct totem_ip_address empty_ip_address; -+ int res = 0; - - memset(&empty_ip_address, 0, sizeof(empty_ip_address)); - -@@ -1217,10 +1218,13 @@ static void compute_and_set_totempg_interfaces(struct totem_interface *set1, - totemip_print(&set2[ring_no].member_list[set2_pos]), - ring_no); - -- totempg_member_add(&set2[ring_no].member_list[set2_pos], ring_no); -+ if (totempg_member_add(&set2[ring_no].member_list[set2_pos], ring_no)) { -+ res = -1; -+ } - } - } - } -+ return res; - } - - /* -@@ -2414,10 +2418,11 @@ int totemconfig_configure_new_params( - return 0; - } - --void totemconfig_commit_new_params( -+int totemconfig_commit_new_params( - struct totem_config *totem_config, - icmap_map_t map) - { -+ int res; - struct totem_interface *new_interfaces = NULL; - - new_interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX); -@@ -2427,13 +2432,14 @@ void totemconfig_commit_new_params( - /* Set link parameters including local_ip */ - configure_totem_links(totem_config, map); - -- /* Add & remove nodes */ -- compute_and_set_totempg_interfaces(totem_config->orig_interfaces, new_interfaces); -+ /* Add & remove nodes & link properties */ -+ res = compute_and_set_totempg_interfaces(totem_config->orig_interfaces, new_interfaces); - - /* Does basic global params (like compression) */ - totempg_reconfigure(); - - free(new_interfaces); -+ return res; /* On a reload this is ignored */ - } - - static void add_totem_config_notification(struct totem_config *totem_config) -diff --git a/exec/totemconfig.h b/exec/totemconfig.h -index 2ea338f..a0b2e10 100644 ---- a/exec/totemconfig.h -+++ b/exec/totemconfig.h -@@ -86,7 +86,7 @@ extern int totemconfig_configure_new_params( - icmap_map_t map, - const char **error_string); - --extern void totemconfig_commit_new_params( -+extern int totemconfig_commit_new_params( - struct totem_config *totem_config, - icmap_map_t map); - -diff --git a/exec/totemknet.c b/exec/totemknet.c -index 55905ee..f280a09 100644 ---- a/exec/totemknet.c -+++ b/exec/totemknet.c -@@ -101,13 +101,13 @@ struct totemknet_instance { - - void *context; - -- void (*totemknet_deliver_fn) ( -+ int (*totemknet_deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from); - -- void (*totemknet_iface_change_fn) ( -+ int (*totemknet_iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int link_no); -@@ -865,14 +865,20 @@ static void timer_function_netif_check_timeout ( - { - struct totemknet_instance *instance = (struct totemknet_instance *)data; - int i; -+ int res = 0; - - for (i=0; i < INTERFACE_MAX; i++) { - if (!instance->totem_config->interfaces[i].configured) { - continue; - } -- instance->totemknet_iface_change_fn (instance->context, -- &instance->my_ids[i], -- i); -+ res = instance->totemknet_iface_change_fn (instance->context, -+ &instance->my_ids[i], -+ i); -+ } -+ if (res != 0) { -+ /* This is only called at startup, so we can quit here. -+ Refresh takes a different path */ -+ corosync_exit_error(COROSYNC_DONE_MAINCONFIGREAD); - } - } - -@@ -1121,13 +1127,13 @@ int totemknet_initialize ( - totemsrp_stats_t *stats, - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int link_no), -@@ -1634,20 +1640,33 @@ int totemknet_member_add ( - KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_priority for nodeid " CS_PRI_NODE_ID ", link %d failed", member->nodeid, link_no); - } - -- /* ping timeouts maybe 0 here for a newly added interface so we leave this till later, it will -- get done in totemknet_refresh_config */ -+ /* -+ * Ping timeouts may be 0 here for a newly added interface (on a reload), -+ * so we leave this till later, it will get done in totemknet_refresh_config. -+ * For the initial startup, we are all preset and ready to go from here. -+ */ - if (instance->totem_config->interfaces[link_no].knet_ping_interval != 0) { - err = knet_link_set_ping_timers(instance->knet_handle, member->nodeid, link_no, - instance->totem_config->interfaces[link_no].knet_ping_interval, - instance->totem_config->interfaces[link_no].knet_ping_timeout, - instance->totem_config->interfaces[link_no].knet_ping_precision); - if (err) { -+ /* Flush logs before reporting this error so that the knet message prints before ours */ -+ int saved_errno = errno; -+ log_flush_messages(instance); -+ errno = saved_errno; - KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_ping_timers for nodeid " CS_PRI_NODE_ID ", link %d failed", member->nodeid, link_no); -+ return -1; - } - err = knet_link_set_pong_count(instance->knet_handle, member->nodeid, link_no, - instance->totem_config->interfaces[link_no].knet_pong_count); - if (err) { -+ /* Flush logs before reporting this error so that the knet message prints before ours */ -+ int saved_errno = errno; -+ log_flush_messages(instance); -+ errno = saved_errno; - KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_pong_count for nodeid " CS_PRI_NODE_ID ", link %d failed", member->nodeid, link_no); -+ return -1; - } - } - -diff --git a/exec/totemknet.h b/exec/totemknet.h -index 67c0ba6..4d4f61e 100644 ---- a/exec/totemknet.h -+++ b/exec/totemknet.h -@@ -51,13 +51,13 @@ extern int totemknet_initialize ( - totemsrp_stats_t *stats, - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no), -diff --git a/exec/totemnet.c b/exec/totemnet.c -index a4b90a3..58992e6 100644 ---- a/exec/totemnet.c -+++ b/exec/totemnet.c -@@ -56,13 +56,13 @@ struct transport { - totemsrp_stats_t *stats, - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no), -@@ -321,13 +321,13 @@ int totemnet_initialize ( - totemsrp_stats_t *stats, - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no), -diff --git a/exec/totemnet.h b/exec/totemnet.h -index c6a9923..e71d9e0 100644 ---- a/exec/totemnet.h -+++ b/exec/totemnet.h -@@ -61,13 +61,13 @@ extern int totemnet_initialize ( - totemsrp_stats_t *stats, - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int iface_no), -diff --git a/exec/totemsrp.c b/exec/totemsrp.c -index fd71771..63a47c1 100644 ---- a/exec/totemsrp.c -+++ b/exec/totemsrp.c -@@ -664,13 +664,13 @@ static void *totemsrp_buffer_alloc (struct totemsrp_instance *instance); - static void totemsrp_buffer_release (struct totemsrp_instance *instance, void *ptr); - static const char* gsfrom_to_msg(enum gather_state_from gsfrom); - --void main_deliver_fn ( -+int main_deliver_fn ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from); - --void main_iface_change_fn ( -+int main_iface_change_fn ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int iface_no); -@@ -5032,7 +5032,7 @@ static int check_message_header_validity( - } - - --void main_deliver_fn ( -+int main_deliver_fn ( - void *context, - const void *msg, - unsigned int msg_len, -@@ -5042,7 +5042,7 @@ void main_deliver_fn ( - const struct totem_message_header *message_header = msg; - - if (check_message_header_validity(context, msg, msg_len, system_from) == -1) { -- return ; -+ return -1; - } - - switch (message_header->type) { -@@ -5071,12 +5071,12 @@ void main_deliver_fn ( - (int)message_header->type); - - instance->stats.rx_msg_dropped++; -- return; -+ return 0; - } - /* - * Handle incoming message - */ -- totemsrp_message_handlers.handler_functions[(int)message_header->type] ( -+ return totemsrp_message_handlers.handler_functions[(int)message_header->type] ( - instance, - msg, - msg_len, -@@ -5104,7 +5104,7 @@ int totemsrp_iface_set ( - } - - /* Contrary to its name, this only gets called when the interface is enabled */ --void main_iface_change_fn ( -+int main_iface_change_fn ( - void *context, - const struct totem_ip_address *iface_addr, - unsigned int iface_no) -@@ -5112,6 +5112,7 @@ void main_iface_change_fn ( - struct totemsrp_instance *instance = context; - int num_interfaces; - int i; -+ int res = 0; - - if (!instance->my_id.nodeid) { - instance->my_id.nodeid = iface_addr->nodeid; -@@ -5154,11 +5155,12 @@ void main_iface_change_fn ( - assert(instance->totem_config->orig_interfaces != NULL); - memset(instance->totem_config->orig_interfaces, 0, sizeof (struct totem_interface) * INTERFACE_MAX); - -- totemconfig_commit_new_params(instance->totem_config, icmap_get_global_map()); -+ res = totemconfig_commit_new_params(instance->totem_config, icmap_get_global_map()); - - memb_state_gather_enter (instance, TOTEMSRP_GSFROM_INTERFACE_CHANGE); - free(instance->totem_config->orig_interfaces); - } -+ return res; - } - - void totemsrp_net_mtu_adjust (struct totem_config *totem_config) { -diff --git a/exec/totemudp.c b/exec/totemudp.c -index fd3215b..0ebe127 100644 ---- a/exec/totemudp.c -+++ b/exec/totemudp.c -@@ -110,13 +110,13 @@ struct totemudp_instance { - - void *context; - -- void (*totemudp_deliver_fn) ( -+ int (*totemudp_deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from); - -- void (*totemudp_iface_change_fn) ( -+ int (*totemudp_iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no); -@@ -1136,13 +1136,13 @@ int totemudp_initialize ( - - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no), -diff --git a/exec/totemudp.h b/exec/totemudp.h -index 7d2abcd..6642472 100644 ---- a/exec/totemudp.h -+++ b/exec/totemudp.h -@@ -51,13 +51,13 @@ extern int totemudp_initialize ( - totemsrp_stats_t *stats, - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no), -diff --git a/exec/totemudpu.c b/exec/totemudpu.c -index a7029a4..d3d096c 100644 ---- a/exec/totemudpu.c -+++ b/exec/totemudpu.c -@@ -100,13 +100,13 @@ struct totemudpu_instance { - - void *context; - -- void (*totemudpu_deliver_fn) ( -+ int (*totemudpu_deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from); - -- void (*totemudpu_iface_change_fn) ( -+ int (*totemudpu_iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no); -@@ -957,13 +957,13 @@ int totemudpu_initialize ( - totemsrp_stats_t *stats, - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no), -diff --git a/exec/totemudpu.h b/exec/totemudpu.h -index 07e6345..fe530ca 100644 ---- a/exec/totemudpu.h -+++ b/exec/totemudpu.h -@@ -51,13 +51,13 @@ extern int totemudpu_initialize ( - totemsrp_stats_t *stats, - void *context, - -- void (*deliver_fn) ( -+ int (*deliver_fn) ( - void *context, - const void *msg, - unsigned int msg_len, - const struct sockaddr_storage *system_from), - -- void (*iface_change_fn) ( -+ int (*iface_change_fn) ( - void *context, - const struct totem_ip_address *iface_address, - unsigned int ring_no), --- -2.33.0 - diff --git a/Fix-integer-overflow.patch b/Fix-integer-overflow.patch deleted file mode 100644 index 0c16a70..0000000 --- a/Fix-integer-overflow.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 4f3402e69339d6589bec100cda780a250d326c2a Mon Sep 17 00:00:00 2001 -From: bixiaoyan -Date: Tue, 7 Nov 2023 16:10:19 +0800 -Subject: [PATCH] Handling integer overflow - ---- - exec/cs_queue.h | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/exec/cs_queue.h b/exec/cs_queue.h -index 04dd4bb..3dd7233 100644 ---- a/exec/cs_queue.h -+++ b/exec/cs_queue.h -@@ -46,15 +46,15 @@ struct cs_queue { - int tail; - int used; - int usedhw; -- int size; -+ size_t size; - void *items; -- int size_per_item; -+ size_t size_per_item; - int iterator; - pthread_mutex_t mutex; - int threaded_mode_enabled; - }; - --static inline int cs_queue_init (struct cs_queue *cs_queue, int cs_queue_items, int size_per_item, int threaded_mode_enabled) { -+static inline int cs_queue_init (struct cs_queue *cs_queue, size_t cs_queue_items, size_t size_per_item, int threaded_mode_enabled) { - cs_queue->head = 0; - cs_queue->tail = cs_queue_items - 1; - cs_queue->used = 0; --- -2.33.0 - diff --git a/Use-knet-TRACE-logging-level-if-available.patch b/Use-knet-TRACE-logging-level-if-available.patch deleted file mode 100644 index 0e5bc1d..0000000 --- a/Use-knet-TRACE-logging-level-if-available.patch +++ /dev/null @@ -1,60 +0,0 @@ -From ba50e6629471b32d3a39bd145d3b9f485bf5f7f1 Mon Sep 17 00:00:00 2001 -From: Christine Caulfield -Date: Wed, 29 Mar 2023 14:53:17 +0100 -Subject: [PATCH] knet: use knet TRACE logging level if available - ---- - exec/totemknet.c | 20 +++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) - -diff --git a/exec/totemknet.c b/exec/totemknet.c -index e02092c32..55905ee5d 100644 ---- a/exec/totemknet.c -+++ b/exec/totemknet.c -@@ -769,6 +769,13 @@ static int log_deliver_fn ( - knet_log_get_subsystem_name(msg->subsystem), - msg->msg); - break; -+#ifdef KNET_LOG_TRACE -+ case KNET_LOG_TRACE: -+ libknet_log_printf (LOGSYS_LEVEL_TRACE, "%s: %s", -+ knet_log_get_subsystem_name(msg->subsystem), -+ msg->msg); -+ break; -+#endif - } - bufptr += sizeof(struct knet_log_msg); - done += sizeof(struct knet_log_msg); -@@ -890,6 +897,7 @@ void totemknet_configure_log_level() - int logsys_log_mode; - int knet_log_mode = KNET_LOG_INFO; - uint8_t s; -+ int err; - - if (!global_instance || !global_instance->knet_handle) { - return; -@@ -906,12 +914,22 @@ void totemknet_configure_log_level() - knet_log_mode = KNET_LOG_DEBUG; - break; - case LOGSYS_DEBUG_TRACE: -+#ifdef KNET_LOG_TRACE -+ knet_log_mode = KNET_LOG_TRACE; -+#else - knet_log_mode = KNET_LOG_DEBUG; -+#endif - break; - } - log_printf (LOGSYS_LEVEL_DEBUG, "totemknet setting log level %s", knet_log_get_loglevel_name(knet_log_mode)); -+ err = 0; - for (s = 0; sknet_handle, s, knet_log_mode); -+ err = knet_log_set_loglevel(global_instance->knet_handle, s, knet_log_mode); -+ } -+ -+ /* If one fails, they all fail. no point in issuing KNET_MAX_SUBSYSTEMS errors */ -+ if (err) { -+ log_printf (LOGSYS_LEVEL_ERROR, "totemknet failed to set log level: %s", strerror(errno)); - } - } - - diff --git a/corosync-3.1.7.tar.gz b/corosync-3.1.7.tar.gz deleted file mode 100644 index a8a2221..0000000 Binary files a/corosync-3.1.7.tar.gz and /dev/null differ diff --git a/corosync-3.1.8.tar.gz b/corosync-3.1.8.tar.gz new file mode 100644 index 0000000..ec79280 Binary files /dev/null and b/corosync-3.1.8.tar.gz differ diff --git a/corosync.spec b/corosync.spec index b968532..4166bf2 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,16 +17,12 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.7 -Release: 5 +Version: 3.1.8 +Release: 1 License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz -# https://github.com/corosync/corosync/pull/717 -Patch0: Use-knet-TRACE-logging-level-if-available.patch -Patch1: Fail-to-start-if-knet-ping-timers-are-invalid.patch -Patch2: Fix-integer-overflow.patch # Runtime bits # The automatic dependency overridden in favor of explicit version lock Requires: corosynclib = %{version}-%{release} @@ -71,12 +67,10 @@ Requires: libxslt %if %{with vqsim} BuildRequires: readline-devel %endif +BuildRequires: make %prep %setup -q -n %{name}-%{version}%{?gittarver} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 %build %if %{with runautogen} @@ -294,6 +288,9 @@ network splits) %endif %changelog +* Fri Nov 24 2023 zouzhimin - 3.1.8-1 +- update package to version 3.1.8 + * Tue Nov 7 2023 bixiaoyan - 3.1.7-5 - Fix integer overflow