aboutsummaryrefslogtreecommitdiff
path: root/net/netfilter/core.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-04-06 14:18:09 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-04-09 22:25:40 -0700
commitbce8032ef3cc58170ab3550e9e271dba7b4c4764 (patch)
tree13dbdf12a6c567c3292daad4604eb55f7abd167e /net/netfilter/core.c
parenta0aed49bdb2bbb4234789f241cffb607fd2e213d (diff)
[NETFILTER]: Introduce infrastructure for address family specific operations
Change the queue rerouter intrastructure to a generic usable infrastructure for address family specific operations as a base for some cleanups. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/core.c')
-rw-r--r--net/netfilter/core.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 645d6210557..8455a32ea5c 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -27,6 +27,29 @@
#include "nf_internals.h"
+static DEFINE_SPINLOCK(afinfo_lock);
+
+struct nf_afinfo *nf_afinfo[NPROTO];
+EXPORT_SYMBOL(nf_afinfo);
+
+int nf_register_afinfo(struct nf_afinfo *afinfo)
+{
+ spin_lock(&afinfo_lock);
+ rcu_assign_pointer(nf_afinfo[afinfo->family], afinfo);
+ spin_unlock(&afinfo_lock);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(nf_register_afinfo);
+
+void nf_unregister_afinfo(struct nf_afinfo *afinfo)
+{
+ spin_lock(&afinfo_lock);
+ rcu_assign_pointer(nf_afinfo[afinfo->family], NULL);
+ spin_unlock(&afinfo_lock);
+ synchronize_rcu();
+}
+EXPORT_SYMBOL_GPL(nf_unregister_afinfo);
+
/* In this code, we can be waiting indefinitely for userspace to
* service a packet if a hook returns NF_QUEUE. We could keep a count
* of skbuffs queued for userspace, and not deregister a hook unless