blob: aef3e5fc9fd935970d3bfe7d6ac2c6c65bb58425 [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
Eric W. Biederman06198b32015-09-18 14:33:06 -050046unsigned int nf_nat_ipv4_in(void *priv, struct sk_buff *skb,
David S. Millerd7cf4082015-04-03 20:51:13 -040047 const struct nf_hook_state *state,
Eric W. Biederman06198b32015-09-18 14:33:06 -050048 unsigned int (*do_chain)(void *priv,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020049 struct sk_buff *skb,
David S. Millerd7cf4082015-04-03 20:51:13 -040050 const struct nf_hook_state *state,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020051 struct nf_conn *ct));
52
Eric W. Biederman06198b32015-09-18 14:33:06 -050053unsigned int nf_nat_ipv4_out(void *priv, struct sk_buff *skb,
David S. Millerd7cf4082015-04-03 20:51:13 -040054 const struct nf_hook_state *state,
Eric W. Biederman06198b32015-09-18 14:33:06 -050055 unsigned int (*do_chain)(void *priv,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020056 struct sk_buff *skb,
David S. Millerd7cf4082015-04-03 20:51:13 -040057 const struct nf_hook_state *state,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020058 struct nf_conn *ct));
59
Eric W. Biederman06198b32015-09-18 14:33:06 -050060unsigned int nf_nat_ipv4_local_fn(void *priv,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020061 struct sk_buff *skb,
David S. Millerd7cf4082015-04-03 20:51:13 -040062 const struct nf_hook_state *state,
Eric W. Biederman06198b32015-09-18 14:33:06 -050063 unsigned int (*do_chain)(void *priv,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020064 struct sk_buff *skb,
David S. Millerd7cf4082015-04-03 20:51:13 -040065 const struct nf_hook_state *state,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020066 struct nf_conn *ct));
67
Eric W. Biederman06198b32015-09-18 14:33:06 -050068unsigned int nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
David S. Millerd7cf4082015-04-03 20:51:13 -040069 const struct nf_hook_state *state,
Eric W. Biederman06198b32015-09-18 14:33:06 -050070 unsigned int (*do_chain)(void *priv,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020071 struct sk_buff *skb,
David S. Millerd7cf4082015-04-03 20:51:13 -040072 const struct nf_hook_state *state,
Pablo Neira Ayuso30766f42014-08-05 20:02:42 +020073 struct nf_conn *ct));
74
Joe Perches4e77be42013-09-23 11:37:48 -070075int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
76 enum ip_conntrack_info ctinfo,
77 unsigned int hooknum, unsigned int hdrlen);
Patrick McHardyc7232c92012-08-26 19:14:06 +020078
Eric W. Biederman06198b32015-09-18 14:33:06 -050079unsigned int nf_nat_ipv6_in(void *priv, struct sk_buff *skb,
David S. Miller8fe22382015-04-03 21:05:07 -040080 const struct nf_hook_state *state,
Eric W. Biederman06198b32015-09-18 14:33:06 -050081 unsigned int (*do_chain)(void *priv,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +020082 struct sk_buff *skb,
David S. Miller8fe22382015-04-03 21:05:07 -040083 const struct nf_hook_state *state,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +020084 struct nf_conn *ct));
85
Eric W. Biederman06198b32015-09-18 14:33:06 -050086unsigned int nf_nat_ipv6_out(void *priv, struct sk_buff *skb,
David S. Miller8fe22382015-04-03 21:05:07 -040087 const struct nf_hook_state *state,
Eric W. Biederman06198b32015-09-18 14:33:06 -050088 unsigned int (*do_chain)(void *priv,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +020089 struct sk_buff *skb,
David S. Miller8fe22382015-04-03 21:05:07 -040090 const struct nf_hook_state *state,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +020091 struct nf_conn *ct));
92
Eric W. Biederman06198b32015-09-18 14:33:06 -050093unsigned int nf_nat_ipv6_local_fn(void *priv,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +020094 struct sk_buff *skb,
David S. Miller8fe22382015-04-03 21:05:07 -040095 const struct nf_hook_state *state,
Eric W. Biederman06198b32015-09-18 14:33:06 -050096 unsigned int (*do_chain)(void *priv,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +020097 struct sk_buff *skb,
David S. Miller8fe22382015-04-03 21:05:07 -040098 const struct nf_hook_state *state,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +020099 struct nf_conn *ct));
100
Eric W. Biederman06198b32015-09-18 14:33:06 -0500101unsigned int nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
David S. Miller8fe22382015-04-03 21:05:07 -0400102 const struct nf_hook_state *state,
Eric W. Biederman06198b32015-09-18 14:33:06 -0500103 unsigned int (*do_chain)(void *priv,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +0200104 struct sk_buff *skb,
David S. Miller8fe22382015-04-03 21:05:07 -0400105 const struct nf_hook_state *state,
Pablo Neira Ayuso2a5538e2014-08-25 12:05:27 +0200106 struct nf_conn *ct));
107
Patrick McHardyc7232c92012-08-26 19:14:06 +0200108#endif /* _NF_NAT_L3PROTO_H */