blob: 340c013795a49c9fcd91469ccb04a2be88f332fe [file] [log] [blame]
Patrick McHardyc7232c92012-08-26 19:14:06 +02001#ifndef _NF_NAT_L3PROTO_H
2#define _NF_NAT_L3PROTO_H
3
4struct nf_nat_l4proto;
5struct nf_nat_l3proto {
6 u8 l3proto;
7
8 bool (*in_range)(const struct nf_conntrack_tuple *t,
9 const struct nf_nat_range *range);
10
11 u32 (*secure_port)(const struct nf_conntrack_tuple *t, __be16);
12
13 bool (*manip_pkt)(struct sk_buff *skb,
14 unsigned int iphdroff,
15 const struct nf_nat_l4proto *l4proto,
16 const struct nf_conntrack_tuple *target,
17 enum nf_nat_manip_type maniptype);
18
19 void (*csum_update)(struct sk_buff *skb, unsigned int iphdroff,
20 __sum16 *check,
21 const struct nf_conntrack_tuple *t,
22 enum nf_nat_manip_type maniptype);
23
24 void (*csum_recalc)(struct sk_buff *skb, u8 proto,
25 void *data, __sum16 *check,
26 int datalen, int oldlen);
27
28 void (*decode_session)(struct sk_buff *skb,
29 const struct nf_conn *ct,
30 enum ip_conntrack_dir dir,
31 unsigned long statusbit,
32 struct flowi *fl);
33
34 int (*nlattr_to_range)(struct nlattr *tb[],
35 struct nf_nat_range *range);
36};
37
Joe Perches4e77be42013-09-23 11:37:48 -070038int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
39void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
40const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
Patrick McHardyc7232c92012-08-26 19:14:06 +020041
Joe Perches4e77be42013-09-23 11:37:48 -070042int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
43 enum ip_conntrack_info ctinfo,
44 unsigned int hooknum);
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020045
46unsigned int nf_nat_ipv4_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
47 const struct net_device *in,
48 const struct net_device *out,
49 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
50 struct sk_buff *skb,
51 const struct net_device *in,
52 const struct net_device *out,
53 struct nf_conn *ct));
54
55unsigned int nf_nat_ipv4_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
56 const struct net_device *in,
57 const struct net_device *out,
58 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
59 struct sk_buff *skb,
60 const struct net_device *in,
61 const struct net_device *out,
62 struct nf_conn *ct));
63
64unsigned int nf_nat_ipv4_local_fn(const struct nf_hook_ops *ops,
65 struct sk_buff *skb,
66 const struct net_device *in,
67 const struct net_device *out,
68 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
69 struct sk_buff *skb,
70 const struct net_device *in,
71 const struct net_device *out,
72 struct nf_conn *ct));
73
74unsigned int nf_nat_ipv4_fn(const struct nf_hook_ops *ops, struct sk_buff *skb,
75 const struct net_device *in,
76 const struct net_device *out,
77 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
78 struct sk_buff *skb,
79 const struct net_device *in,
80 const struct net_device *out,
81 struct nf_conn *ct));
82
Joe Perches4e77be42013-09-23 11:37:48 -070083int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
84 enum ip_conntrack_info ctinfo,
85 unsigned int hooknum, unsigned int hdrlen);
Patrick McHardyc7232c92012-08-26 19:14:06 +020086
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +020087unsigned int nf_nat_ipv6_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
88 const struct net_device *in,
89 const struct net_device *out,
90 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
91 struct sk_buff *skb,
92 const struct net_device *in,
93 const struct net_device *out,
94 struct nf_conn *ct));
95
96unsigned int nf_nat_ipv6_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
97 const struct net_device *in,
98 const struct net_device *out,
99 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
100 struct sk_buff *skb,
101 const struct net_device *in,
102 const struct net_device *out,
103 struct nf_conn *ct));
104
105unsigned int nf_nat_ipv6_local_fn(const struct nf_hook_ops *ops,
106 struct sk_buff *skb,
107 const struct net_device *in,
108 const struct net_device *out,
109 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
110 struct sk_buff *skb,
111 const struct net_device *in,
112 const struct net_device *out,
113 struct nf_conn *ct));
114
115unsigned int nf_nat_ipv6_fn(const struct nf_hook_ops *ops, struct sk_buff *skb,
116 const struct net_device *in,
117 const struct net_device *out,
118 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
119 struct sk_buff *skb,
120 const struct net_device *in,
121 const struct net_device *out,
122 struct nf_conn *ct));
123
Patrick McHardyc7232c92012-08-26 19:14:06 +0200124#endif /* _NF_NAT_L3PROTO_H */