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