1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _NF_NAT_L3PROTO_H
3 #define _NF_NAT_L3PROTO_H
6 struct nf_nat_l3proto {
9 bool (*in_range)(const struct nf_conntrack_tuple *t,
10 const struct nf_nat_range *range);
12 u32 (*secure_port)(const struct nf_conntrack_tuple *t, __be16);
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);
20 void (*csum_update)(struct sk_buff *skb, unsigned int iphdroff,
22 const struct nf_conntrack_tuple *t,
23 enum nf_nat_manip_type maniptype);
25 void (*csum_recalc)(struct sk_buff *skb, u8 proto,
26 void *data, __sum16 *check,
27 int datalen, int oldlen);
29 void (*decode_session)(struct sk_buff *skb,
30 const struct nf_conn *ct,
31 enum ip_conntrack_dir dir,
32 unsigned long statusbit,
35 int (*nlattr_to_range)(struct nlattr *tb[],
36 struct nf_nat_range *range);
39 int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
40 void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
41 const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
43 int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
44 enum ip_conntrack_info ctinfo,
45 unsigned int hooknum);
47 unsigned int nf_nat_ipv4_in(void *priv, struct sk_buff *skb,
48 const struct nf_hook_state *state,
49 unsigned int (*do_chain)(void *priv,
51 const struct nf_hook_state *state,
54 unsigned int nf_nat_ipv4_out(void *priv, struct sk_buff *skb,
55 const struct nf_hook_state *state,
56 unsigned int (*do_chain)(void *priv,
58 const struct nf_hook_state *state,
61 unsigned int nf_nat_ipv4_local_fn(void *priv,
63 const struct nf_hook_state *state,
64 unsigned int (*do_chain)(void *priv,
66 const struct nf_hook_state *state,
69 unsigned int nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
70 const struct nf_hook_state *state,
71 unsigned int (*do_chain)(void *priv,
73 const struct nf_hook_state *state,
76 int 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);
80 unsigned int nf_nat_ipv6_in(void *priv, struct sk_buff *skb,
81 const struct nf_hook_state *state,
82 unsigned int (*do_chain)(void *priv,
84 const struct nf_hook_state *state,
87 unsigned int nf_nat_ipv6_out(void *priv, struct sk_buff *skb,
88 const struct nf_hook_state *state,
89 unsigned int (*do_chain)(void *priv,
91 const struct nf_hook_state *state,
94 unsigned int nf_nat_ipv6_local_fn(void *priv,
96 const struct nf_hook_state *state,
97 unsigned int (*do_chain)(void *priv,
99 const struct nf_hook_state *state,
100 struct nf_conn *ct));
102 unsigned int nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
103 const struct nf_hook_state *state,
104 unsigned int (*do_chain)(void *priv,
106 const struct nf_hook_state *state,
107 struct nf_conn *ct));
109 #endif /* _NF_NAT_L3PROTO_H */