diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 2 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_ecache.h | 57 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_expect.h | 2 |
3 files changed, 56 insertions, 5 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index f11255e1ea35..2e0c53641cbe 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -199,7 +199,7 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); | |||
199 | 199 | ||
200 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); | 200 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); |
201 | 201 | ||
202 | extern void nf_conntrack_flush(struct net *net); | 202 | extern void nf_conntrack_flush(struct net *net, u32 pid, int report); |
203 | 203 | ||
204 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, | 204 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, |
205 | unsigned int nhoff, u_int16_t l3num, | 205 | unsigned int nhoff, u_int16_t l3num, |
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 1285ff26a014..0ff0dc69ca4a 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
@@ -17,6 +17,13 @@ struct nf_conntrack_ecache { | |||
17 | unsigned int events; | 17 | unsigned int events; |
18 | }; | 18 | }; |
19 | 19 | ||
20 | /* This structure is passed to event handler */ | ||
21 | struct nf_ct_event { | ||
22 | struct nf_conn *ct; | ||
23 | u32 pid; | ||
24 | int report; | ||
25 | }; | ||
26 | |||
20 | extern struct atomic_notifier_head nf_conntrack_chain; | 27 | extern struct atomic_notifier_head nf_conntrack_chain; |
21 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); | 28 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); |
22 | extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); | 29 | extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); |
@@ -39,22 +46,56 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) | |||
39 | local_bh_enable(); | 46 | local_bh_enable(); |
40 | } | 47 | } |
41 | 48 | ||
42 | static inline void nf_conntrack_event(enum ip_conntrack_events event, | 49 | static inline void |
43 | struct nf_conn *ct) | 50 | nf_conntrack_event_report(enum ip_conntrack_events event, |
51 | struct nf_conn *ct, | ||
52 | u32 pid, | ||
53 | int report) | ||
44 | { | 54 | { |
55 | struct nf_ct_event item = { | ||
56 | .ct = ct, | ||
57 | .pid = pid, | ||
58 | .report = report | ||
59 | }; | ||
45 | if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) | 60 | if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) |
46 | atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); | 61 | atomic_notifier_call_chain(&nf_conntrack_chain, event, &item); |
47 | } | 62 | } |
48 | 63 | ||
64 | static inline void | ||
65 | nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) | ||
66 | { | ||
67 | nf_conntrack_event_report(event, ct, 0, 0); | ||
68 | } | ||
69 | |||
70 | struct nf_exp_event { | ||
71 | struct nf_conntrack_expect *exp; | ||
72 | u32 pid; | ||
73 | int report; | ||
74 | }; | ||
75 | |||
49 | extern struct atomic_notifier_head nf_ct_expect_chain; | 76 | extern struct atomic_notifier_head nf_ct_expect_chain; |
50 | extern int nf_ct_expect_register_notifier(struct notifier_block *nb); | 77 | extern int nf_ct_expect_register_notifier(struct notifier_block *nb); |
51 | extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); | 78 | extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); |
52 | 79 | ||
53 | static inline void | 80 | static inline void |
81 | nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | ||
82 | struct nf_conntrack_expect *exp, | ||
83 | u32 pid, | ||
84 | int report) | ||
85 | { | ||
86 | struct nf_exp_event item = { | ||
87 | .exp = exp, | ||
88 | .pid = pid, | ||
89 | .report = report | ||
90 | }; | ||
91 | atomic_notifier_call_chain(&nf_ct_expect_chain, event, &item); | ||
92 | } | ||
93 | |||
94 | static inline void | ||
54 | nf_ct_expect_event(enum ip_conntrack_expect_events event, | 95 | nf_ct_expect_event(enum ip_conntrack_expect_events event, |
55 | struct nf_conntrack_expect *exp) | 96 | struct nf_conntrack_expect *exp) |
56 | { | 97 | { |
57 | atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp); | 98 | nf_ct_expect_event_report(event, exp, 0, 0); |
58 | } | 99 | } |
59 | 100 | ||
60 | extern int nf_conntrack_ecache_init(struct net *net); | 101 | extern int nf_conntrack_ecache_init(struct net *net); |
@@ -66,9 +107,17 @@ static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, | |||
66 | struct nf_conn *ct) {} | 107 | struct nf_conn *ct) {} |
67 | static inline void nf_conntrack_event(enum ip_conntrack_events event, | 108 | static inline void nf_conntrack_event(enum ip_conntrack_events event, |
68 | struct nf_conn *ct) {} | 109 | struct nf_conn *ct) {} |
110 | static inline void nf_conntrack_event_report(enum ip_conntrack_events event, | ||
111 | struct nf_conn *ct, | ||
112 | u32 pid, | ||
113 | int report) {} | ||
69 | static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} | 114 | static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} |
70 | static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, | 115 | static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, |
71 | struct nf_conntrack_expect *exp) {} | 116 | struct nf_conntrack_expect *exp) {} |
117 | static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e, | ||
118 | struct nf_conntrack_expect *exp, | ||
119 | u32 pid, | ||
120 | int report) {} | ||
72 | static inline void nf_ct_event_cache_flush(struct net *net) {} | 121 | static inline void nf_ct_event_cache_flush(struct net *net) {} |
73 | 122 | ||
74 | static inline int nf_conntrack_ecache_init(struct net *net) | 123 | static inline int nf_conntrack_ecache_init(struct net *net) |
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index 37a7fc1164b0..ab17a159ac66 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
@@ -100,6 +100,8 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t, | |||
100 | u_int8_t, const __be16 *, const __be16 *); | 100 | u_int8_t, const __be16 *, const __be16 *); |
101 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); | 101 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); |
102 | int nf_ct_expect_related(struct nf_conntrack_expect *expect); | 102 | int nf_ct_expect_related(struct nf_conntrack_expect *expect); |
103 | int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, | ||
104 | u32 pid, int report); | ||
103 | 105 | ||
104 | #endif /*_NF_CONNTRACK_EXPECT_H*/ | 106 | #endif /*_NF_CONNTRACK_EXPECT_H*/ |
105 | 107 | ||