]> git.ipfire.org Git - people/arne_f/kernel.git/blame - include/net/netfilter/nf_nat_l3proto.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[people/arne_f/kernel.git] / include / net / netfilter / nf_nat_l3proto.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
c7232c99
PM
2#ifndef _NF_NAT_L3PROTO_H
3#define _NF_NAT_L3PROTO_H
4
5struct nf_nat_l4proto;
6struct nf_nat_l3proto {
7 u8 l3proto;
8
9 bool (*in_range)(const struct nf_conntrack_tuple *t,
10 const struct nf_nat_range *range);
11
12 u32 (*secure_port)(const struct nf_conntrack_tuple *t, __be16);
13
14 bool (*manip_pkt)(struct sk_buff *skb,
15 unsigned int iphdroff,
16 const struct nf_nat_l4proto *l4proto,
17 const struct nf_conntrack_tuple *target,
18 enum nf_nat_manip_type maniptype);
19
20 void (*csum_update)(struct sk_buff *skb, unsigned int iphdroff,
21 __sum16 *check,
22 const struct nf_conntrack_tuple *t,
23 enum nf_nat_manip_type maniptype);
24
25 void (*csum_recalc)(struct sk_buff *skb, u8 proto,
26 void *data, __sum16 *check,
27 int datalen, int oldlen);
28
29 void (*decode_session)(struct sk_buff *skb,
30 const struct nf_conn *ct,
31 enum ip_conntrack_dir dir,
32 unsigned long statusbit,
33 struct flowi *fl);
34
35 int (*nlattr_to_range)(struct nlattr *tb[],
36 struct nf_nat_range *range);
37};
38
4e77be46
JP
39int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
40void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
41const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
42
43int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
44 enum ip_conntrack_info ctinfo,
45 unsigned int hooknum);
30766f4c 46
06198b34 47unsigned int nf_nat_ipv4_in(void *priv, struct sk_buff *skb,
d7cf4081 48 const struct nf_hook_state *state,
06198b34 49 unsigned int (*do_chain)(void *priv,
30766f4c 50 struct sk_buff *skb,
d7cf4081 51 const struct nf_hook_state *state,
30766f4c
PNA
52 struct nf_conn *ct));
53
06198b34 54unsigned int nf_nat_ipv4_out(void *priv, struct sk_buff *skb,
d7cf4081 55 const struct nf_hook_state *state,
06198b34 56 unsigned int (*do_chain)(void *priv,
30766f4c 57 struct sk_buff *skb,
d7cf4081 58 const struct nf_hook_state *state,
30766f4c
PNA
59 struct nf_conn *ct));
60
06198b34 61unsigned int nf_nat_ipv4_local_fn(void *priv,
30766f4c 62 struct sk_buff *skb,
d7cf4081 63 const struct nf_hook_state *state,
06198b34 64 unsigned int (*do_chain)(void *priv,
30766f4c 65 struct sk_buff *skb,
d7cf4081 66 const struct nf_hook_state *state,
30766f4c
PNA
67 struct nf_conn *ct));
68
06198b34 69unsigned int nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
d7cf4081 70 const struct nf_hook_state *state,
06198b34 71 unsigned int (*do_chain)(void *priv,
30766f4c 72 struct sk_buff *skb,
d7cf4081 73 const struct nf_hook_state *state,
30766f4c
PNA
74 struct nf_conn *ct));
75
4e77be46
JP
76int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
77 enum ip_conntrack_info ctinfo,
78 unsigned int hooknum, unsigned int hdrlen);
c7232c99 79
06198b34 80unsigned int nf_nat_ipv6_in(void *priv, struct sk_buff *skb,
8fe22382 81 const struct nf_hook_state *state,
06198b34 82 unsigned int (*do_chain)(void *priv,
2a5538e9 83 struct sk_buff *skb,
8fe22382 84 const struct nf_hook_state *state,
2a5538e9
PNA
85 struct nf_conn *ct));
86
06198b34 87unsigned int nf_nat_ipv6_out(void *priv, struct sk_buff *skb,
8fe22382 88 const struct nf_hook_state *state,
06198b34 89 unsigned int (*do_chain)(void *priv,
2a5538e9 90 struct sk_buff *skb,
8fe22382 91 const struct nf_hook_state *state,
2a5538e9
PNA
92 struct nf_conn *ct));
93
06198b34 94unsigned int nf_nat_ipv6_local_fn(void *priv,
2a5538e9 95 struct sk_buff *skb,
8fe22382 96 const struct nf_hook_state *state,
06198b34 97 unsigned int (*do_chain)(void *priv,
2a5538e9 98 struct sk_buff *skb,
8fe22382 99 const struct nf_hook_state *state,
2a5538e9
PNA
100 struct nf_conn *ct));
101
06198b34 102unsigned int nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
8fe22382 103 const struct nf_hook_state *state,
06198b34 104 unsigned int (*do_chain)(void *priv,
2a5538e9 105 struct sk_buff *skb,
8fe22382 106 const struct nf_hook_state *state,
2a5538e9
PNA
107 struct nf_conn *ct));
108
c7232c99 109#endif /* _NF_NAT_L3PROTO_H */