diff options
author | David S. Miller <davem@davemloft.net> | 2008-10-08 12:50:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-08 12:50:38 -0400 |
commit | 364ae953a48152be11f1aa424cbfd943b7762b0d (patch) | |
tree | 6873b352af1aa2dd6baa223b951eff4d6e74b1ae /include/net | |
parent | 075f664689b40217539ebfe856fab73d302a15f1 (diff) | |
parent | f39a9410ed0503278fd5edc559fa019051413039 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/net_namespace.h | 6 | ||||
-rw-r--r-- | include/net/netfilter/ipv4/nf_defrag_ipv4.h | 6 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 34 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_acct.h | 10 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_core.h | 11 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_ecache.h | 26 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_expect.h | 22 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_l4proto.h | 21 | ||||
-rw-r--r-- | include/net/netfilter/nf_log.h | 8 | ||||
-rw-r--r-- | include/net/netfilter/nf_queue.h | 6 | ||||
-rw-r--r-- | include/net/netfilter/nf_tproxy_core.h | 32 | ||||
-rw-r--r-- | include/net/netns/conntrack.h | 30 | ||||
-rw-r--r-- | include/net/netns/ipv4.h | 3 |
13 files changed, 159 insertions, 56 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index a8eb43cf0c7e..708009be88b6 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -16,6 +16,9 @@ | |||
16 | #include <net/netns/ipv6.h> | 16 | #include <net/netns/ipv6.h> |
17 | #include <net/netns/dccp.h> | 17 | #include <net/netns/dccp.h> |
18 | #include <net/netns/x_tables.h> | 18 | #include <net/netns/x_tables.h> |
19 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
20 | #include <net/netns/conntrack.h> | ||
21 | #endif | ||
19 | 22 | ||
20 | struct proc_dir_entry; | 23 | struct proc_dir_entry; |
21 | struct net_device; | 24 | struct net_device; |
@@ -67,6 +70,9 @@ struct net { | |||
67 | #endif | 70 | #endif |
68 | #ifdef CONFIG_NETFILTER | 71 | #ifdef CONFIG_NETFILTER |
69 | struct netns_xt xt; | 72 | struct netns_xt xt; |
73 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
74 | struct netns_ct ct; | ||
75 | #endif | ||
70 | #endif | 76 | #endif |
71 | struct net_generic *gen; | 77 | struct net_generic *gen; |
72 | }; | 78 | }; |
diff --git a/include/net/netfilter/ipv4/nf_defrag_ipv4.h b/include/net/netfilter/ipv4/nf_defrag_ipv4.h new file mode 100644 index 000000000000..6b00ea38546b --- /dev/null +++ b/include/net/netfilter/ipv4/nf_defrag_ipv4.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _NF_DEFRAG_IPV4_H | ||
2 | #define _NF_DEFRAG_IPV4_H | ||
3 | |||
4 | extern void nf_defrag_ipv4_enable(void); | ||
5 | |||
6 | #endif /* _NF_DEFRAG_IPV4_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 0741ad592da0..b76a8685b5b5 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -123,7 +123,9 @@ struct nf_conn | |||
123 | 123 | ||
124 | /* Extensions */ | 124 | /* Extensions */ |
125 | struct nf_ct_ext *ext; | 125 | struct nf_ct_ext *ext; |
126 | 126 | #ifdef CONFIG_NET_NS | |
127 | struct net *ct_net; | ||
128 | #endif | ||
127 | struct rcu_head rcu; | 129 | struct rcu_head rcu; |
128 | }; | 130 | }; |
129 | 131 | ||
@@ -147,6 +149,17 @@ static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct) | |||
147 | /* get master conntrack via master expectation */ | 149 | /* get master conntrack via master expectation */ |
148 | #define master_ct(conntr) (conntr->master) | 150 | #define master_ct(conntr) (conntr->master) |
149 | 151 | ||
152 | extern struct net init_net; | ||
153 | |||
154 | static inline struct net *nf_ct_net(const struct nf_conn *ct) | ||
155 | { | ||
156 | #ifdef CONFIG_NET_NS | ||
157 | return ct->ct_net; | ||
158 | #else | ||
159 | return &init_net; | ||
160 | #endif | ||
161 | } | ||
162 | |||
150 | /* Alter reply tuple (maybe alter helper). */ | 163 | /* Alter reply tuple (maybe alter helper). */ |
151 | extern void | 164 | extern void |
152 | nf_conntrack_alter_reply(struct nf_conn *ct, | 165 | nf_conntrack_alter_reply(struct nf_conn *ct, |
@@ -182,11 +195,11 @@ extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, | |||
182 | unsigned int size); | 195 | unsigned int size); |
183 | 196 | ||
184 | extern struct nf_conntrack_tuple_hash * | 197 | extern struct nf_conntrack_tuple_hash * |
185 | __nf_conntrack_find(const struct nf_conntrack_tuple *tuple); | 198 | __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); |
186 | 199 | ||
187 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); | 200 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); |
188 | 201 | ||
189 | extern void nf_conntrack_flush(void); | 202 | extern void nf_conntrack_flush(struct net *net); |
190 | 203 | ||
191 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, | 204 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, |
192 | unsigned int nhoff, u_int16_t l3num, | 205 | unsigned int nhoff, u_int16_t l3num, |
@@ -248,10 +261,11 @@ extern struct nf_conn nf_conntrack_untracked; | |||
248 | 261 | ||
249 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ | 262 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ |
250 | extern void | 263 | extern void |
251 | nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), void *data); | 264 | nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data); |
252 | extern void nf_conntrack_free(struct nf_conn *ct); | 265 | extern void nf_conntrack_free(struct nf_conn *ct); |
253 | extern struct nf_conn * | 266 | extern struct nf_conn * |
254 | nf_conntrack_alloc(const struct nf_conntrack_tuple *orig, | 267 | nf_conntrack_alloc(struct net *net, |
268 | const struct nf_conntrack_tuple *orig, | ||
255 | const struct nf_conntrack_tuple *repl, | 269 | const struct nf_conntrack_tuple *repl, |
256 | gfp_t gfp); | 270 | gfp_t gfp); |
257 | 271 | ||
@@ -273,16 +287,14 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb) | |||
273 | 287 | ||
274 | extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); | 288 | extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); |
275 | extern unsigned int nf_conntrack_htable_size; | 289 | extern unsigned int nf_conntrack_htable_size; |
276 | extern int nf_conntrack_checksum; | ||
277 | extern atomic_t nf_conntrack_count; | ||
278 | extern int nf_conntrack_max; | 290 | extern int nf_conntrack_max; |
279 | 291 | ||
280 | DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat); | 292 | #define NF_CT_STAT_INC(net, count) \ |
281 | #define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) | 293 | (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) |
282 | #define NF_CT_STAT_INC_ATOMIC(count) \ | 294 | #define NF_CT_STAT_INC_ATOMIC(net, count) \ |
283 | do { \ | 295 | do { \ |
284 | local_bh_disable(); \ | 296 | local_bh_disable(); \ |
285 | __get_cpu_var(nf_conntrack_stat).count++; \ | 297 | per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++; \ |
286 | local_bh_enable(); \ | 298 | local_bh_enable(); \ |
287 | } while (0) | 299 | } while (0) |
288 | 300 | ||
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h index 5d5ae55d54c4..03e218f0be43 100644 --- a/include/net/netfilter/nf_conntrack_acct.h +++ b/include/net/netfilter/nf_conntrack_acct.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #ifndef _NF_CONNTRACK_ACCT_H | 9 | #ifndef _NF_CONNTRACK_ACCT_H |
10 | #define _NF_CONNTRACK_ACCT_H | 10 | #define _NF_CONNTRACK_ACCT_H |
11 | #include <net/net_namespace.h> | ||
11 | #include <linux/netfilter/nf_conntrack_common.h> | 12 | #include <linux/netfilter/nf_conntrack_common.h> |
12 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | 13 | #include <linux/netfilter/nf_conntrack_tuple_common.h> |
13 | #include <net/netfilter/nf_conntrack.h> | 14 | #include <net/netfilter/nf_conntrack.h> |
@@ -18,8 +19,6 @@ struct nf_conn_counter { | |||
18 | u_int64_t bytes; | 19 | u_int64_t bytes; |
19 | }; | 20 | }; |
20 | 21 | ||
21 | extern int nf_ct_acct; | ||
22 | |||
23 | static inline | 22 | static inline |
24 | struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct) | 23 | struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct) |
25 | { | 24 | { |
@@ -29,9 +28,10 @@ struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct) | |||
29 | static inline | 28 | static inline |
30 | struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) | 29 | struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) |
31 | { | 30 | { |
31 | struct net *net = nf_ct_net(ct); | ||
32 | struct nf_conn_counter *acct; | 32 | struct nf_conn_counter *acct; |
33 | 33 | ||
34 | if (!nf_ct_acct) | 34 | if (!net->ct.sysctl_acct) |
35 | return NULL; | 35 | return NULL; |
36 | 36 | ||
37 | acct = nf_ct_ext_add(ct, NF_CT_EXT_ACCT, gfp); | 37 | acct = nf_ct_ext_add(ct, NF_CT_EXT_ACCT, gfp); |
@@ -45,7 +45,7 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) | |||
45 | extern unsigned int | 45 | extern unsigned int |
46 | seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); | 46 | seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); |
47 | 47 | ||
48 | extern int nf_conntrack_acct_init(void); | 48 | extern int nf_conntrack_acct_init(struct net *net); |
49 | extern void nf_conntrack_acct_fini(void); | 49 | extern void nf_conntrack_acct_fini(struct net *net); |
50 | 50 | ||
51 | #endif /* _NF_CONNTRACK_ACCT_H */ | 51 | #endif /* _NF_CONNTRACK_ACCT_H */ |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index a81771210934..e78afe7f28e3 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -20,12 +20,13 @@ | |||
20 | /* This header is used to share core functionality between the | 20 | /* This header is used to share core functionality between the |
21 | standalone connection tracking module, and the compatibility layer's use | 21 | standalone connection tracking module, and the compatibility layer's use |
22 | of connection tracking. */ | 22 | of connection tracking. */ |
23 | extern unsigned int nf_conntrack_in(int pf, | 23 | extern unsigned int nf_conntrack_in(struct net *net, |
24 | u_int8_t pf, | ||
24 | unsigned int hooknum, | 25 | unsigned int hooknum, |
25 | struct sk_buff *skb); | 26 | struct sk_buff *skb); |
26 | 27 | ||
27 | extern int nf_conntrack_init(void); | 28 | extern int nf_conntrack_init(struct net *net); |
28 | extern void nf_conntrack_cleanup(void); | 29 | extern void nf_conntrack_cleanup(struct net *net); |
29 | 30 | ||
30 | extern int nf_conntrack_proto_init(void); | 31 | extern int nf_conntrack_proto_init(void); |
31 | extern void nf_conntrack_proto_fini(void); | 32 | extern void nf_conntrack_proto_fini(void); |
@@ -48,7 +49,7 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, | |||
48 | 49 | ||
49 | /* Find a connection corresponding to a tuple. */ | 50 | /* Find a connection corresponding to a tuple. */ |
50 | extern struct nf_conntrack_tuple_hash * | 51 | extern struct nf_conntrack_tuple_hash * |
51 | nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple); | 52 | nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); |
52 | 53 | ||
53 | extern int __nf_conntrack_confirm(struct sk_buff *skb); | 54 | extern int __nf_conntrack_confirm(struct sk_buff *skb); |
54 | 55 | ||
@@ -71,8 +72,6 @@ print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, | |||
71 | const struct nf_conntrack_l3proto *l3proto, | 72 | const struct nf_conntrack_l3proto *l3proto, |
72 | const struct nf_conntrack_l4proto *proto); | 73 | const struct nf_conntrack_l4proto *proto); |
73 | 74 | ||
74 | extern struct hlist_head *nf_conntrack_hash; | ||
75 | extern spinlock_t nf_conntrack_lock ; | 75 | extern spinlock_t nf_conntrack_lock ; |
76 | extern struct hlist_head unconfirmed; | ||
77 | 76 | ||
78 | #endif /* _NF_CONNTRACK_CORE_H */ | 77 | #endif /* _NF_CONNTRACK_CORE_H */ |
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index f0b9078235c9..35f814c1e2ca 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/notifier.h> | 9 | #include <linux/notifier.h> |
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <net/net_namespace.h> | ||
11 | #include <net/netfilter/nf_conntrack_expect.h> | 12 | #include <net/netfilter/nf_conntrack_expect.h> |
12 | 13 | ||
13 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 14 | #ifdef CONFIG_NF_CONNTRACK_EVENTS |
@@ -15,9 +16,6 @@ struct nf_conntrack_ecache { | |||
15 | struct nf_conn *ct; | 16 | struct nf_conn *ct; |
16 | unsigned int events; | 17 | unsigned int events; |
17 | }; | 18 | }; |
18 | DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache); | ||
19 | |||
20 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) | ||
21 | 19 | ||
22 | extern struct atomic_notifier_head nf_conntrack_chain; | 20 | extern struct atomic_notifier_head nf_conntrack_chain; |
23 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); | 21 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); |
@@ -25,17 +23,16 @@ extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); | |||
25 | 23 | ||
26 | extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); | 24 | extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); |
27 | extern void __nf_ct_event_cache_init(struct nf_conn *ct); | 25 | extern void __nf_ct_event_cache_init(struct nf_conn *ct); |
28 | extern void nf_ct_event_cache_flush(void); | 26 | extern void nf_ct_event_cache_flush(struct net *net); |
29 | 27 | ||
30 | static inline void | 28 | static inline void |
31 | nf_conntrack_event_cache(enum ip_conntrack_events event, | 29 | nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) |
32 | const struct sk_buff *skb) | ||
33 | { | 30 | { |
34 | struct nf_conn *ct = (struct nf_conn *)skb->nfct; | 31 | struct net *net = nf_ct_net(ct); |
35 | struct nf_conntrack_ecache *ecache; | 32 | struct nf_conntrack_ecache *ecache; |
36 | 33 | ||
37 | local_bh_disable(); | 34 | local_bh_disable(); |
38 | ecache = &__get_cpu_var(nf_conntrack_ecache); | 35 | ecache = per_cpu_ptr(net->ct.ecache, raw_smp_processor_id()); |
39 | if (ct != ecache->ct) | 36 | if (ct != ecache->ct) |
40 | __nf_ct_event_cache_init(ct); | 37 | __nf_ct_event_cache_init(ct); |
41 | ecache->events |= event; | 38 | ecache->events |= event; |
@@ -60,6 +57,9 @@ nf_ct_expect_event(enum ip_conntrack_expect_events event, | |||
60 | atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp); | 57 | atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp); |
61 | } | 58 | } |
62 | 59 | ||
60 | extern int nf_conntrack_ecache_init(struct net *net); | ||
61 | extern void nf_conntrack_ecache_fini(struct net *net); | ||
62 | |||
63 | #else /* CONFIG_NF_CONNTRACK_EVENTS */ | 63 | #else /* CONFIG_NF_CONNTRACK_EVENTS */ |
64 | 64 | ||
65 | static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, | 65 | static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, |
@@ -69,7 +69,15 @@ static inline void nf_conntrack_event(enum ip_conntrack_events event, | |||
69 | static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} | 69 | 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, | 70 | static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, |
71 | struct nf_conntrack_expect *exp) {} | 71 | struct nf_conntrack_expect *exp) {} |
72 | static inline void nf_ct_event_cache_flush(void) {} | 72 | static inline void nf_ct_event_cache_flush(struct net *net) {} |
73 | |||
74 | static inline int nf_conntrack_ecache_init(struct net *net) | ||
75 | { | ||
76 | return 0; | ||
77 | |||
78 | static inline void nf_conntrack_ecache_fini(struct net *net) | ||
79 | { | ||
80 | } | ||
73 | #endif /* CONFIG_NF_CONNTRACK_EVENTS */ | 81 | #endif /* CONFIG_NF_CONNTRACK_EVENTS */ |
74 | 82 | ||
75 | #endif /*_NF_CONNTRACK_ECACHE_H*/ | 83 | #endif /*_NF_CONNTRACK_ECACHE_H*/ |
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index dfdf4b459475..37a7fc1164b0 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #define _NF_CONNTRACK_EXPECT_H | 6 | #define _NF_CONNTRACK_EXPECT_H |
7 | #include <net/netfilter/nf_conntrack.h> | 7 | #include <net/netfilter/nf_conntrack.h> |
8 | 8 | ||
9 | extern struct hlist_head *nf_ct_expect_hash; | ||
10 | extern unsigned int nf_ct_expect_hsize; | 9 | extern unsigned int nf_ct_expect_hsize; |
11 | extern unsigned int nf_ct_expect_max; | 10 | extern unsigned int nf_ct_expect_max; |
12 | 11 | ||
@@ -56,6 +55,15 @@ struct nf_conntrack_expect | |||
56 | struct rcu_head rcu; | 55 | struct rcu_head rcu; |
57 | }; | 56 | }; |
58 | 57 | ||
58 | static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp) | ||
59 | { | ||
60 | #ifdef CONFIG_NET_NS | ||
61 | return exp->master->ct_net; /* by definition */ | ||
62 | #else | ||
63 | return &init_net; | ||
64 | #endif | ||
65 | } | ||
66 | |||
59 | struct nf_conntrack_expect_policy | 67 | struct nf_conntrack_expect_policy |
60 | { | 68 | { |
61 | unsigned int max_expected; | 69 | unsigned int max_expected; |
@@ -67,17 +75,17 @@ struct nf_conntrack_expect_policy | |||
67 | #define NF_CT_EXPECT_PERMANENT 0x1 | 75 | #define NF_CT_EXPECT_PERMANENT 0x1 |
68 | #define NF_CT_EXPECT_INACTIVE 0x2 | 76 | #define NF_CT_EXPECT_INACTIVE 0x2 |
69 | 77 | ||
70 | int nf_conntrack_expect_init(void); | 78 | int nf_conntrack_expect_init(struct net *net); |
71 | void nf_conntrack_expect_fini(void); | 79 | void nf_conntrack_expect_fini(struct net *net); |
72 | 80 | ||
73 | struct nf_conntrack_expect * | 81 | struct nf_conntrack_expect * |
74 | __nf_ct_expect_find(const struct nf_conntrack_tuple *tuple); | 82 | __nf_ct_expect_find(struct net *net, const struct nf_conntrack_tuple *tuple); |
75 | 83 | ||
76 | struct nf_conntrack_expect * | 84 | struct nf_conntrack_expect * |
77 | nf_ct_expect_find_get(const struct nf_conntrack_tuple *tuple); | 85 | nf_ct_expect_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); |
78 | 86 | ||
79 | struct nf_conntrack_expect * | 87 | struct nf_conntrack_expect * |
80 | nf_ct_find_expectation(const struct nf_conntrack_tuple *tuple); | 88 | nf_ct_find_expectation(struct net *net, const struct nf_conntrack_tuple *tuple); |
81 | 89 | ||
82 | void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); | 90 | void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); |
83 | void nf_ct_remove_expectations(struct nf_conn *ct); | 91 | void nf_ct_remove_expectations(struct nf_conn *ct); |
@@ -86,7 +94,7 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); | |||
86 | /* Allocate space for an expectation: this is mandatory before calling | 94 | /* Allocate space for an expectation: this is mandatory before calling |
87 | nf_ct_expect_related. You will have to call put afterwards. */ | 95 | nf_ct_expect_related. You will have to call put afterwards. */ |
88 | struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); | 96 | struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); |
89 | void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, int, | 97 | void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t, |
90 | const union nf_inet_addr *, | 98 | const union nf_inet_addr *, |
91 | const union nf_inet_addr *, | 99 | const union nf_inet_addr *, |
92 | u_int8_t, const __be16 *, const __be16 *); | 100 | u_int8_t, const __be16 *, const __be16 *); |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index 723df9d1cc35..7f2f43c77284 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -39,7 +39,7 @@ struct nf_conntrack_l4proto | |||
39 | const struct sk_buff *skb, | 39 | const struct sk_buff *skb, |
40 | unsigned int dataoff, | 40 | unsigned int dataoff, |
41 | enum ip_conntrack_info ctinfo, | 41 | enum ip_conntrack_info ctinfo, |
42 | int pf, | 42 | u_int8_t pf, |
43 | unsigned int hooknum); | 43 | unsigned int hooknum); |
44 | 44 | ||
45 | /* Called when a new connection for this protocol found; | 45 | /* Called when a new connection for this protocol found; |
@@ -50,9 +50,9 @@ struct nf_conntrack_l4proto | |||
50 | /* Called when a conntrack entry is destroyed */ | 50 | /* Called when a conntrack entry is destroyed */ |
51 | void (*destroy)(struct nf_conn *ct); | 51 | void (*destroy)(struct nf_conn *ct); |
52 | 52 | ||
53 | int (*error)(struct sk_buff *skb, unsigned int dataoff, | 53 | int (*error)(struct net *net, struct sk_buff *skb, unsigned int dataoff, |
54 | enum ip_conntrack_info *ctinfo, | 54 | enum ip_conntrack_info *ctinfo, |
55 | int pf, unsigned int hooknum); | 55 | u_int8_t pf, unsigned int hooknum); |
56 | 56 | ||
57 | /* Print out the per-protocol part of the tuple. Return like seq_* */ | 57 | /* Print out the per-protocol part of the tuple. Return like seq_* */ |
58 | int (*print_tuple)(struct seq_file *s, | 58 | int (*print_tuple)(struct seq_file *s, |
@@ -117,20 +117,19 @@ extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], | |||
117 | struct nf_conntrack_tuple *t); | 117 | struct nf_conntrack_tuple *t); |
118 | extern const struct nla_policy nf_ct_port_nla_policy[]; | 118 | extern const struct nla_policy nf_ct_port_nla_policy[]; |
119 | 119 | ||
120 | /* Log invalid packets */ | ||
121 | extern unsigned int nf_ct_log_invalid; | ||
122 | |||
123 | #ifdef CONFIG_SYSCTL | 120 | #ifdef CONFIG_SYSCTL |
124 | #ifdef DEBUG_INVALID_PACKETS | 121 | #ifdef DEBUG_INVALID_PACKETS |
125 | #define LOG_INVALID(proto) \ | 122 | #define LOG_INVALID(net, proto) \ |
126 | (nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) | 123 | ((net)->ct.sysctl_log_invalid == (proto) || \ |
124 | (net)->ct.sysctl_log_invalid == IPPROTO_RAW) | ||
127 | #else | 125 | #else |
128 | #define LOG_INVALID(proto) \ | 126 | #define LOG_INVALID(net, proto) \ |
129 | ((nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) \ | 127 | (((net)->ct.sysctl_log_invalid == (proto) || \ |
128 | (net)->ct.sysctl_log_invalid == IPPROTO_RAW) \ | ||
130 | && net_ratelimit()) | 129 | && net_ratelimit()) |
131 | #endif | 130 | #endif |
132 | #else | 131 | #else |
133 | #define LOG_INVALID(proto) 0 | 132 | #define LOG_INVALID(net, proto) 0 |
134 | #endif /* CONFIG_SYSCTL */ | 133 | #endif /* CONFIG_SYSCTL */ |
135 | 134 | ||
136 | #endif /*_NF_CONNTRACK_PROTOCOL_H*/ | 135 | #endif /*_NF_CONNTRACK_PROTOCOL_H*/ |
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h index 8c6b5ae45534..7182c06974f4 100644 --- a/include/net/netfilter/nf_log.h +++ b/include/net/netfilter/nf_log.h | |||
@@ -28,7 +28,7 @@ struct nf_loginfo { | |||
28 | } u; | 28 | } u; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | typedef void nf_logfn(unsigned int pf, | 31 | typedef void nf_logfn(u_int8_t pf, |
32 | unsigned int hooknum, | 32 | unsigned int hooknum, |
33 | const struct sk_buff *skb, | 33 | const struct sk_buff *skb, |
34 | const struct net_device *in, | 34 | const struct net_device *in, |
@@ -43,12 +43,12 @@ struct nf_logger { | |||
43 | }; | 43 | }; |
44 | 44 | ||
45 | /* Function to register/unregister log function. */ | 45 | /* Function to register/unregister log function. */ |
46 | int nf_log_register(int pf, const struct nf_logger *logger); | 46 | int nf_log_register(u_int8_t pf, const struct nf_logger *logger); |
47 | void nf_log_unregister(const struct nf_logger *logger); | 47 | void nf_log_unregister(const struct nf_logger *logger); |
48 | void nf_log_unregister_pf(int pf); | 48 | void nf_log_unregister_pf(u_int8_t pf); |
49 | 49 | ||
50 | /* Calls the registered backend logging function */ | 50 | /* Calls the registered backend logging function */ |
51 | void nf_log_packet(int pf, | 51 | void nf_log_packet(u_int8_t pf, |
52 | unsigned int hooknum, | 52 | unsigned int hooknum, |
53 | const struct sk_buff *skb, | 53 | const struct sk_buff *skb, |
54 | const struct net_device *in, | 54 | const struct net_device *in, |
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index d030044e9235..252fd1010b77 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h | |||
@@ -8,7 +8,7 @@ struct nf_queue_entry { | |||
8 | unsigned int id; | 8 | unsigned int id; |
9 | 9 | ||
10 | struct nf_hook_ops *elem; | 10 | struct nf_hook_ops *elem; |
11 | int pf; | 11 | u_int8_t pf; |
12 | unsigned int hook; | 12 | unsigned int hook; |
13 | struct net_device *indev; | 13 | struct net_device *indev; |
14 | struct net_device *outdev; | 14 | struct net_device *outdev; |
@@ -24,9 +24,9 @@ struct nf_queue_handler { | |||
24 | char *name; | 24 | char *name; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | extern int nf_register_queue_handler(int pf, | 27 | extern int nf_register_queue_handler(u_int8_t pf, |
28 | const struct nf_queue_handler *qh); | 28 | const struct nf_queue_handler *qh); |
29 | extern int nf_unregister_queue_handler(int pf, | 29 | extern int nf_unregister_queue_handler(u_int8_t pf, |
30 | const struct nf_queue_handler *qh); | 30 | const struct nf_queue_handler *qh); |
31 | extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); | 31 | extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); |
32 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); | 32 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); |
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h new file mode 100644 index 000000000000..208b46f4d6d2 --- /dev/null +++ b/include/net/netfilter/nf_tproxy_core.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _NF_TPROXY_CORE_H | ||
2 | #define _NF_TPROXY_CORE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/in.h> | ||
6 | #include <linux/skbuff.h> | ||
7 | #include <net/sock.h> | ||
8 | #include <net/inet_sock.h> | ||
9 | #include <net/tcp.h> | ||
10 | |||
11 | /* look up and get a reference to a matching socket */ | ||
12 | extern struct sock * | ||
13 | nf_tproxy_get_sock_v4(struct net *net, const u8 protocol, | ||
14 | const __be32 saddr, const __be32 daddr, | ||
15 | const __be16 sport, const __be16 dport, | ||
16 | const struct net_device *in, bool listening); | ||
17 | |||
18 | static inline void | ||
19 | nf_tproxy_put_sock(struct sock *sk) | ||
20 | { | ||
21 | /* TIME_WAIT inet sockets have to be handled differently */ | ||
22 | if ((sk->sk_protocol == IPPROTO_TCP) && (sk->sk_state == TCP_TIME_WAIT)) | ||
23 | inet_twsk_put(inet_twsk(sk)); | ||
24 | else | ||
25 | sock_put(sk); | ||
26 | } | ||
27 | |||
28 | /* assign a socket to the skb -- consumes sk */ | ||
29 | int | ||
30 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); | ||
31 | |||
32 | #endif | ||
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h new file mode 100644 index 000000000000..f4498a62881b --- /dev/null +++ b/include/net/netns/conntrack.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef __NETNS_CONNTRACK_H | ||
2 | #define __NETNS_CONNTRACK_H | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | #include <asm/atomic.h> | ||
6 | |||
7 | struct ctl_table_header; | ||
8 | struct nf_conntrack_ecache; | ||
9 | |||
10 | struct netns_ct { | ||
11 | atomic_t count; | ||
12 | unsigned int expect_count; | ||
13 | struct hlist_head *hash; | ||
14 | struct hlist_head *expect_hash; | ||
15 | struct hlist_head unconfirmed; | ||
16 | struct ip_conntrack_stat *stat; | ||
17 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
18 | struct nf_conntrack_ecache *ecache; | ||
19 | #endif | ||
20 | int sysctl_acct; | ||
21 | int sysctl_checksum; | ||
22 | unsigned int sysctl_log_invalid; /* Log invalid packets */ | ||
23 | #ifdef CONFIG_SYSCTL | ||
24 | struct ctl_table_header *sysctl_header; | ||
25 | struct ctl_table_header *acct_sysctl_header; | ||
26 | #endif | ||
27 | int hash_vmalloc; | ||
28 | int expect_vmalloc; | ||
29 | }; | ||
30 | #endif | ||
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index a6ed83853dcc..ece1c926b5d1 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -38,6 +38,9 @@ struct netns_ipv4 { | |||
38 | struct xt_table *iptable_raw; | 38 | struct xt_table *iptable_raw; |
39 | struct xt_table *arptable_filter; | 39 | struct xt_table *arptable_filter; |
40 | struct xt_table *iptable_security; | 40 | struct xt_table *iptable_security; |
41 | struct xt_table *nat_table; | ||
42 | struct hlist_head *nat_bysource; | ||
43 | int nat_vmalloced; | ||
41 | #endif | 44 | #endif |
42 | 45 | ||
43 | int sysctl_icmp_echo_ignore_all; | 46 | int sysctl_icmp_echo_ignore_all; |