Blame SOURCES/0037-libxtables-Register-multiple-extensions-in-ascending.patch

b144b7
From cfcafd3638cdc06a8b4a1d267e58b5ad1e35922c Mon Sep 17 00:00:00 2001
b144b7
From: Phil Sutter <phil@nwl.cc>
b144b7
Date: Tue, 22 Sep 2020 20:01:15 +0200
b144b7
Subject: [PATCH] libxtables: Register multiple extensions in ascending order
b144b7
b144b7
The newly introduced ordered insert algorithm in
b144b7
xtables_register_{match,target}() works best if extensions of same name
b144b7
are passed in ascending revisions. Since this is the case in about all
b144b7
extensions' arrays, iterate over them from beginning to end.
b144b7
b144b7
Signed-off-by: Phil Sutter <phil@nwl.cc>
b144b7
(cherry picked from commit b5f1a3beac1d1f2b96c8be8ebec450f5ea758090)
b144b7
Signed-off-by: Phil Sutter <psutter@redhat.com>
b144b7
---
b144b7
 libxtables/xtables.c | 14 ++++++++------
b144b7
 1 file changed, 8 insertions(+), 6 deletions(-)
b144b7
b144b7
diff --git a/libxtables/xtables.c b/libxtables/xtables.c
b144b7
index 409128333e0e6..28ffffedd8147 100644
b144b7
--- a/libxtables/xtables.c
b144b7
+++ b/libxtables/xtables.c
b144b7
@@ -1095,9 +1095,10 @@ static bool xtables_fully_register_pending_match(struct xtables_match *me,
b144b7
 
b144b7
 void xtables_register_matches(struct xtables_match *match, unsigned int n)
b144b7
 {
b144b7
-	do {
b144b7
-		xtables_register_match(&match[--n]);
b144b7
-	} while (n > 0);
b144b7
+	int i;
b144b7
+
b144b7
+	for (i = 0; i < n; i++)
b144b7
+		xtables_register_match(&match[i]);
b144b7
 }
b144b7
 
b144b7
 void xtables_register_target(struct xtables_target *me)
b144b7
@@ -1223,9 +1224,10 @@ static bool xtables_fully_register_pending_target(struct xtables_target *me,
b144b7
 
b144b7
 void xtables_register_targets(struct xtables_target *target, unsigned int n)
b144b7
 {
b144b7
-	do {
b144b7
-		xtables_register_target(&target[--n]);
b144b7
-	} while (n > 0);
b144b7
+	int i;
b144b7
+
b144b7
+	for (i = 0; i < n; i++)
b144b7
+		xtables_register_target(&target[i]);
b144b7
 }
b144b7
 
b144b7
 /* receives a list of xtables_rule_match, release them */
b144b7
-- 
b144b7
2.28.0
b144b7