Patchwork netfilter 04/09: x_tables: fix match/target revision lookup

login
register
mail settings
Submitter Patrick McHardy
Date Jan. 12, 2009, 10:06 a.m.
Message ID <20090112100604.9280.34217.sendpatchset@x2.localnet>
Download mbox | patch
Permalink /patch/17898/
State Accepted
Delegated to: David Miller
Headers show

Comments

Patrick McHardy - Jan. 12, 2009, 10:06 a.m.
commit 8005c00a9f53d2a3da11fa1083ae00d06f22f500
Author: Patrick McHardy <kaber@trash.net>
Date:   Mon Jan 12 08:47:25 2009 +0100

    netfilter: x_tables: fix match/target revision lookup
    
    Commit 55b69e91 (netfilter: implement NFPROTO_UNSPEC as a wildcard
    for extensions) broke revision probing for matches and targets that
    are registered with NFPROTO_UNSPEC.
    
    Fix by continuing the search on the NFPROTO_UNSPEC list if nothing
    is found on the af-specific lists.
    
    Signed-off-by: Patrick McHardy <kaber@trash.net>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 89837a4..bfbf521 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -273,6 +273,10 @@  static int match_revfn(u8 af, const char *name, u8 revision, int *bestp)
 				have_rev = 1;
 		}
 	}
+
+	if (af != NFPROTO_UNSPEC && !have_rev)
+		return match_revfn(NFPROTO_UNSPEC, name, revision, bestp);
+
 	return have_rev;
 }
 
@@ -289,6 +293,10 @@  static int target_revfn(u8 af, const char *name, u8 revision, int *bestp)
 				have_rev = 1;
 		}
 	}
+
+	if (af != NFPROTO_UNSPEC && !have_rev)
+		return target_revfn(NFPROTO_UNSPEC, name, revision, bestp);
+
 	return have_rev;
 }