From 2625fb0d5ef5265f340f57332e46b339ff717f0a Mon Sep 17 00:00:00 2001 From: Ryan O'Hara Date: Thu, 22 Dec 2022 20:28:35 -0600 Subject: [PATCH] Fix variable substitution in conditional lines Resolves: #2101493 --- bz2102493-fix-variable-substitution.patch | 32 +++++++++++++++++++++++ keepalived.spec | 7 ++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 bz2102493-fix-variable-substitution.patch diff --git a/bz2102493-fix-variable-substitution.patch b/bz2102493-fix-variable-substitution.patch new file mode 100644 index 0000000..d670c1a --- /dev/null +++ b/bz2102493-fix-variable-substitution.patch @@ -0,0 +1,32 @@ +From 332262ec91f85cd4224816d2803d818015239007 Mon Sep 17 00:00:00 2001 +From: Quentin Armitage +Date: Wed, 29 Jun 2022 09:18:15 +0100 +Subject: [PATCH] parser: optimise fixing recalculating updated line length + +Commit 1ffad9a - "recalculate buffer length inside recheck loop" +resolved the issue but calls strlen(buf) more often than necessary. + +This commit only calls strlen(buf) when the line buffer is modified. + +Signed-off-by: Quentin Armitage +--- + lib/parser.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/parser.c b/lib/parser.c +index bcabd07f..2146f38b 100644 +--- a/lib/parser.c ++++ b/lib/parser.c +@@ -2809,6 +2809,9 @@ read_line(char *buf, size_t size) + recheck = true; + if (strchr(buf, '$')) + recheck = true; ++ ++ if (recheck) ++ len = strlen(buf); + } + } while (recheck); + } while (buf[0] == '\0' || check_include(buf)); +-- +2.38.1 + diff --git a/keepalived.spec b/keepalived.spec index b59ec50..40fdef7 100644 --- a/keepalived.spec +++ b/keepalived.spec @@ -11,7 +11,7 @@ Name: keepalived Summary: High Availability monitor built upon LVS, VRRP and service pollers Version: 2.2.4 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ URL: http://www.keepalived.org/ @@ -19,6 +19,7 @@ Source0: http://www.keepalived.org/software/keepalived-%{version}.tar.gz Source1: keepalived.service Patch1: bz2028351-fix-dbus-policy-restrictions.patch +Patch2: bz2102493-fix-variable-substitution.patch Requires(post): systemd Requires(preun): systemd @@ -60,6 +61,7 @@ infrastructures. %prep %setup -q %patch1 -p1 +%patch2 -p1 %build %configure \ @@ -110,6 +112,9 @@ mkdir -p %{buildroot}%{_libexecdir}/keepalived %{_mandir}/man8/keepalived.8* %changelog +* Thu Dec 22 2022 Ryan O'Hara - 2.2.4-4 +- Fix variable substitution in consditional lines (#2101493) + * Thu Dec 22 2022 Ryan O'Hara - 2.2.4-3 - Enable JSON support (#2129819)