iptables: bump to 1.4.21
[openwrt/openwrt.git] / package / network / utils / iptables / Makefile
1 #
2 # Copyright (C) 2006-2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=iptables
12 PKG_VERSION:=1.4.21
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
17 ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
18 ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
19 ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
20 PKG_MD5SUM:=536d048c8e8eeebcd9757d0863ebb0c0
21
22 PKG_FIXUP:=autoreconf
23 PKG_INSTALL:=1
24 PKG_BUILD_PARALLEL:=1
25
26 ifneq ($(CONFIG_EXTERNAL_KERNEL_TREE),"")
27 PATCH_DIR:=
28 endif
29
30 include $(INCLUDE_DIR)/package.mk
31 ifeq ($(DUMP),)
32 -include $(LINUX_DIR)/.config
33 include $(INCLUDE_DIR)/netfilter.mk
34 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
35 endif
36
37
38 define Package/iptables/Default
39 SECTION:=net
40 CATEGORY:=Network
41 SUBMENU:=Firewall
42 URL:=http://netfilter.org/
43 endef
44
45 define Package/iptables/Module
46 $(call Package/iptables/Default)
47 DEPENDS:=iptables $(1)
48 endef
49
50 define Package/iptables
51 $(call Package/iptables/Default)
52 TITLE:=IP firewall administration tool
53 MENU:=1
54 DEPENDS+= +kmod-ipt-core +libip4tc +IPV6:libip6tc +libxtables
55 endef
56
57 define Package/iptables/description
58 IP firewall administration tool.
59
60 Matches:
61 - icmp
62 - tcp
63 - udp
64 - comment
65 - conntrack
66 - limit
67 - mac
68 - mark
69 - multiport
70 - set
71 - state
72 - time
73
74 Targets:
75 - ACCEPT
76 - CT
77 - DNAT
78 - DROP
79 - REJECT
80 - LOG
81 - MARK
82 - MASQUERADE
83 - REDIRECT
84 - SET
85 - SNAT
86 - TCPMSS
87
88 Tables:
89 - filter
90 - mangle
91 - nat
92 - raw
93
94 endef
95
96 define Package/iptables-mod-conntrack-extra
97 $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
98 TITLE:=Extra connection tracking extensions
99 endef
100
101 define Package/iptables-mod-conntrack-extra/description
102 Extra iptables extensions for connection tracking.
103
104 Matches:
105 - connbytes
106 - connmark
107 - recent
108 - helper
109
110 Targets:
111 - CONNMARK
112
113 endef
114
115 define Package/iptables-mod-filter
116 $(call Package/iptables/Module, +kmod-ipt-filter)
117 TITLE:=Content inspection extensions
118 endef
119
120 define Package/iptables-mod-filter/description
121 iptables extensions for packet content inspection.
122 Includes support for:
123
124 Matches:
125 - layer7
126 - string
127
128 endef
129
130 define Package/iptables-mod-ipopt
131 $(call Package/iptables/Module, +kmod-ipt-ipopt)
132 TITLE:=IP/Packet option extensions
133 endef
134
135 define Package/iptables-mod-ipopt/description
136 iptables extensions for matching/changing IP packet options.
137
138 Matches:
139 - dscp
140 - ecn
141 - length
142 - statistic
143 - tcpmss
144 - unclean
145 - hl
146
147 Targets:
148 - DSCP
149 - CLASSIFY
150 - ECN
151 - HL
152
153 endef
154
155 define Package/iptables-mod-ipsec
156 $(call Package/iptables/Module, +kmod-ipt-ipsec)
157 TITLE:=IPsec extensions
158 endef
159
160 define Package/iptables-mod-ipsec/description
161 iptables extensions for matching ipsec traffic.
162
163 Matches:
164 - ah
165 - esp
166 - policy
167
168 endef
169
170 define Package/iptables-mod-nat-extra
171 $(call Package/iptables/Module, +kmod-ipt-nat-extra)
172 TITLE:=Extra NAT extensions
173 endef
174
175 define Package/iptables-mod-nat-extra/description
176 iptables extensions for extra NAT targets.
177
178 Targets:
179 - MIRROR
180 - NETMAP
181 endef
182
183 define Package/iptables-mod-ulog
184 $(call Package/iptables/Module, +kmod-ipt-ulog)
185 TITLE:=user-space packet logging
186 endef
187
188 define Package/iptables-mod-ulog/description
189 iptables extensions for user-space packet logging.
190
191 Targets:
192 - ULOG
193
194 endef
195
196 define Package/iptables-mod-hashlimit
197 $(call Package/iptables/Module, +kmod-ipt-hashlimit)
198 TITLE:=hashlimit matching
199 endef
200
201 define Package/iptables-mod-hashlimit/description
202 iptables extensions for hashlimit matching
203
204 Matches:
205 - hashlimit
206
207 endef
208
209 define Package/iptables-mod-iprange
210 $(call Package/iptables/Module, +kmod-ipt-iprange)
211 TITLE:=IP range extension
212 endef
213
214 define Package/iptables-mod-iprange/description
215 iptables extensions for matching ip ranges.
216
217 Matches:
218 - iprange
219
220 endef
221
222 define Package/iptables-mod-extra
223 $(call Package/iptables/Module, +kmod-ipt-extra)
224 TITLE:=Other extra iptables extensions
225 endef
226
227 define Package/iptables-mod-extra/description
228 Other extra iptables extensions.
229
230 Matches:
231 - addrtype
232 - condition
233 - owner
234 - physdev (if ebtables is enabled)
235 - pkttype
236 - quota
237
238 endef
239
240 define Package/iptables-mod-led
241 $(call Package/iptables/Module, +kmod-ipt-led)
242 TITLE:=LED trigger iptables extension
243 endef
244
245 define Package/iptables-mod-led/description
246 iptables extension for triggering a LED.
247
248 Targets:
249 - LED
250
251 endef
252
253 define Package/iptables-mod-tproxy
254 $(call Package/iptables/Module, +kmod-ipt-tproxy)
255 TITLE:=Transparent proxy iptables extensions
256 endef
257
258 define Package/iptables-mod-tproxy/description
259 Transparent proxy iptables extensions.
260
261 Matches:
262 - socket
263
264 Targets:
265 - TPROXY
266
267 endef
268
269 define Package/iptables-mod-tee
270 $(call Package/iptables/Module, +kmod-ipt-tee)
271 TITLE:=TEE iptables extensions
272 endef
273
274 define Package/iptables-mod-tee/description
275 TEE iptables extensions.
276
277 Targets:
278 - TEE
279
280 endef
281
282 define Package/iptables-mod-u32
283 $(call Package/iptables/Module, +kmod-ipt-u32)
284 TITLE:=U32 iptables extensions
285 endef
286
287 define Package/iptables-mod-u32/description
288 U32 iptables extensions.
289
290 Matches:
291 - u32
292
293 endef
294
295 define Package/ip6tables
296 $(call Package/iptables/Default)
297 DEPENDS:=@IPV6 +kmod-ip6tables +iptables
298 CATEGORY:=Network
299 TITLE:=IPv6 firewall administration tool
300 MENU:=1
301 endef
302
303
304 define Package/ip6tables-mod-nat
305 $(call Package/iptables/Default)
306 DEPENDS:=ip6tables +kmod-ipt-nat6
307 TITLE:=IPv6 NAT extensions
308 endef
309
310 define Package/ip6tables-mod-nat/description
311 iptables extensions for IPv6-NAT targets.
312 endef
313
314 define Package/libiptc
315 $(call Package/iptables/Default)
316 SECTION:=libs
317 CATEGORY:=Libraries
318 DEPENDS:=+libip4tc +libip6tc
319 TITLE:=IPv4/IPv6 firewall - shared libiptc library (compatibility stub)
320 endef
321
322 define Package/libip4tc
323 $(call Package/iptables/Default)
324 SECTION:=libs
325 CATEGORY:=Libraries
326 TITLE:=IPv4 firewall - shared libiptc library
327 endef
328
329 define Package/libip6tc
330 $(call Package/iptables/Default)
331 SECTION:=libs
332 CATEGORY:=Libraries
333 TITLE:=IPv6 firewall - shared libiptc library
334 endef
335
336 define Package/libxtables
337 $(call Package/iptables/Default)
338 SECTION:=libs
339 CATEGORY:=Libraries
340 TITLE:=IPv4/IPv6 firewall - shared xtables library
341 endef
342
343 TARGET_CPPFLAGS := \
344 -I$(PKG_BUILD_DIR)/include \
345 -I$(LINUX_DIR)/user_headers/include \
346 $(TARGET_CPPFLAGS)
347
348 TARGET_CFLAGS += \
349 -I$(PKG_BUILD_DIR)/include \
350 -I$(LINUX_DIR)/user_headers/include \
351 -ffunction-sections -fdata-sections
352
353 TARGET_LDFLAGS += \
354 -Wl,--gc-sections
355
356 CONFIGURE_ARGS += \
357 --enable-shared \
358 --enable-devel \
359 --with-kernel="$(LINUX_DIR)/user_headers" \
360 --with-xtlibdir=/usr/lib/iptables \
361 --enable-static
362
363 MAKE_FLAGS := \
364 $(TARGET_CONFIGURE_OPTS) \
365 COPT_FLAGS="$(TARGET_CFLAGS)" \
366 KERNEL_DIR="$(LINUX_DIR)/user_headers/" PREFIX=/usr \
367 KBUILD_OUTPUT="$(LINUX_DIR)" \
368 BUILTIN_MODULES="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
369
370 define Build/InstallDev
371 $(INSTALL_DIR) $(1)/usr/include
372 $(INSTALL_DIR) $(1)/usr/include/iptables
373 $(INSTALL_DIR) $(1)/usr/include/net/netfilter
374
375 # XXX: iptables header fixup, some headers are not installed by iptables anymore
376 $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
377 $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
378 $(CP) $(PKG_BUILD_DIR)/include/ip6tables.h $(1)/usr/include/
379 $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
380 $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
381
382 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
383 $(INSTALL_DIR) $(1)/usr/lib
384 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
385 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
386 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
387 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
388 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libip*tc.pc $(1)/usr/lib/pkgconfig/
389
390 # XXX: needed by firewall3
391 $(INSTALL_DIR) $(1)/usr/lib/iptables
392 $(CP) $(PKG_BUILD_DIR)/extensions/libext*.a $(1)/usr/lib/iptables/
393 endef
394
395 define Package/iptables/install
396 $(INSTALL_DIR) $(1)/usr/sbin
397 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-multi $(1)/usr/sbin/
398 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore,-save} $(1)/usr/sbin/
399 $(INSTALL_DIR) $(1)/usr/lib/iptables
400 endef
401
402 define Package/ip6tables/install
403 $(INSTALL_DIR) $(1)/usr/sbin
404 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-restore,-save} $(1)/usr/sbin/
405 endef
406
407 define Package/libiptc/install
408 $(INSTALL_DIR) $(1)/usr/lib
409 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so* $(1)/usr/lib/
410 endef
411
412 define Package/libip4tc/install
413 $(INSTALL_DIR) $(1)/usr/lib
414 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so* $(1)/usr/lib/
415 endef
416
417 define Package/libip6tc/install
418 $(INSTALL_DIR) $(1)/usr/lib
419 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip6tc.so* $(1)/usr/lib/
420 endef
421
422 define Package/libxtables/install
423 $(INSTALL_DIR) $(1)/usr/lib
424 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
425 endef
426
427 define BuildPlugin
428 define Package/$(1)/install
429 $(INSTALL_DIR) $$(1)/usr/lib/iptables
430 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)) $(patsubst xt_%,ip6t_%,$(2)) $(patsubst ip6t_%,xt_%,$(2)); do \
431 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
432 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
433 fi; \
434 done
435 $(3)
436 endef
437
438 $$(eval $$(call BuildPackage,$(1)))
439 endef
440
441 L7_INSTALL:=\
442 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
443 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
444
445
446 $(eval $(call BuildPackage,iptables))
447 $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
448 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
449 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
450 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
451 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
452 $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
453 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
454 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
455 $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
456 $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
457 $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
458 $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
459 $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
460 $(eval $(call BuildPackage,ip6tables))
461 $(eval $(call BuildPlugin,ip6tables-mod-nat,$(IPT_NAT6-m)))
462 $(eval $(call BuildPackage,libiptc))
463 $(eval $(call BuildPackage,libip4tc))
464 $(eval $(call BuildPackage,libip6tc))
465 $(eval $(call BuildPackage,libxtables))