aboutsummaryrefslogtreecommitdiff
path: root/include/net/netfilter/nf_conntrack.h
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-04-02 00:08:05 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2006-04-02 00:08:05 -0500
commit95d465fd750897ab32462a6702fbfe1b122cbbc0 (patch)
tree65c38b2f11c51bb6932e44dd6c92f15b0091abfe /include/net/netfilter/nf_conntrack.h
parent642fde17dceceb56c7ba2762733ac688666ae657 (diff)
parent683aa4012f53b2ada0f430487e05d37b0d94e90a (diff)
Manual merge with Linus.
Conflicts: arch/powerpc/kernel/setup-common.c drivers/input/keyboard/hil_kbd.c drivers/input/mouse/hil_ptr.c
Diffstat (limited to 'include/net/netfilter/nf_conntrack.h')
-rw-r--r--include/net/netfilter/nf_conntrack.h77
1 files changed, 47 insertions, 30 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 6d075ca16e6..916013ca4a5 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -67,6 +67,18 @@ do { \
struct nf_conntrack_helper;
+/* nf_conn feature for connections that have a helper */
+struct nf_conn_help {
+ /* Helper. if any */
+ struct nf_conntrack_helper *helper;
+
+ union nf_conntrack_help help;
+
+ /* Current number of expected connections */
+ unsigned int expecting;
+};
+
+
#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
struct nf_conn
{
@@ -81,6 +93,9 @@ struct nf_conn
/* Have we seen traffic both ways yet? (bitset) */
unsigned long status;
+ /* If we were expected by an expectation, this will be it */
+ struct nf_conn *master;
+
/* Timer function; drops refcnt when it goes off. */
struct timer_list timeout;
@@ -88,38 +103,22 @@ struct nf_conn
/* Accounting Information (same cache line as other written members) */
struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
#endif
- /* If we were expected by an expectation, this will be it */
- struct nf_conn *master;
-
- /* Current number of expected connections */
- unsigned int expecting;
/* Unique ID that identifies this conntrack*/
unsigned int id;
- /* Helper. if any */
- struct nf_conntrack_helper *helper;
-
/* features - nat, helper, ... used by allocating system */
u_int32_t features;
- /* Storage reserved for other modules: */
-
- union nf_conntrack_proto proto;
-
#if defined(CONFIG_NF_CONNTRACK_MARK)
u_int32_t mark;
#endif
- /* These members are dynamically allocated. */
-
- union nf_conntrack_help *help;
+ /* Storage reserved for other modules: */
+ union nf_conntrack_proto proto;
- /* Layer 3 dependent members. (ex: NAT) */
- union {
- struct nf_conntrack_ipv4 *ipv4;
- } l3proto;
- void *data[0];
+ /* features dynamically at the end: helper, nat (both optional) */
+ char data[0];
};
struct nf_conntrack_expect
@@ -196,6 +195,10 @@ static inline void nf_ct_put(struct nf_conn *ct)
nf_conntrack_put(&ct->ct_general);
}
+/* Protocol module loading */
+extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
+extern void nf_ct_l3proto_module_put(unsigned short l3proto);
+
extern struct nf_conntrack_tuple_hash *
__nf_conntrack_find(const struct nf_conntrack_tuple *tuple,
const struct nf_conn *ignored_conntrack);
@@ -297,29 +300,30 @@ DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
-extern struct notifier_block *nf_conntrack_chain;
-extern struct notifier_block *nf_conntrack_expect_chain;
+extern struct atomic_notifier_head nf_conntrack_chain;
+extern struct atomic_notifier_head nf_conntrack_expect_chain;
static inline int nf_conntrack_register_notifier(struct notifier_block *nb)
{
- return notifier_chain_register(&nf_conntrack_chain, nb);
+ return atomic_notifier_chain_register(&nf_conntrack_chain, nb);
}
static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb)
{
- return notifier_chain_unregister(&nf_conntrack_chain, nb);
+ return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb);
}
static inline int
nf_conntrack_expect_register_notifier(struct notifier_block *nb)
{
- return notifier_chain_register(&nf_conntrack_expect_chain, nb);
+ return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb);
}
static inline int
nf_conntrack_expect_unregister_notifier(struct notifier_block *nb)
{
- return notifier_chain_unregister(&nf_conntrack_expect_chain, nb);
+ return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain,
+ nb);
}
extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
@@ -344,14 +348,14 @@ static inline void nf_conntrack_event(enum ip_conntrack_events event,
struct nf_conn *ct)
{
if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
- notifier_call_chain(&nf_conntrack_chain, event, ct);
+ atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
}
static inline void
nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
struct nf_conntrack_expect *exp)
{
- notifier_call_chain(&nf_conntrack_expect_chain, event, exp);
+ atomic_notifier_call_chain(&nf_conntrack_expect_chain, event, exp);
}
#else /* CONFIG_NF_CONNTRACK_EVENTS */
static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
@@ -373,10 +377,23 @@ nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
#define NF_CT_F_NUM 4
extern int
-nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size,
- int (*init_conntrack)(struct nf_conn *, u_int32_t));
+nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size);
extern void
nf_conntrack_unregister_cache(u_int32_t features);
+/* valid combinations:
+ * basic: nf_conn, nf_conn .. nf_conn_help
+ * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat, nf_conn help
+ */
+static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
+{
+ unsigned int offset = sizeof(struct nf_conn);
+
+ if (!(ct->features & NF_CT_F_HELP))
+ return NULL;
+
+ return (struct nf_conn_help *) ((void *)ct + offset);
+}
+
#endif /* __KERNEL__ */
#endif /* _NF_CONNTRACK_H */