1
2
3
4
5#ifndef _NF_CONNTRACK_EXPECT_H
6#define _NF_CONNTRACK_EXPECT_H
7#include <net/netfilter/nf_conntrack.h>
8
9extern unsigned int nf_ct_expect_hsize;
10extern unsigned int nf_ct_expect_max;
11
12struct nf_conntrack_expect {
13
14 struct hlist_node lnode;
15
16
17 struct hlist_node hnode;
18
19
20 struct nf_conntrack_tuple tuple;
21 struct nf_conntrack_tuple_mask mask;
22
23
24 void (*expectfn)(struct nf_conn *new,
25 struct nf_conntrack_expect *this);
26
27
28 struct nf_conntrack_helper *helper;
29
30
31 struct nf_conn *master;
32
33
34 struct timer_list timeout;
35
36
37 atomic_t use;
38
39
40 unsigned int flags;
41
42
43 unsigned int class;
44
45#ifdef CONFIG_NF_NAT_NEEDED
46 __be32 saved_ip;
47
48
49 union nf_conntrack_man_proto saved_proto;
50
51 enum ip_conntrack_dir dir;
52#endif
53
54 struct rcu_head rcu;
55};
56
57static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
58{
59 return nf_ct_net(exp->master);
60}
61
62struct nf_conntrack_expect_policy {
63 unsigned int max_expected;
64 unsigned int timeout;
65 const char *name;
66};
67
68#define NF_CT_EXPECT_CLASS_DEFAULT 0
69
70int nf_conntrack_expect_init(struct net *net);
71void nf_conntrack_expect_fini(struct net *net);
72
73struct nf_conntrack_expect *
74__nf_ct_expect_find(struct net *net, u16 zone,
75 const struct nf_conntrack_tuple *tuple);
76
77struct nf_conntrack_expect *
78nf_ct_expect_find_get(struct net *net, u16 zone,
79 const struct nf_conntrack_tuple *tuple);
80
81struct nf_conntrack_expect *
82nf_ct_find_expectation(struct net *net, u16 zone,
83 const struct nf_conntrack_tuple *tuple);
84
85void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,
86 u32 pid, int report);
87static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
88{
89 nf_ct_unlink_expect_report(exp, 0, 0);
90}
91
92void nf_ct_remove_expectations(struct nf_conn *ct);
93void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
94void nf_ct_remove_userspace_expectations(void);
95
96
97
98struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
99void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
100 const union nf_inet_addr *,
101 const union nf_inet_addr *,
102 u_int8_t, const __be16 *, const __be16 *);
103void nf_ct_expect_put(struct nf_conntrack_expect *exp);
104int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
105 u32 pid, int report);
106static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)
107{
108 return nf_ct_expect_related_report(expect, 0, 0);
109}
110
111#endif
112
113