You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.4 KiB
65 lines
2.4 KiB
11 months ago
|
From da4e3255df89367a3fcf0625df2f161724ef591c Mon Sep 17 00:00:00 2001
|
||
2 years ago
|
From: Phil Sutter <phil@nwl.cc>
|
||
|
Date: Fri, 11 Feb 2022 17:39:24 +0100
|
||
|
Subject: [PATCH] libxtables: Register only the highest revision extension
|
||
|
|
||
|
When fully registering extensions, ignore all consecutive ones with same
|
||
|
name and family value. Since commit b3ac87038f4e4 ("libxtables: Make
|
||
|
sure extensions register in revision order"), one may safely assume the
|
||
|
list of pending extensions has highest revision numbers first. Since
|
||
|
iptables is only interested in the highest revision the kernel supports,
|
||
|
registration and compatibility checks may be skipped once the first
|
||
|
matching extension in pending list has validated.
|
||
|
|
||
|
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
||
|
(cherry picked from commit 2dbb49d15fb44ddd521a734eca3be3f940b7c1ba)
|
||
|
---
|
||
|
libxtables/xtables.c | 10 ++++++++--
|
||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/libxtables/xtables.c b/libxtables/xtables.c
|
||
11 months ago
|
index 7f40b6f1b327b..3f7b9768897ac 100644
|
||
2 years ago
|
--- a/libxtables/xtables.c
|
||
|
+++ b/libxtables/xtables.c
|
||
11 months ago
|
@@ -668,6 +668,7 @@ xtables_find_match(const char *name, enum xtables_tryload tryload,
|
||
2 years ago
|
struct xtables_match **dptr;
|
||
|
struct xtables_match *ptr;
|
||
|
const char *icmp6 = "icmp6";
|
||
|
+ bool found = false;
|
||
|
|
||
|
if (strlen(name) >= XT_EXTENSION_MAXNAMELEN)
|
||
|
xtables_error(PARAMETER_PROBLEM,
|
||
11 months ago
|
@@ -686,7 +687,9 @@ xtables_find_match(const char *name, enum xtables_tryload tryload,
|
||
2 years ago
|
if (extension_cmp(name, (*dptr)->name, (*dptr)->family)) {
|
||
|
ptr = *dptr;
|
||
|
*dptr = (*dptr)->next;
|
||
|
- if (xtables_fully_register_pending_match(ptr, prev)) {
|
||
|
+ if (!found &&
|
||
|
+ xtables_fully_register_pending_match(ptr, prev)) {
|
||
|
+ found = true;
|
||
|
prev = ptr;
|
||
|
continue;
|
||
|
} else if (prev) {
|
||
11 months ago
|
@@ -788,6 +791,7 @@ xtables_find_target(const char *name, enum xtables_tryload tryload)
|
||
2 years ago
|
struct xtables_target *prev = NULL;
|
||
|
struct xtables_target **dptr;
|
||
|
struct xtables_target *ptr;
|
||
|
+ bool found = false;
|
||
|
|
||
|
/* Standard target? */
|
||
|
if (strcmp(name, "") == 0
|
||
11 months ago
|
@@ -802,7 +806,9 @@ xtables_find_target(const char *name, enum xtables_tryload tryload)
|
||
2 years ago
|
if (extension_cmp(name, (*dptr)->name, (*dptr)->family)) {
|
||
|
ptr = *dptr;
|
||
|
*dptr = (*dptr)->next;
|
||
|
- if (xtables_fully_register_pending_target(ptr, prev)) {
|
||
|
+ if (!found &&
|
||
|
+ xtables_fully_register_pending_target(ptr, prev)) {
|
||
|
+ found = true;
|
||
|
prev = ptr;
|
||
|
continue;
|
||
|
} else if (prev) {
|
||
|
--
|
||
11 months ago
|
2.40.0
|
||
2 years ago
|
|