aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-08-11 12:21:49 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2014-08-18 15:55:54 -0400
commit8993cf8edf42527119186b558766539243b791a5 (patch)
tree1992aa7bef7373354a096519378a4ceba73ee97d
parent21009686662fd21412ca35def7cb3cc8346e1c3d (diff)
netfilter: move NAT Kconfig switches out of the iptables scope
Currently, the NAT configs depend on iptables and ip6tables. However, users should be capable of enabling NAT for nft without having to switch on iptables. Fix this by adding new specific IP_NF_NAT and IP6_NF_NAT config switches for iptables and ip6tables NAT support. I have also moved the original NF_NAT_IPV4 and NF_NAT_IPV6 configs out of the scope of iptables to make them independent of it. This patch also adds NETFILTER_XT_NAT which selects the xt_nat combo that provides snat/dnat for iptables. We cannot use NF_NAT anymore since nf_tables can select this. Reported-by: Matteo Croce <technoboy85@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/ipv4/netfilter/Kconfig102
-rw-r--r--net/ipv4/netfilter/Makefile2
-rw-r--r--net/ipv6/netfilter/Kconfig26
-rw-r--r--net/ipv6/netfilter/Makefile2
-rw-r--r--net/netfilter/Makefile2
5 files changed, 77 insertions, 57 deletions
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index fb173126f03d..7cbcaf4f0194 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -82,6 +82,52 @@ config NF_TABLES_ARP
82 help 82 help
83 This option enables the ARP support for nf_tables. 83 This option enables the ARP support for nf_tables.
84 84
85config NF_NAT_IPV4
86 tristate "IPv4 NAT"
87 depends on NF_CONNTRACK_IPV4
88 default m if NETFILTER_ADVANCED=n
89 select NF_NAT
90 help
91 The IPv4 NAT option allows masquerading, port forwarding and other
92 forms of full Network Address Port Translation. This can be
93 controlled by iptables or nft.
94
95if NF_NAT_IPV4
96
97config NF_NAT_SNMP_BASIC
98 tristate "Basic SNMP-ALG support"
99 depends on NF_CONNTRACK_SNMP
100 depends on NETFILTER_ADVANCED
101 default NF_NAT && NF_CONNTRACK_SNMP
102 ---help---
103
104 This module implements an Application Layer Gateway (ALG) for
105 SNMP payloads. In conjunction with NAT, it allows a network
106 management system to access multiple private networks with
107 conflicting addresses. It works by modifying IP addresses
108 inside SNMP payloads to match IP-layer NAT mapping.
109
110 This is the "basic" form of SNMP-ALG, as described in RFC 2962
111
112 To compile it as a module, choose M here. If unsure, say N.
113
114config NF_NAT_PROTO_GRE
115 tristate
116 depends on NF_CT_PROTO_GRE
117
118config NF_NAT_PPTP
119 tristate
120 depends on NF_CONNTRACK
121 default NF_CONNTRACK_PPTP
122 select NF_NAT_PROTO_GRE
123
124config NF_NAT_H323
125 tristate
126 depends on NF_CONNTRACK
127 default NF_CONNTRACK_H323
128
129endif # NF_NAT_IPV4
130
85config IP_NF_IPTABLES 131config IP_NF_IPTABLES
86 tristate "IP tables support (required for filtering/masq/NAT)" 132 tristate "IP tables support (required for filtering/masq/NAT)"
87 default m if NETFILTER_ADVANCED=n 133 default m if NETFILTER_ADVANCED=n
@@ -170,19 +216,21 @@ config IP_NF_TARGET_SYNPROXY
170 To compile it as a module, choose M here. If unsure, say N. 216 To compile it as a module, choose M here. If unsure, say N.
171 217
172# NAT + specific targets: nf_conntrack 218# NAT + specific targets: nf_conntrack
173config NF_NAT_IPV4 219config IP_NF_NAT
174 tristate "IPv4 NAT" 220 tristate "iptables NAT support"
175 depends on NF_CONNTRACK_IPV4 221 depends on NF_CONNTRACK_IPV4
176 default m if NETFILTER_ADVANCED=n 222 default m if NETFILTER_ADVANCED=n
177 select NF_NAT 223 select NF_NAT
224 select NF_NAT_IPV4
225 select NETFILTER_XT_NAT
178 help 226 help
179 The IPv4 NAT option allows masquerading, port forwarding and other 227 This enables the `nat' table in iptables. This allows masquerading,
180 forms of full Network Address Port Translation. It is controlled by 228 port forwarding and other forms of full Network Address Port
181 the `nat' table in iptables: see the man page for iptables(8). 229 Translation.
182 230
183 To compile it as a module, choose M here. If unsure, say N. 231 To compile it as a module, choose M here. If unsure, say N.
184 232
185if NF_NAT_IPV4 233if IP_NF_NAT
186 234
187config IP_NF_TARGET_MASQUERADE 235config IP_NF_TARGET_MASQUERADE
188 tristate "MASQUERADE target support" 236 tristate "MASQUERADE target support"
@@ -214,47 +262,7 @@ config IP_NF_TARGET_REDIRECT
214 (e.g. when running oldconfig). It selects 262 (e.g. when running oldconfig). It selects
215 CONFIG_NETFILTER_XT_TARGET_REDIRECT. 263 CONFIG_NETFILTER_XT_TARGET_REDIRECT.
216 264
217endif 265endif # IP_NF_NAT
218
219config NF_NAT_SNMP_BASIC
220 tristate "Basic SNMP-ALG support"
221 depends on NF_CONNTRACK_SNMP && NF_NAT_IPV4
222 depends on NETFILTER_ADVANCED
223 default NF_NAT && NF_CONNTRACK_SNMP
224 ---help---
225
226 This module implements an Application Layer Gateway (ALG) for
227 SNMP payloads. In conjunction with NAT, it allows a network
228 management system to access multiple private networks with
229 conflicting addresses. It works by modifying IP addresses
230 inside SNMP payloads to match IP-layer NAT mapping.
231
232 This is the "basic" form of SNMP-ALG, as described in RFC 2962
233
234 To compile it as a module, choose M here. If unsure, say N.
235
236# If they want FTP, set to $CONFIG_IP_NF_NAT (m or y),
237# or $CONFIG_IP_NF_FTP (m or y), whichever is weaker.
238# From kconfig-language.txt:
239#
240# <expr> '&&' <expr> (6)
241#
242# (6) Returns the result of min(/expr/, /expr/).
243
244config NF_NAT_PROTO_GRE
245 tristate
246 depends on NF_NAT_IPV4 && NF_CT_PROTO_GRE
247
248config NF_NAT_PPTP
249 tristate
250 depends on NF_CONNTRACK && NF_NAT_IPV4
251 default NF_NAT_IPV4 && NF_CONNTRACK_PPTP
252 select NF_NAT_PROTO_GRE
253
254config NF_NAT_H323
255 tristate
256 depends on NF_CONNTRACK && NF_NAT_IPV4
257 default NF_NAT_IPV4 && NF_CONNTRACK_H323
258 266
259# mangle + specific targets 267# mangle + specific targets
260config IP_NF_MANGLE 268config IP_NF_MANGLE
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile
index 33001621465b..edf4af32e9f2 100644
--- a/net/ipv4/netfilter/Makefile
+++ b/net/ipv4/netfilter/Makefile
@@ -43,7 +43,7 @@ obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
43# the three instances of ip_tables 43# the three instances of ip_tables
44obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o 44obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o
45obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o 45obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o
46obj-$(CONFIG_NF_NAT_IPV4) += iptable_nat.o 46obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o
47obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o 47obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o
48obj-$(CONFIG_IP_NF_SECURITY) += iptable_security.o 48obj-$(CONFIG_IP_NF_SECURITY) += iptable_security.o
49 49
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
index ac93df16f5af..cf0b88f30f6f 100644
--- a/net/ipv6/netfilter/Kconfig
+++ b/net/ipv6/netfilter/Kconfig
@@ -60,6 +60,16 @@ config NF_LOG_IPV6
60 depends on NETFILTER_ADVANCED 60 depends on NETFILTER_ADVANCED
61 select NF_LOG_COMMON 61 select NF_LOG_COMMON
62 62
63config NF_NAT_IPV6
64 tristate "IPv6 NAT"
65 depends on NF_CONNTRACK_IPV6
66 depends on NETFILTER_ADVANCED
67 select NF_NAT
68 help
69 The IPv6 NAT option allows masquerading, port forwarding and other
70 forms of full Network Address Port Translation. This can be
71 controlled by iptables or nft.
72
63config IP6_NF_IPTABLES 73config IP6_NF_IPTABLES
64 tristate "IP6 tables support (required for filtering)" 74 tristate "IP6 tables support (required for filtering)"
65 depends on INET && IPV6 75 depends on INET && IPV6
@@ -232,19 +242,21 @@ config IP6_NF_SECURITY
232 242
233 If unsure, say N. 243 If unsure, say N.
234 244
235config NF_NAT_IPV6 245config IP6_NF_NAT
236 tristate "IPv6 NAT" 246 tristate "ip6tables NAT support"
237 depends on NF_CONNTRACK_IPV6 247 depends on NF_CONNTRACK_IPV6
238 depends on NETFILTER_ADVANCED 248 depends on NETFILTER_ADVANCED
239 select NF_NAT 249 select NF_NAT
250 select NF_NAT_IPV6
251 select NETFILTER_XT_NAT
240 help 252 help
241 The IPv6 NAT option allows masquerading, port forwarding and other 253 This enables the `nat' table in ip6tables. This allows masquerading,
242 forms of full Network Address Port Translation. It is controlled by 254 port forwarding and other forms of full Network Address Port
243 the `nat' table in ip6tables, see the man page for ip6tables(8). 255 Translation.
244 256
245 To compile it as a module, choose M here. If unsure, say N. 257 To compile it as a module, choose M here. If unsure, say N.
246 258
247if NF_NAT_IPV6 259if IP6_NF_NAT
248 260
249config IP6_NF_TARGET_MASQUERADE 261config IP6_NF_TARGET_MASQUERADE
250 tristate "MASQUERADE target support" 262 tristate "MASQUERADE target support"
@@ -265,7 +277,7 @@ config IP6_NF_TARGET_NPT
265 277
266 To compile it as a module, choose M here. If unsure, say N. 278 To compile it as a module, choose M here. If unsure, say N.
267 279
268endif # NF_NAT_IPV6 280endif # IP6_NF_NAT
269 281
270endif # IP6_NF_IPTABLES 282endif # IP6_NF_IPTABLES
271 283
diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile
index c0b263104ed2..c3d3286db4bb 100644
--- a/net/ipv6/netfilter/Makefile
+++ b/net/ipv6/netfilter/Makefile
@@ -8,7 +8,7 @@ obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
8obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o 8obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
9obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o 9obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o
10obj-$(CONFIG_IP6_NF_SECURITY) += ip6table_security.o 10obj-$(CONFIG_IP6_NF_SECURITY) += ip6table_security.o
11obj-$(CONFIG_NF_NAT_IPV6) += ip6table_nat.o 11obj-$(CONFIG_IP6_NF_NAT) += ip6table_nat.o
12 12
13# objects for l3 independent conntrack 13# objects for l3 independent conntrack
14nf_conntrack_ipv6-y := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o 14nf_conntrack_ipv6-y := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile
index 8308624a406a..fad5fdba34e5 100644
--- a/net/netfilter/Makefile
+++ b/net/netfilter/Makefile
@@ -95,7 +95,7 @@ obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
95obj-$(CONFIG_NETFILTER_XT_MARK) += xt_mark.o 95obj-$(CONFIG_NETFILTER_XT_MARK) += xt_mark.o
96obj-$(CONFIG_NETFILTER_XT_CONNMARK) += xt_connmark.o 96obj-$(CONFIG_NETFILTER_XT_CONNMARK) += xt_connmark.o
97obj-$(CONFIG_NETFILTER_XT_SET) += xt_set.o 97obj-$(CONFIG_NETFILTER_XT_SET) += xt_set.o
98obj-$(CONFIG_NF_NAT) += xt_nat.o 98obj-$(CONFIG_NETFILTER_XT_NAT) += xt_nat.o
99 99
100# targets 100# targets
101obj-$(CONFIG_NETFILTER_XT_TARGET_AUDIT) += xt_AUDIT.o 101obj-$(CONFIG_NETFILTER_XT_TARGET_AUDIT) += xt_AUDIT.o