summaryrefslogtreecommitdiff
path: root/include/net/netfilter/nf_nat_l3proto.h
blob: ac47098a61dcaad5a29a1372e7763aad2dea8457 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _NF_NAT_L3PROTO_H
#define _NF_NAT_L3PROTO_H

struct nf_nat_l4proto;
struct nf_nat_l3proto {
	u8	l3proto;

	bool	(*in_range)(const struct nf_conntrack_tuple *t,
			    const struct nf_nat_range2 *range);

	u32 	(*secure_port)(const struct nf_conntrack_tuple *t, __be16);

	bool	(*manip_pkt)(struct sk_buff *skb,
			     unsigned int iphdroff,
			     const struct nf_nat_l4proto *l4proto,
			     const struct nf_conntrack_tuple *target,
			     enum nf_nat_manip_type maniptype);

	void	(*csum_update)(struct sk_buff *skb, unsigned int iphdroff,
			       __sum16 *check,
			       const struct nf_conntrack_tuple *t,
			       enum nf_nat_manip_type maniptype);

	void	(*csum_recalc)(struct sk_buff *skb, u8 proto,
			       void *data, __sum16 *check,
			       int datalen, int oldlen);

	void	(*decode_session)(struct sk_buff *skb,
				  const struct nf_conn *ct,
				  enum ip_conntrack_dir dir,
				  unsigned long statusbit,
				  struct flowi *fl);

	int	(*nlattr_to_range)(struct nlattr *tb[],
				   struct nf_nat_range2 *range);
};

int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);

int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
				  enum ip_conntrack_info ctinfo,
				  unsigned int hooknum);

unsigned int nf_nat_ipv4_in(void *priv, struct sk_buff *skb,
			    const struct nf_hook_state *state,
			    unsigned int (*do_chain)(void *priv,
						     struct sk_buff *skb,
						     const struct nf_hook_state *state,
						     struct nf_conn *ct));

unsigned int nf_nat_ipv4_out(void *priv, struct sk_buff *skb,
			     const struct nf_hook_state *state,
			     unsigned int (*do_chain)(void *priv,
						      struct sk_buff *skb,
						      const struct nf_hook_state *state,
						      struct nf_conn *ct));

unsigned int nf_nat_ipv4_local_fn(void *priv,
				  struct sk_buff *skb,
				  const struct nf_hook_state *state,
				  unsigned int (*do_chain)(void *priv,
							   struct sk_buff *skb,
							   const struct nf_hook_state *state,
							   struct nf_conn *ct));

unsigned int nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
			    const struct nf_hook_state *state,
			    unsigned int (*do_chain)(void *priv,
						     struct sk_buff *skb,
						     const struct nf_hook_state *state,
						     struct nf_conn *ct));

int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
				    enum ip_conntrack_info ctinfo,
				    unsigned int hooknum, unsigned int hdrlen);

unsigned int nf_nat_ipv6_in(void *priv, struct sk_buff *skb,
			    const struct nf_hook_state *state,
			    unsigned int (*do_chain)(void *priv,
						     struct sk_buff *skb,
						     const struct nf_hook_state *state,
						     struct nf_conn *ct));

unsigned int nf_nat_ipv6_out(void *priv, struct sk_buff *skb,
			     const struct nf_hook_state *state,
			     unsigned int (*do_chain)(void *priv,
						      struct sk_buff *skb,
						      const struct nf_hook_state *state,
						      struct nf_conn *ct));

unsigned int nf_nat_ipv6_local_fn(void *priv,
				  struct sk_buff *skb,
				  const struct nf_hook_state *state,
				  unsigned int (*do_chain)(void *priv,
							   struct sk_buff *skb,
							   const struct nf_hook_state *state,
							   struct nf_conn *ct));

unsigned int nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
			    const struct nf_hook_state *state,
			    unsigned int (*do_chain)(void *priv,
						     struct sk_buff *skb,
						     const struct nf_hook_state *state,
						     struct nf_conn *ct));

#endif /* _NF_NAT_L3PROTO_H */