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