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 
15 #define NF_NAT_RANGE_PROTO_RANDOM_ALL		\
16 	(NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
17 
18 #define NF_NAT_RANGE_MASK					\
19 	(NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED |	\
20 	 NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT |	\
21 	 NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET)
22 
23 struct nf_nat_ipv4_range {
24 	unsigned int			flags;
25 	__be32				min_ip;
26 	__be32				max_ip;
27 	union nf_conntrack_man_proto	min;
28 	union nf_conntrack_man_proto	max;
29 };
30 
31 struct nf_nat_ipv4_multi_range_compat {
32 	unsigned int			rangesize;
33 	struct nf_nat_ipv4_range	range[1];
34 };
35 
36 struct nf_nat_range {
37 	unsigned int			flags;
38 	union nf_inet_addr		min_addr;
39 	union nf_inet_addr		max_addr;
40 	union nf_conntrack_man_proto	min_proto;
41 	union nf_conntrack_man_proto	max_proto;
42 };
43 
44 struct nf_nat_range2 {
45 	unsigned int			flags;
46 	union nf_inet_addr		min_addr;
47 	union nf_inet_addr		max_addr;
48 	union nf_conntrack_man_proto	min_proto;
49 	union nf_conntrack_man_proto	max_proto;
50 	union nf_conntrack_man_proto	base_proto;
51 };
52 
53 #endif /* _NETFILTER_NF_NAT_H */
54