]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/net/netfilter/nf_nat_l3proto.h
netfilter: rpfilter: fix incorrect loopback packet judgment
[mirror_ubuntu-zesty-kernel.git] / include / net / netfilter / nf_nat_l3proto.h
CommitLineData
c7232c99
PM
1#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
4e77be46
JP
38int 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);
41
42int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
43 enum ip_conntrack_info ctinfo,
44 unsigned int hooknum);
30766f4c 45
06198b34 46unsigned int nf_nat_ipv4_in(void *priv, struct sk_buff *skb,
d7cf4081 47 const struct nf_hook_state *state,
06198b34 48 unsigned int (*do_chain)(void *priv,
30766f4c 49 struct sk_buff *skb,
d7cf4081 50 const struct nf_hook_state *state,
30766f4c
PNA
51 struct nf_conn *ct));
52
06198b34 53unsigned int nf_nat_ipv4_out(void *priv, struct sk_buff *skb,
d7cf4081 54 const struct nf_hook_state *state,
06198b34 55 unsigned int (*do_chain)(void *priv,
30766f4c 56 struct sk_buff *skb,
d7cf4081 57 const struct nf_hook_state *state,
30766f4c
PNA
58 struct nf_conn *ct));
59
06198b34 60unsigned int nf_nat_ipv4_local_fn(void *priv,
30766f4c 61 struct sk_buff *skb,
d7cf4081 62 const struct nf_hook_state *state,
06198b34 63 unsigned int (*do_chain)(void *priv,
30766f4c 64 struct sk_buff *skb,
d7cf4081 65 const struct nf_hook_state *state,
30766f4c
PNA
66 struct nf_conn *ct));
67
06198b34 68unsigned int nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
d7cf4081 69 const struct nf_hook_state *state,
06198b34 70 unsigned int (*do_chain)(void *priv,
30766f4c 71 struct sk_buff *skb,
d7cf4081 72 const struct nf_hook_state *state,
30766f4c
PNA
73 struct nf_conn *ct));
74
4e77be46
JP
75int 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);
c7232c99 78
06198b34 79unsigned int nf_nat_ipv6_in(void *priv, struct sk_buff *skb,
8fe22382 80 const struct nf_hook_state *state,
06198b34 81 unsigned int (*do_chain)(void *priv,
2a5538e9 82 struct sk_buff *skb,
8fe22382 83 const struct nf_hook_state *state,
2a5538e9
PNA
84 struct nf_conn *ct));
85
06198b34 86unsigned int nf_nat_ipv6_out(void *priv, struct sk_buff *skb,
8fe22382 87 const struct nf_hook_state *state,
06198b34 88 unsigned int (*do_chain)(void *priv,
2a5538e9 89 struct sk_buff *skb,
8fe22382 90 const struct nf_hook_state *state,
2a5538e9
PNA
91 struct nf_conn *ct));
92
06198b34 93unsigned int nf_nat_ipv6_local_fn(void *priv,
2a5538e9 94 struct sk_buff *skb,
8fe22382 95 const struct nf_hook_state *state,
06198b34 96 unsigned int (*do_chain)(void *priv,
2a5538e9 97 struct sk_buff *skb,
8fe22382 98 const struct nf_hook_state *state,
2a5538e9
PNA
99 struct nf_conn *ct));
100
06198b34 101unsigned int nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
8fe22382 102 const struct nf_hook_state *state,
06198b34 103 unsigned int (*do_chain)(void *priv,
2a5538e9 104 struct sk_buff *skb,
8fe22382 105 const struct nf_hook_state *state,
2a5538e9
PNA
106 struct nf_conn *ct));
107
c7232c99 108#endif /* _NF_NAT_L3PROTO_H */