1
2
3#ifndef _NF_NAT_L4PROTO_H
4#define _NF_NAT_L4PROTO_H
5#include <net/netfilter/nf_nat.h>
6#include <linux/netfilter/nfnetlink_conntrack.h>
7
8struct nf_nat_range;
9struct nf_nat_l3proto;
10
11struct nf_nat_l4proto {
12
13 u8 l4proto;
14
15
16
17
18 bool (*manip_pkt)(struct sk_buff *skb,
19 const struct nf_nat_l3proto *l3proto,
20 unsigned int iphdroff, unsigned int hdroff,
21 const struct nf_conntrack_tuple *tuple,
22 enum nf_nat_manip_type maniptype);
23
24
25 bool (*in_range)(const struct nf_conntrack_tuple *tuple,
26 enum nf_nat_manip_type maniptype,
27 const union nf_conntrack_man_proto *min,
28 const union nf_conntrack_man_proto *max);
29
30
31
32
33
34
35 void (*unique_tuple)(const struct nf_nat_l3proto *l3proto,
36 struct nf_conntrack_tuple *tuple,
37 const struct nf_nat_range *range,
38 enum nf_nat_manip_type maniptype,
39 const struct nf_conn *ct);
40
41 int (*nlattr_to_range)(struct nlattr *tb[],
42 struct nf_nat_range *range);
43};
44
45
46int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto);
47void nf_nat_l4proto_unregister(u8 l3proto,
48 const struct nf_nat_l4proto *l4proto);
49
50const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto);
51
52
53extern const struct nf_nat_l4proto nf_nat_l4proto_tcp;
54extern const struct nf_nat_l4proto nf_nat_l4proto_udp;
55extern const struct nf_nat_l4proto nf_nat_l4proto_icmp;
56extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6;
57extern const struct nf_nat_l4proto nf_nat_l4proto_unknown;
58#ifdef CONFIG_NF_NAT_PROTO_DCCP
59extern const struct nf_nat_l4proto nf_nat_l4proto_dccp;
60#endif
61#ifdef CONFIG_NF_NAT_PROTO_SCTP
62extern const struct nf_nat_l4proto nf_nat_l4proto_sctp;
63#endif
64#ifdef CONFIG_NF_NAT_PROTO_UDPLITE
65extern const struct nf_nat_l4proto nf_nat_l4proto_udplite;
66#endif
67
68bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple,
69 enum nf_nat_manip_type maniptype,
70 const union nf_conntrack_man_proto *min,
71 const union nf_conntrack_man_proto *max);
72
73void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
74 struct nf_conntrack_tuple *tuple,
75 const struct nf_nat_range *range,
76 enum nf_nat_manip_type maniptype,
77 const struct nf_conn *ct, u16 *rover);
78
79int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[],
80 struct nf_nat_range *range);
81
82#endif
83