1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _NETFILTER_NF_NAT_H
3 #define _NETFILTER_NF_NAT_H
4 
5 #include <linux/netfilter.h>
6 #include <linux/netfilter/nf_conntrack_tuple_common.h>
7 
8 #define NF_NAT_RANGE_MAP_IPS			(1 << 0)
9 #define NF_NAT_RANGE_PROTO_SPECIFIED		(1 << 1)
10 #define NF_NAT_RANGE_PROTO_RANDOM		(1 << 2)
11 #define NF_NAT_RANGE_PERSISTENT			(1 << 3)
12 #define NF_NAT_RANGE_PROTO_RANDOM_FULLY		(1 << 4)
13 #define NF_NAT_RANGE_PROTO_OFFSET		(1 << 5)
14 #define NF_NAT_RANGE_NETMAP			(1 << 6)
15 
16 #define NF_NAT_RANGE_PROTO_RANDOM_ALL		\
17 	(NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
18 
19 #define NF_NAT_RANGE_MASK					\
20 	(NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED |	\
21 	 NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT |	\
22 	 NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET | \
23 	 NF_NAT_RANGE_NETMAP)
24 
25 struct nf_nat_ipv4_range {
26 	unsigned int			flags;
27 	__be32				min_ip;
28 	__be32				max_ip;
29 	union nf_conntrack_man_proto	min;
30 	union nf_conntrack_man_proto	max;
31 };
32 
33 struct nf_nat_ipv4_multi_range_compat {
34 	unsigned int			rangesize;
35 	struct nf_nat_ipv4_range	range[1];
36 };
37 
38 struct nf_nat_range {
39 	unsigned int			flags;
40 	union nf_inet_addr		min_addr;
41 	union nf_inet_addr		max_addr;
42 	union nf_conntrack_man_proto	min_proto;
43 	union nf_conntrack_man_proto	max_proto;
44 };
45 
46 struct nf_nat_range2 {
47 	unsigned int			flags;
48 	union nf_inet_addr		min_addr;
49 	union nf_inet_addr		max_addr;
50 	union nf_conntrack_man_proto	min_proto;
51 	union nf_conntrack_man_proto	max_proto;
52 	union nf_conntrack_man_proto	base_proto;
53 };
54 
55 #endif /* _NETFILTER_NF_NAT_H */
56