From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 11/18]: x_tables: add helpers for mass match/target registration
Date: Tue, 22 Aug 2006 00:52:32 +0200 (MEST) [thread overview]
Message-ID: <20060821225232.10288.34148.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060821225217.10288.69738.sendpatchset@localhost.localdomain>
[NETFILTER]: x_tables: add helpers for mass match/target registration
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 15e38196fbab0fbedc31889f45440b9fe6fdf257
tree 13de7a026236dacc50d6db347169b1132d30caff
parent c3e06d8b091765def127afcc148835736d64fad5
author Patrick McHardy <kaber@trash.net> Sun, 13 Aug 2006 19:01:17 +0200
committer Patrick McHardy <kaber@trash.net> Sun, 13 Aug 2006 19:01:17 +0200
include/linux/netfilter/x_tables.h | 5 +++
net/netfilter/x_tables.c | 60 ++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 48cc32d..9a99124 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -290,8 +290,13 @@ struct xt_table_info
extern int xt_register_target(struct xt_target *target);
extern void xt_unregister_target(struct xt_target *target);
+extern int xt_register_targets(struct xt_target *target, unsigned int n);
+extern void xt_unregister_targets(struct xt_target *target, unsigned int n);
+
extern int xt_register_match(struct xt_match *target);
extern void xt_unregister_match(struct xt_match *target);
+extern int xt_register_matches(struct xt_match *match, unsigned int n);
+extern void xt_unregister_matches(struct xt_match *match, unsigned int n);
extern int xt_check_match(const struct xt_match *match, unsigned short family,
unsigned int size, const char *table, unsigned int hook,
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 174e8f9..8037ba6 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -87,6 +87,36 @@ xt_unregister_target(struct xt_target *t
EXPORT_SYMBOL(xt_unregister_target);
int
+xt_register_targets(struct xt_target *target, unsigned int n)
+{
+ unsigned int i;
+ int err = 0;
+
+ for (i = 0; i < n; i++) {
+ err = xt_register_target(&target[i]);
+ if (err)
+ goto err;
+ }
+ return err;
+
+err:
+ if (i > 0)
+ xt_unregister_targets(target, i);
+ return err;
+}
+EXPORT_SYMBOL(xt_register_targets);
+
+void
+xt_unregister_targets(struct xt_target *target, unsigned int n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++)
+ xt_unregister_target(&target[i]);
+}
+EXPORT_SYMBOL(xt_unregister_targets);
+
+int
xt_register_match(struct xt_match *match)
{
int ret, af = match->family;
@@ -113,6 +143,36 @@ xt_unregister_match(struct xt_match *mat
}
EXPORT_SYMBOL(xt_unregister_match);
+int
+xt_register_matches(struct xt_match *match, unsigned int n)
+{
+ unsigned int i;
+ int err = 0;
+
+ for (i = 0; i < n; i++) {
+ err = xt_register_match(&match[i]);
+ if (err)
+ goto err;
+ }
+ return err;
+
+err:
+ if (i > 0)
+ xt_unregister_matches(match, i);
+ return err;
+}
+EXPORT_SYMBOL(xt_register_matches);
+
+void
+xt_unregister_matches(struct xt_match *match, unsigned int n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++)
+ xt_unregister_match(&match[i]);
+}
+EXPORT_SYMBOL(xt_unregister_matches);
+
/*
* These are weird, but module loading must not be done with mutex
next prev parent reply other threads:[~2006-08-21 22:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-21 22:52 [NETFILTER 00/18]: Netfilter Update for 2.6.19 Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 01/18]: x_tables: replace IPv4 dscp match by address family independent version Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 02/18]: x_tables: replace IPv4 DSCP target " Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 03/18]: ipt_recent: add module parameter for changing ownership of /proc/net/ipt_recent/* Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 04/18]: conntrack: introduce connection mark event Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 05/18]: ctnetlink: dump connection mark Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 06/18]: ctnetlink: check for listeners before sending expectation events Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 07/18]: ctnetlink: remove impossible events tests for updates Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 08/18]: nfnetlink_queue: fix typo in error message Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 09/18]: replace open coded checksum updates Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 10/18]: xt_CONNMARK: use tabs for indentation Patrick McHardy
2006-08-21 22:52 ` Patrick McHardy [this message]
2006-08-21 22:52 ` [NETFILTER 12/18]: x_tables: make use of mass registation helpers Patrick McHardy
2006-08-22 20:48 ` [NETFILTER]: x_tables: Fix typos after conversion to use mass registation helper Thomas Graf
2006-08-22 20:52 ` David Miller
2006-08-21 22:52 ` [NETFILTER 13/18]: x_tables: remove unused argument to target functions Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 14/18]: x_tables: remove unused size argument to check/destroy functions Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 15/18]: nfnetlink: remove unnecessary packed attributes Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 16/18]: x_tables: add data member to struct xt_match Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 17/18]: ip6_tables: consolidate dst and hbh matches Patrick McHardy
2006-08-21 22:52 ` [NETFILTER 18/18]: xt_tcpmss: minor cleanups Patrick McHardy
2006-08-22 7:44 ` [NETFILTER 00/18]: Netfilter Update for 2.6.19 David Miller
2006-08-22 8:40 ` Amin Azez
2006-08-22 8:47 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060821225232.10288.34148.sendpatchset@localhost.localdomain \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.