public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xt_request_find_match
@ 2006-12-16 17:55 Jan Engelhardt
  2006-12-19 11:51 ` Patrick McHardy
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Engelhardt @ 2006-12-16 17:55 UTC (permalink / raw)
  To: kaber; +Cc: Netfilter Developer Mailing List, Linux Kernel Mailing List

Hi,



Reusing code is a good idea, and I would like to do so from my 
match modules. netfilter already provides a xt_request_find_target() but 
an xt_request_find_match() does not yet exist. This patch adds it.

Objections welcome :)

---

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>

Index: linux-2.6.20-rc1/net/netfilter/x_tables.c
===================================================================
--- linux-2.6.20-rc1.orig/net/netfilter/x_tables.c
+++ linux-2.6.20-rc1/net/netfilter/x_tables.c
@@ -206,6 +206,19 @@ struct xt_match *xt_find_match(int af, c
 }
 EXPORT_SYMBOL(xt_find_match);
 
+struct xt_match *xt_request_find_match(int af, const char *name, u8 revision)
+{
+	struct xt_match *match;
+
+	match = try_then_request_module(xt_find_match(af, name, revision),
+	                                "%st_%s", xt_prefix[af], name);
+	if(IS_ERR(match) || match == NULL)
+		return NULL;
+
+	return match;
+}
+EXPORT_SYMBOL_GPL(xt_request_find_match);
+
 /* Find target, grabs ref.  Returns ERR_PTR() on error. */
 struct xt_target *xt_find_target(int af, const char *name, u8 revision)
 {
#<EOF>

	-`J'
-- 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-12-23 21:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-16 17:55 [PATCH] xt_request_find_match Jan Engelhardt
2006-12-19 11:51 ` Patrick McHardy
2006-12-19 13:07   ` Jan Engelhardt
2006-12-19 13:28     ` Patrick McHardy
2006-12-19 15:27       ` Jan Engelhardt
2006-12-20  8:16         ` Patrick McHardy
2006-12-20  9:11           ` Jan Engelhardt
2006-12-20  9:17             ` Patrick McHardy
2006-12-23 21:57               ` xt_request_find_match Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox