diff --git a/.gitignore b/.gitignore index 7334550..eafa358 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ ipvsadm-1.25.tar.gz /ipvsadm-1.27.tar.gz /ipvsadm-1.28.tar.gz /ipvsadm-1.29.tar.gz -/ipvsadm-1.31.tar.gz diff --git a/0001-ipvsadm-catch-the-original-errno-from-netlink-answer.patch b/0001-ipvsadm-catch-the-original-errno-from-netlink-answer.patch new file mode 100644 index 0000000..a9ffeec --- /dev/null +++ b/0001-ipvsadm-catch-the-original-errno-from-netlink-answer.patch @@ -0,0 +1,80 @@ +From f8cff0808a24b1dd141e86cc8039108aa1763071 Mon Sep 17 00:00:00 2001 +From: Julian Anastasov +Date: Sat, 5 Aug 2017 14:38:28 +0300 +Subject: [PATCH 1/2] ipvsadm: catch the original errno from netlink answer + +nl_recvmsgs_default() returns NLE_* error codes and not +errno values. As result, attempt to delete virtual service +returns NLE_OBJ_NOTFOUND (12) which matches the ENOMEM value. + +Problem as reported by Emanuele Rocca: + +ipvsadm -D -t example.org:80 +Memory allocation problem + +Fix it by providing generic error handler to catch the errno +value as returned in netlink answer. By this way all netlink +commands will get proper error string. The problem is present +only when ipvsadm is compiled with libnl. + +ipvsadm -D -t example.org:80 +No such service + +Reported-by: Emanuele Rocca +Signed-off-by: Julian Anastasov +Signed-off-by: Jesper Dangaard Brouer +--- + libipvs/libipvs.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/libipvs/libipvs.c b/libipvs/libipvs.c +index 180ea42..d271c48 100644 +--- a/libipvs/libipvs.c ++++ b/libipvs/libipvs.c +@@ -74,9 +74,23 @@ static int ipvs_nl_noop_cb(struct nl_msg *msg, void *arg) + return NL_OK; + } + ++struct cb_err_data { ++ int err; ++}; ++ ++static int ipvs_nl_err_cb(struct sockaddr_nl *nla, struct nlmsgerr *nlerr, ++ void *arg) ++{ ++ struct cb_err_data *data = arg; ++ ++ data->err = nlerr->error; ++ return -nl_syserr2nlerr(nlerr->error); ++} ++ + int ipvs_nl_send_message(struct nl_msg *msg, nl_recvmsg_msg_cb_t func, void *arg) + { + int err = EINVAL; ++ struct cb_err_data err_data = { .err = 0 }; + + sock = nl_socket_alloc(); + if (!sock) { +@@ -100,12 +114,18 @@ int ipvs_nl_send_message(struct nl_msg *msg, nl_recvmsg_msg_cb_t func, void *arg + + if (nl_socket_modify_cb(sock, NL_CB_VALID, NL_CB_CUSTOM, func, arg) != 0) + goto fail_genl; ++ if (nl_socket_modify_err_cb(sock, NL_CB_CUSTOM, ipvs_nl_err_cb, ++ &err_data) != 0) ++ goto fail_genl; + + if (nl_send_auto_complete(sock, msg) < 0) + goto fail_genl; + +- if ((err = -nl_recvmsgs_default(sock)) > 0) ++ if (nl_recvmsgs_default(sock) < 0) { ++ if (err_data.err) ++ err = -err_data.err; + goto fail_genl; ++ } + + nlmsg_free(msg); + +-- +2.14.3 + diff --git a/0002-libipvs-discrepancy-with-libnl-genlmsg_put.patch b/0002-libipvs-discrepancy-with-libnl-genlmsg_put.patch new file mode 100644 index 0000000..09e0b3d --- /dev/null +++ b/0002-libipvs-discrepancy-with-libnl-genlmsg_put.patch @@ -0,0 +1,40 @@ +From 76c1270148161242f240d9a00746cf06d916b3e3 Mon Sep 17 00:00:00 2001 +From: Arthur Gautier +Date: Wed, 27 Sep 2017 15:31:05 +0000 +Subject: [PATCH 2/2] libipvs: discrepancy with libnl genlmsg_put + +There is a mixup between NL_AUTO_PORT and NL_AUTO_PID. The +first should be used with genlmsg_put while the second with +nlmsg_put. + +This is not a problem, because both NL_AUTO_PORT and NL_AUTO_PID +have the same value, but still a discrepancy with libnl documentation. + +see documentation of genlmsg_put here: + http://www.infradead.org/~tgr/libnl/doc/api/group__genl.html#ga9a86a71bbba6961d41b8a75f62f9e946 + +Cc: Julian Anastasov +Cc: Simon Horman +Cc: Jesper Dangaard Brouer +Signed-off-by: Arthur Gautier +Signed-off-by: Jesper Dangaard Brouer +--- + libipvs/libipvs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libipvs/libipvs.c b/libipvs/libipvs.c +index d271c48..a843243 100644 +--- a/libipvs/libipvs.c ++++ b/libipvs/libipvs.c +@@ -63,7 +63,7 @@ struct nl_msg *ipvs_nl_message(int cmd, int flags) + if (!msg) + return NULL; + +- genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, flags, ++ genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, family, 0, flags, + cmd, IPVS_GENL_VERSION); + + return msg; +-- +2.14.3 + diff --git a/0003-ipvsadm-use-CFLAGS-and-LDFLAGS-environment-variables.patch b/0003-ipvsadm-use-CFLAGS-and-LDFLAGS-environment-variables.patch deleted file mode 100644 index 20e0cbe..0000000 --- a/0003-ipvsadm-use-CFLAGS-and-LDFLAGS-environment-variables.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 25d7aa2faef0c36f053ee1ba418fe14022ef6f7c Mon Sep 17 00:00:00 2001 -From: Ryan O'Hara -Date: Tue, 27 Feb 2018 11:49:44 -0600 -Subject: [PATCH] ipvsadm: use CFLAGS and LDFLAGS environment variables - -Signed-off-by: Ryan O'Hara ---- - Makefile | 6 +++--- - libipvs/Makefile | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Makefile b/Makefile -index 91a2991..2a1d179 100644 ---- a/Makefile -+++ b/Makefile -@@ -46,9 +46,9 @@ INSTALL = install - STATIC_LIBS = libipvs/libipvs.a - - ifeq "${ARCH}" "sparc64" -- CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow -+ CFLAGS += -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow - else -- CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -+ CFLAGS += -Wall -Wunused -Wstrict-prototypes -g - endif - - -@@ -87,7 +87,7 @@ libs: - make -C libipvs - - ipvsadm: $(OBJS) $(STATIC_LIBS) -- $(CC) $(CFLAGS) -o $@ $^ $(LIBS) -+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) - - install: all - if [ ! -d $(SBIN) ]; then $(MKDIR) -p $(SBIN); fi -diff --git a/libipvs/Makefile b/libipvs/Makefile -index f845c8b..780f3f3 100644 ---- a/libipvs/Makefile -+++ b/libipvs/Makefile -@@ -1,7 +1,7 @@ - # Makefile for libipvs - - CC = gcc --CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -fPIC -+CFLAGS += -Wall -Wunused -Wstrict-prototypes -g -fPIC - ifneq (0,$(HAVE_NL)) - CFLAGS += -DLIBIPVS_USE_NL - CFLAGS += $(shell \ --- -2.14.3 - diff --git a/ipvsadm.spec b/ipvsadm.spec index 077d156..2b8fe36 100644 --- a/ipvsadm.spec +++ b/ipvsadm.spec @@ -1,21 +1,20 @@ Name: ipvsadm Summary: Utility to administer the Linux Virtual Server -Version: 1.31 -Release: 16%{?dist} -License: GPL-2.0-or-later +Version: 1.29 +Release: 5%{?dist} +License: GPLv2+ URL: https://kernel.org/pub/linux/utils/kernel/ipvsadm/ Source0: https://kernel.org/pub/linux/utils/kernel/ipvsadm/%{name}-%{version}.tar.gz Source1: ipvsadm.service Source2: ipvsadm-config -Patch0: 0003-ipvsadm-use-CFLAGS-and-LDFLAGS-environment-variables.patch +Patch1: 0001-ipvsadm-catch-the-original-errno-from-netlink-answer.patch +Patch2: 0002-libipvs-discrepancy-with-libnl-genlmsg_put.patch -BuildRequires: gcc Buildrequires: libnl3-devel Buildrequires: popt-devel BuildRequires: systemd -BuildRequires: make Requires(post): systemd Requires(preun): systemd @@ -37,11 +36,11 @@ services. Supported Features include: %prep %setup -q -%patch -P0 -p1 +%patch1 -p1 +%patch2 -p1 %build -%set_build_flags -%{__make} +CFLAGS="%{optflags}" make %install %{__rm} -rf %{buildroot} @@ -52,6 +51,9 @@ services. Supported Features include: %{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service %{__install} -p -D -m 0600 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-config +%clean +%{__rm} -rf %{buildroot} + %post %systemd_post %{name}.service @@ -62,6 +64,7 @@ services. Supported Features include: %systemd_postun_with_restart %{name}.service %files +%defattr(-,root,root,-) %doc MAINTAINERS README %{_unitdir}/%{name}.service %config(noreplace) %{_sysconfdir}/sysconfig/%{name}-config @@ -73,73 +76,6 @@ services. Supported Features include: %{_mandir}/man8/%{name}-save.8* %changelog -* Thu Jul 24 2025 Fedora Release Engineering - 1.31-16 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Fri Jan 17 2025 Fedora Release Engineering - 1.31-15 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Thu Jul 18 2024 Fedora Release Engineering - 1.31-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Wed Jan 24 2024 Fedora Release Engineering - 1.31-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sat Jan 20 2024 Fedora Release Engineering - 1.31-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Fri Aug 04 2023 Ryan O'Hara - 1.31-11 -- Migrate to SPDX license - -* Thu Jul 20 2023 Fedora Release Engineering - 1.31-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Thu Jan 19 2023 Fedora Release Engineering - 1.31-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Thu Jul 21 2022 Fedora Release Engineering - 1.31-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Thu Jan 20 2022 Fedora Release Engineering - 1.31-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Thu Jul 22 2021 Fedora Release Engineering - 1.31-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 1.31-5 -- Rebuilt for updated systemd-rpm-macros - See https://pagure.io/fesco/issue/2583. - -* Tue Jan 26 2021 Fedora Release Engineering - 1.31-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Tue Jul 28 2020 Fedora Release Engineering - 1.31-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Wed Jan 29 2020 Fedora Release Engineering - 1.31-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Thu Jan 02 2020 Ryan O'Hara - 1.31-1 -- Update to 1.31 (#1726210) - -* Thu Jul 25 2019 Fedora Release Engineering - 1.29-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Fri Feb 01 2019 Fedora Release Engineering - 1.29-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Fri Jul 13 2018 Fedora Release Engineering - 1.29-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Tue Feb 27 2018 Ryan O'Hara - 1.29-8 -- Use CFLAGS and LDFLAGS environment variables (#1543790) - -* Fri Feb 23 2018 Ryan O'Hara - 1.29-7 -- Add %set_build_flags (#1543790) - -* Wed Feb 07 2018 Fedora Release Engineering - 1.29-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - * Mon Feb 05 2018 Ryan O'Hara - 1.29-5 - Catch the original errno from netlink answer (#1526813) diff --git a/sources b/sources index 189522c..a0c6118 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ipvsadm-1.31.tar.gz) = c02cc54c6c44ac94de632b087a1f95ba9cd4e622e48471e2643900905cd84fa2335496c955ee6507497c7252227575cf309ed97924e062c61d719218bfc25a07 +SHA512 (ipvsadm-1.29.tar.gz) = ea0213444ef706e217c63561157c8273a555a5c2ed368bb0a086fa246002ee393f5f0223e144137fa0146738f8149b07f706275155df87e04fcf75ba5b3c8aca