diff --git a/.gitignore b/.gitignore index fc05a06..64c0b73 100644 --- a/.gitignore +++ b/.gitignore @@ -31,12 +31,3 @@ /keepalived-2.0.12.tar.gz /keepalived-2.0.18.tar.gz /keepalived-2.0.19.tar.gz -/keepalived-2.0.20.tar.gz -/keepalived-2.1.5.tar.gz -/keepalived-2.2.0.tar.gz -/keepalived-2.2.1.tar.gz -/keepalived-2.2.2.tar.gz -/keepalived-2.2.3.tar.gz -/keepalived-2.2.4.tar.gz -/keepalived-2.2.7.tar.gz -/keepalived-2.2.8.tar.gz diff --git a/keepalived-configure-c99.patch b/keepalived-configure-c99.patch deleted file mode 100644 index cabf8d9..0000000 --- a/keepalived-configure-c99.patch +++ /dev/null @@ -1,51 +0,0 @@ -Fix a configure check that happens to trigger and implicit function -declaration error. - -Fixed slightly differently in upstream via: - -commit 516032ec39169d05c613de0e8ee10845658748ff -Author: Quentin Armitage -Date: Sun Apr 17 18:02:18 2022 +0100 - - config parser: Fix segfault caused by extra '}' and other parser fixes - - If there was a configuration error in a block, e.g. a vrrp_instance, - keepalived would apply the configuration in the rest of the block to - the previous object of that type, e.g. the previous vrrp instance. If - there had been no previous instance, keepalived would probably segfault. - - This commit changes the way the parser works. A new instance of an - object, e.g. a VRRP instance or a virtual server, is only added to the - list of those objects once the configuration of that object is complete. - In particular it no longer applies the configuration to the last entry - on the list of the relevant object type, but keeps a point to the - object currently being configured. - - Signed-off-by: Quentin Armitage - -diff --git a/configure b/configure -index 7cd6c4f614930391..b099b8f42aca1cba 100755 ---- a/configure -+++ b/configure -@@ -6382,7 +6382,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext - - #include - -- static int func(int i) __attribute__((error("deliberate error"))) -+ static int __attribute__((error("deliberate error"))) func(int i) - { - return i * 2; - } -diff --git a/configure.ac b/configure.ac -index 350a9f4e9567518c..5546143b4630aff6 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -792,7 +792,7 @@ AC_COMPILE_IFELSE( - [[ - #include - -- static int func(int i) __attribute__((error("deliberate error"))) -+ static int __attribute__((error("deliberate error"))) func(int i) - { - return i * 2; - } diff --git a/keepalived-fix-file-descriptor-errors-on-reload.patch b/keepalived-fix-file-descriptor-errors-on-reload.patch new file mode 100644 index 0000000..1530517 --- /dev/null +++ b/keepalived-fix-file-descriptor-errors-on-reload.patch @@ -0,0 +1,164 @@ +From 1c3c8eefd0a40d4938d6f05969c886988116a425 Mon Sep 17 00:00:00 2001 +From: Quentin Armitage +Date: Wed, 6 Nov 2019 23:15:23 +0000 +Subject: [PATCH] Resolve file descriptor errors on reload + +If a read or write thread was on the thread reaady queue when a +reload was processed, the file descriptor was not removed from the +epoll instance. + +This commit ensures that file descriptors relating to threads on +the thread ready queue are removed from the epoll instance during +a reload. + +Signed-off-by: Quentin Armitage +--- + keepalived/bfd/bfd_scheduler.c | 2 +- + keepalived/check/check_bfd.c | 2 +- + keepalived/vrrp/vrrp_scheduler.c | 2 +- + lib/scheduler.c | 31 +++++++++++++++++++------------ + lib/scheduler.h | 3 ++- + 5 files changed, 24 insertions(+), 16 deletions(-) + +diff --git a/keepalived/bfd/bfd_scheduler.c b/keepalived/bfd/bfd_scheduler.c +index 5c3d0691..d51d420f 100644 +--- a/keepalived/bfd/bfd_scheduler.c ++++ b/keepalived/bfd/bfd_scheduler.c +@@ -908,7 +908,7 @@ bfd_receiver_thread(thread_ref_t thread) + data->thread_in = NULL; + + /* Ignore THREAD_READ_TIMEOUT */ +- if (thread->type == THREAD_READY_FD) { ++ if (thread->type == THREAD_READY_READ_FD) { + if (!bfd_receive_packet(&pkt, fd, bfd_buffer, BFD_BUFFER_SIZE)) + bfd_handle_packet(&pkt); + } +diff --git a/keepalived/check/check_bfd.c b/keepalived/check/check_bfd.c +index 4bd8af23..f9590c30 100644 +--- a/keepalived/check/check_bfd.c ++++ b/keepalived/check/check_bfd.c +@@ -290,7 +290,7 @@ bfd_check_thread(thread_ref_t thread) + bfd_thread = thread_add_read(master, bfd_check_thread, NULL, + thread->u.f.fd, TIMER_NEVER, false); + +- if (thread->type != THREAD_READY_FD) ++ if (thread->type != THREAD_READY_READ_FD) + return 0; + + while (read(thread->u.f.fd, &evt, sizeof(bfd_event_t)) != -1) +diff --git a/keepalived/vrrp/vrrp_scheduler.c b/keepalived/vrrp/vrrp_scheduler.c +index 91a4898c..7e6da60a 100644 +--- a/keepalived/vrrp/vrrp_scheduler.c ++++ b/keepalived/vrrp/vrrp_scheduler.c +@@ -762,7 +762,7 @@ vrrp_bfd_thread(thread_ref_t thread) + bfd_thread = thread_add_read(master, vrrp_bfd_thread, NULL, + thread->u.f.fd, TIMER_NEVER, false); + +- if (thread->type != THREAD_READY_FD) ++ if (thread->type != THREAD_READY_READ_FD) + return 0; + + while (read(thread->u.f.fd, &evt, sizeof(bfd_event_t)) != -1) +diff --git a/lib/scheduler.c b/lib/scheduler.c +index 8fc2a032..3cd7b65a 100644 +--- a/lib/scheduler.c ++++ b/lib/scheduler.c +@@ -116,7 +116,8 @@ get_thread_type_str(thread_type_t id) + if (id == THREAD_CHILD_TERMINATED) return "CHILD_TERMINATED"; + if (id == THREAD_TERMINATE_START) return "TERMINATE_START"; + if (id == THREAD_TERMINATE) return "TERMINATE"; +- if (id == THREAD_READY_FD) return "READY_FD"; ++ if (id == THREAD_READY_READ_FD) return "READY_READ_FD"; ++ if (id == THREAD_READY_WRITE_FD) return "READY_WRITE_FD"; + if (id == THREAD_READ_ERROR) return "READ_ERROR"; + if (id == THREAD_WRITE_ERROR) return "WRITE_ERROR"; + #ifdef USE_SIGNAL_THREADS +@@ -859,7 +860,8 @@ thread_destroy_rb(thread_master_t *m, rb_root_cached_t *root) + + if (thread->type == THREAD_READ || + thread->type == THREAD_WRITE || +- thread->type == THREAD_READY_FD || ++ thread->type == THREAD_READY_READ_FD || ++ thread->type == THREAD_READY_WRITE_FD || + thread->type == THREAD_READ_TIMEOUT || + thread->type == THREAD_WRITE_TIMEOUT || + thread->type == THREAD_READ_ERROR || +@@ -1409,14 +1411,18 @@ thread_cancel(thread_ref_t thread_cp) + rb_erase_cached(&thread->n, &m->child); + rb_erase(&thread->rb_data, &m->child_pid); + break; +- case THREAD_READY_FD: ++ case THREAD_READY_READ_FD: + case THREAD_READ_TIMEOUT: ++ if (thread->event) ++ thread_event_del(thread, THREAD_FL_EPOLL_READ_BIT); ++ list_head_del(&thread->next); ++ break; ++ case THREAD_READY_WRITE_FD: + case THREAD_WRITE_TIMEOUT: +- if (thread->event) { +- rb_erase(&thread->event->n, &m->io_events); +- FREE(thread->event); +- } +- /* ... falls through ... */ ++ if (thread->event) ++ thread_event_del(thread, THREAD_FL_EPOLL_WRITE_BIT); ++ list_head_del(&thread->next); ++ break; + case THREAD_EVENT: + case THREAD_READY: + #ifdef USE_SIGNAL_THREADS +@@ -1735,7 +1741,7 @@ thread_fetch_next_queue(thread_master_t *m) + , ev->fd, ep_ev->events); + continue; + } +- thread_move_ready(m, &m->read, ev->read, THREAD_READY_FD); ++ thread_move_ready(m, &m->read, ev->read, THREAD_READY_READ_FD); + ev->read = NULL; + } + +@@ -1746,7 +1752,7 @@ thread_fetch_next_queue(thread_master_t *m) + , ev->fd, ep_ev->events); + continue; + } +- thread_move_ready(m, &m->write, ev->write, THREAD_READY_FD); ++ thread_move_ready(m, &m->write, ev->write, THREAD_READY_WRITE_FD); + ev->write = NULL; + } + } +@@ -1804,7 +1810,8 @@ process_threads(thread_master_t *m) + * snmp_read, bfd_receiver, bfd pipe in vrrp/check, dbus pipe or netlink fds. */ + thread = thread_trim_head(thread_list); + if (!shutting_down || +- (thread->type == THREAD_READY_FD && ++ ((thread->type == THREAD_READY_READ_FD || ++ thread->type == THREAD_READY_WRITE_FD) && + (thread->u.f.fd == m->timer_fd || + thread->u.f.fd == m->signal_fd + #ifdef _WITH_SNMP_ +@@ -1823,7 +1830,7 @@ process_threads(thread_master_t *m) + shutting_down = true; + } + +- m->current_event = (thread->type == THREAD_READY_FD) ? thread->event : NULL; ++ m->current_event = (thread->type == THREAD_READY_READ_FD || thread->type == THREAD_READY_WRITE_FD) ? thread->event : NULL; + thread_type = thread->type; + thread_add_unuse(master, thread); + +diff --git a/lib/scheduler.h b/lib/scheduler.h +index 69324fe0..fea99cd0 100644 +--- a/lib/scheduler.h ++++ b/lib/scheduler.h +@@ -56,7 +56,8 @@ typedef enum { + THREAD_CHILD_TERMINATED, + THREAD_TERMINATE_START, + THREAD_TERMINATE, +- THREAD_READY_FD, ++ THREAD_READY_READ_FD, ++ THREAD_READY_WRITE_FD, + THREAD_READ_ERROR, + THREAD_WRITE_ERROR, + #ifdef USE_SIGNAL_THREADS +-- +2.23.0 + diff --git a/keepalived-fix-track_process-with-pids-32767.patch b/keepalived-fix-track_process-with-pids-32767.patch new file mode 100644 index 0000000..35b7025 --- /dev/null +++ b/keepalived-fix-track_process-with-pids-32767.patch @@ -0,0 +1,49 @@ +From 23a5b8113bf0b8ec4718443df0406882e8e4d831 Mon Sep 17 00:00:00 2001 +From: Quentin Armitage +Date: Sat, 9 Nov 2019 10:07:48 +0000 +Subject: [PATCH] Fix track_process with PIDs > 32767 + +Signed-off-by: Quentin Armitage +--- + keepalived/core/track_process.c | 4 ++-- + lib/scheduler.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/keepalived/core/track_process.c b/keepalived/core/track_process.c +index 550254b1..76ff6009 100644 +--- a/keepalived/core/track_process.c ++++ b/keepalived/core/track_process.c +@@ -341,7 +341,7 @@ check_process(pid_t pid, char *comm, tracked_process_instance_t *tpi) + * swapped in to read it. */ + if (!have_comm) { + if (vrrp_data->vrrp_use_process_cmdline) { +- snprintf(cmdline, sizeof(cmdline), "/proc/%hd/cmdline", pid); ++ snprintf(cmdline, sizeof(cmdline), "/proc/%d/cmdline", pid); + + if ((fd = open(cmdline, O_RDONLY)) == -1) + return; +@@ -358,7 +358,7 @@ check_process(pid_t pid, char *comm, tracked_process_instance_t *tpi) + } + + if (vrrp_data->vrrp_use_process_comm) { +- snprintf(cmdline, sizeof(cmdline), "/proc/%hd/comm", pid); ++ snprintf(cmdline, sizeof(cmdline), "/proc/%d/comm", pid); + + fd = open(cmdline, O_RDONLY); + if (fd == -1) { +diff --git a/lib/scheduler.c b/lib/scheduler.c +index 3cd7b65a..de92c7d4 100644 +--- a/lib/scheduler.c ++++ b/lib/scheduler.c +@@ -441,7 +441,7 @@ report_child_status(int status, pid_t pid, char const *prog_name) + prog_id = child_finder_name(pid); + + if (!prog_id) { +- snprintf(pid_buf, sizeof(pid_buf), "pid %hd", pid); ++ snprintf(pid_buf, sizeof(pid_buf), "pid %d", pid); + prog_id = pid_buf; + } + +-- +2.23.0 + diff --git a/keepalived.service b/keepalived.service index b4a521d..a5a9b28 100644 --- a/keepalived.service +++ b/keepalived.service @@ -4,12 +4,11 @@ After=network-online.target syslog.target Wants=network-online.target [Service] -Type=notify -NotifyAccess=all +Type=forking PIDFile=/run/keepalived.pid KillMode=process EnvironmentFile=-/etc/sysconfig/keepalived -ExecStart=/usr/sbin/keepalived --dont-fork $KEEPALIVED_OPTIONS +ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS ExecReload=/bin/kill -HUP $MAINPID [Install] diff --git a/keepalived.spec b/keepalived.spec index 28896aa..8e73f42 100644 --- a/keepalived.spec +++ b/keepalived.spec @@ -1,7 +1,6 @@ %bcond_without snmp %bcond_without vrrp %bcond_without sha1 -%bcond_without json %bcond_without nftables %bcond_with profile %bcond_with debug @@ -10,14 +9,16 @@ Name: keepalived Summary: High Availability monitor built upon LVS, VRRP and service pollers -Version: 2.2.8 -Release: 8%{?dist} -License: GPL-2.0-or-later +Version: 2.0.19 +Release: 4%{?dist} +License: GPLv2+ URL: http://www.keepalived.org/ Source0: http://www.keepalived.org/software/keepalived-%{version}.tar.gz Source1: keepalived.service -#Patch0: keepalived-configure-c99.patch + +Patch0: keepalived-fix-track_process-with-pids-32767.patch +Patch1: keepalived-fix-file-descriptor-errors-on-reload.patch Requires(post): systemd Requires(preun): systemd @@ -27,20 +28,15 @@ Requires(postun): systemd BuildRequires: net-snmp-devel %endif %if %{with nftables} -BuildRequires: libmnl-devel BuildRequires: libnftnl-devel -%else -BuildRequires: ipset-devel -BuildRequires: iptables-devel %endif BuildRequires: gcc BuildRequires: systemd-units -BuildRequires: systemd-devel BuildRequires: openssl-devel BuildRequires: libnl3-devel +BuildRequires: ipset-devel +BuildRequires: iptables-devel BuildRequires: libnfnetlink-devel -BuildRequires: file-devel -BuildRequires: make %description Keepalived provides simple and robust facilities for load balancing @@ -57,10 +53,9 @@ can be used independently or all together to provide resilient infrastructures. %prep -%autosetup -p1 - -# Prevent re-running autotools. -touch aclocal.m4 Makefile.in lib/config.h.in configure +%setup -q +%patch0 -p1 +%patch1 -p1 %build %configure \ @@ -68,8 +63,7 @@ touch aclocal.m4 Makefile.in lib/config.h.in configure %{?with_profile:--enable-profile} \ %{!?with_vrrp:--disable-vrrp} \ %{?with_snmp:--enable-snmp --enable-snmp-rfc} \ - %{?with_nftables:--enable-nftables --disable-iptables} \ - %{?with_json:--enable-json} \ + %{?with_nftables:--enable-nftables} \ %{?with_sha1:--enable-sha1} \ --with-init=systemd %{__make} %{?_smp_mflags} STRIP=/bin/true @@ -79,8 +73,6 @@ rm -rf %{buildroot} make install DESTDIR=%{buildroot} rm -rf %{buildroot}%{_initrddir}/ rm -rf %{buildroot}%{_sysconfdir}/keepalived/samples/ -mv %{buildroot}%{_sysconfdir}/keepalived/keepalived.conf.sample \ - %{buildroot}%{_sysconfdir}/keepalived/keepalived.conf %{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/keepalived.service mkdir -p %{buildroot}%{_libexecdir}/keepalived @@ -113,115 +105,6 @@ mkdir -p %{buildroot}%{_libexecdir}/keepalived %{_mandir}/man8/keepalived.8* %changelog -* Thu Jul 24 2025 Fedora Release Engineering - 2.2.8-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Fri Jan 17 2025 Fedora Release Engineering - 2.2.8-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Thu Jul 18 2024 Fedora Release Engineering - 2.2.8-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Wed Jan 24 2024 Fedora Release Engineering - 2.2.8-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sun Jan 21 2024 Fedora Release Engineering - 2.2.8-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Fri Aug 04 2023 Ryan O'Hara - 2.2.8-3 -- Migrate to SPDX license - -* Thu Jul 20 2023 Fedora Release Engineering - 2.2.8-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Thu Jun 08 2023 Ryan O'Hara - 2.2.8-1 -- Update to 2.2.8 (#2211385) - -* Thu Jan 19 2023 Fedora Release Engineering - 2.2.7-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Tue Dec 20 2022 Ryan O'Hara - 2.2.7-5 -- Enable JSON support - -* Wed Dec 7 2022 Florian Weimer - 2.2.7-4 -- Fix spurious implicit function declaration in broken configure check - -* Thu Jul 21 2022 Fedora Release Engineering - 2.2.7-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Thu Jul 07 2022 Ryan O'Hara - 2.2.7-2 -- Move keepalived.conf.sample to keepalived.conf - -* Mon Feb 14 2022 Ryan O'Hara - 2.2.7-1 -- Update to 2.2.7 (#2041231) - -* Thu Jan 20 2022 Fedora Release Engineering - 2.2.4-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Tue Dec 14 2021 Ryan O'Hara - 2.2.4-4 -- Fix dbus policy (#2027158, CVE-2021-44225) - -* Sat Nov 27 2021 Kevin Fenzi - 2.2.4-3 -- Rebuild for new libnftnl - -* Tue Sep 14 2021 Sahana Prasad - 2.2.4-2 -- Rebuilt with OpenSSL 3.0.0 - -* Mon Aug 23 2021 Ryan O'Hara - 2.2.4-1 -- Update to 2.2.4 (#1996274) - -* Sat Aug 14 2021 Ryan O'Hara - 2.2.3-1 -- Update to 2.2.3 (#1993601) - -* Tue Aug 03 2021 Ryan O'Hara - 2.2.2-5 -- Add systemd notify support - -* Tue Aug 03 2021 Ryan O'Hara - 2.2.2-4 -- Fix build errors (#1987620) - -* Thu Jul 22 2021 Fedora Release Engineering - 2.2.2-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Mon Apr 12 2021 Ryan O'Hara - 2.2.2-2 -- Add BuildRequires for file-devel - -* Wed Apr 07 2021 Ryan O'Hara - 2.2.2-1 -- Update to 2.2.2 (#1935590) - -* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 2.2.1-3 -- Rebuilt for updated systemd-rpm-macros - See https://pagure.io/fesco/issue/2583. - -* Tue Jan 26 2021 Fedora Release Engineering - 2.2.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Mon Jan 18 2021 Ryan O'Hara - 2.2.1-1 -- Update to 2.2.1 (#1917152) - -* Thu Jan 14 2021 Ryan O'Hara - 2.2.0-1 -- Update to 2.2.0 (#1914512) - -* Thu Aug 27 2020 Josef Řídký - 2.1.5-3 -- Rebuilt for new net-snmp release - -* Tue Jul 28 2020 Fedora Release Engineering - 2.1.5-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Wed Jul 15 2020 Ryan O'Hara - 2.1.5-1 -- Update to 2.1.5 (#1794135) - -* Tue Feb 18 2020 Ryan O'Hara - 2.0.20-3 -- Build with nftables support instead of iptables - -* Thu Feb 13 2020 Ryan O'Hara - 2.0.20-2 -- Remove unused patches - -* Wed Feb 12 2020 Ryan O'Hara - 2.0.20-1 -- Update to 2.0.20 (#1794135) - -* Wed Jan 29 2020 Fedora Release Engineering - 2.0.19-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - * Tue Nov 12 2019 Ryan O'Hara - 2.0.19-4 - Fix file descriptor errors on reload diff --git a/sources b/sources index 68261a4..e7a9ff7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (keepalived-2.2.8.tar.gz) = dc0ab5b0ef8911a7859422eccc2771a40e942236c855a628158ed748eb5f7dc4b6f4850e9c3057e81fd9d2daa640ab51fb1d7af12748a613280a217b333eb06b +SHA512 (keepalived-2.0.19.tar.gz) = 68a510983bc043484e5edbc1d87563677a048282ec52873105f0af922e8b4de5b8e7176944010f9d4d6f65d1a4ebaf930c3d37273e28c1f115ed0fda245d8109