package/iptables: update to 1.4.9.1 and cleanup: * call autogen.sh in Build/Prepare...
[openwrt/staging/yousong.git] / package / iptables / Makefile
1 #
2 # Copyright (C) 2006-2010 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.9.1
13 PKG_RELEASE:=1
14
15 PKG_MD5SUM:=fbadfb0b5f2dbda49e0ad06a798898e3
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
18 ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
19 ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
20 ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
21
22 PKG_FIXUP:=libtool
23 PKG_INSTALL:=1
24
25 include $(INCLUDE_DIR)/package.mk
26 ifeq ($(DUMP),)
27 -include $(LINUX_DIR)/.config
28 include $(INCLUDE_DIR)/netfilter.mk
29 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
30 endif
31
32
33 define Package/iptables/Default
34 SECTION:=net
35 CATEGORY:=Network
36 URL:=http://netfilter.org/
37 endef
38
39 define Package/iptables/Module
40 $(call Package/iptables/Default)
41 DEPENDS:=iptables $(1)
42 endef
43
44 define Package/iptables
45 $(call Package/iptables/Default)
46 TITLE:=IPv4 firewall administration tool
47 MENU:=1
48 DEPENDS+= +kmod-ipt-core +libiptc +libxtables
49 endef
50
51 define Package/iptables/description
52 IPv4 firewall administration tool.
53 Includes support for:
54 - comment
55 - limit
56 - LOG
57 - mac
58 - multiport
59 - REJECT
60 - TCPMSS
61 endef
62
63 define Package/iptables-mod-conntrack
64 $(call Package/iptables/Module, +kmod-ipt-conntrack)
65 TITLE:=Basic connection tracking extensions
66 endef
67
68 define Package/iptables-mod-conntrack/description
69 Basic iptables extensions for connection tracking.
70 Includes:
71 - state
72 - raw
73 - NOTRACK
74 endef
75
76 define Package/iptables-mod-conntrack-extra
77 $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
78 TITLE:=Extra connection tracking extensions
79 endef
80
81 define Package/iptables-mod-conntrack-extra/description
82 Extra iptables extensions for connection tracking.
83 Includes:
84 - libipt_conntrack
85 - libipt_helper
86 - libipt_connmark/CONNMARK
87 endef
88
89 define Package/iptables-mod-filter
90 $(call Package/iptables/Module, +kmod-ipt-filter)
91 TITLE:=Content inspection extensions
92 endef
93
94 define Package/iptables-mod-filter/description
95 iptables extensions for packet content inspection.
96 Includes:
97 - libipt_string
98 - libipt_layer7
99 endef
100
101 define Package/iptables-mod-imq
102 $(call Package/iptables/Module, +kmod-ipt-imq)
103 TITLE:=IMQ support
104 endef
105
106 define Package/iptables-mod-imq/description
107 iptables extension for IMQ support.
108 Includes:
109 - libipt_IMQ
110 endef
111
112 define Package/iptables-mod-ipopt
113 $(call Package/iptables/Module, +kmod-ipt-ipopt)
114 TITLE:=IP/Packet option extensions
115 endef
116
117 define Package/iptables-mod-ipopt/description
118 iptables extensions for matching/changing IP packet options.
119 Includes:
120 - libipt_CLASSIFY
121 - libipt_dscp/DSCP
122 - libipt_ecn/ECN
123 - libipt_length
124 - libipt_mac
125 - libipt_mark/MARK
126 - libipt_statistic
127 - libipt_tcpmms
128 - libipt_tos/TOS
129 - libipt_ttl/TTL
130 - libipt_unclean
131 endef
132
133 define Package/iptables-mod-ipsec
134 $(call Package/iptables/Module, +kmod-ipt-ipsec)
135 TITLE:=IPsec extensions
136 endef
137
138 define Package/iptables-mod-ipsec/description
139 iptables extensions for matching ipsec traffic.
140 Includes:
141 - libipt_ah
142 - libipt_esp
143 - libipt_policy
144 endef
145
146 define Package/iptables-mod-ipset
147 $(call Package/iptables/Module,)
148 TITLE:=IPset iptables extensions
149 endef
150
151 define Package/iptables-mod-ipset/description
152 IPset iptables extensions.
153 Includes:
154 - libipt_set
155 - libipt_SET
156 endef
157
158 define Package/iptables-mod-nat
159 $(call Package/iptables/Module, +kmod-ipt-nat)
160 TITLE:=Basic NAT extensions
161 endef
162
163 define Package/iptables-mod-nat/description
164 iptables extensions for basic NAT targets.
165 Includes:
166 - MASQUERADE
167 - SNAT
168 - DNAT
169 endef
170
171 define Package/iptables-mod-nat-extra
172 $(call Package/iptables/Module, +kmod-ipt-nat-extra)
173 TITLE:=Extra NAT extensions
174 endef
175
176 define Package/iptables-mod-nat-extra/description
177 iptables extensions for extra NAT targets.
178 Includes:
179 - REDIRECT
180 endef
181
182 define Package/iptables-mod-ulog
183 $(call Package/iptables/Module, +kmod-ipt-ulog)
184 TITLE:=user-space packet logging
185 endef
186
187 define Package/iptables-mod-ulog/description
188 iptables extensions for user-space packet logging.
189 Includes:
190 - libipt_ULOG
191 endef
192
193 define Package/iptables-mod-hashlimit
194 $(call Package/iptables/Module, +kmod-ipt-hashlimit)
195 TITLE:=hashlimit matching
196 endef
197
198 define Package/iptables-mod-hashlimit/description
199 iptables extensions for hashlimit matching
200 Includes:
201 - libipt_hashlimit
202 endef
203
204 define Package/iptables-mod-iprange
205 $(call Package/iptables/Module, +kmod-ipt-iprange)
206 TITLE:=IP range extension
207 endef
208
209 define Package/iptables-mod-iprange/description
210 iptables extensions for matching ip ranges.
211 Includes:
212 - libipt_iprange
213 endef
214
215 define Package/iptables-mod-extra
216 $(call Package/iptables/Module, +kmod-ipt-extra)
217 TITLE:=Other extra iptables extensions
218 endef
219
220 define Package/iptables-mod-extra/description
221 Other extra iptables extensions.
222 Includes:
223 - libipt_owner
224 - libipt_physdev
225 - libipt_pkttype
226 - libipt_recent
227 endef
228
229 define Package/iptables-mod-tproxy
230 $(call Package/iptables/Module, +kmod-ipt-tproxy)
231 TITLE:=Transparent proxy iptables extensions
232 endef
233
234 define Package/iptables-mod-tproxy/description
235 Transparent proxy iptables extensions.
236 Includes:
237 - libxt_socket
238 - libxt_TPROXY
239 endef
240
241
242 define Package/iptables-utils
243 $(call Package/iptables/Module, )
244 TITLE:=iptables save and restore utilities
245 endef
246
247 define Package/ip6tables
248 $(call Package/iptables/Default)
249 DEPENDS:=+kmod-ip6tables +libiptc +libxtables
250 CATEGORY:=IPv6
251 TITLE:=IPv6 firewall administration tool
252 MENU:=1
253 endef
254
255 define Package/ip6tables-utils
256 $(call Package/iptables/Default)
257 DEPENDS:=ip6tables
258 CATEGORY:=IPv6
259 TITLE:=ip6tables save and restore utilities
260 endef
261
262 define Package/libiptc
263 $(call Package/iptables/Default)
264 SECTION:=libs
265 CATEGORY:=Libraries
266 TITLE:=IPv4/IPv6 firewall - shared libiptc library
267 endef
268
269 define Package/libxtables
270 $(call Package/iptables/Default)
271 SECTION:=libs
272 CATEGORY:=Libraries
273 TITLE:=IPv4/IPv6 firewall - shared xtables library
274 endef
275
276 define Package/libipq
277 $(call Package/iptables/Default)
278 SECTION:=libs
279 CATEGORY:=Libraries
280 TITLE:=IPv4/IPv6 firewall - shared libipq library
281 endef
282
283 TARGET_CPPFLAGS := \
284 -I$(PKG_BUILD_DIR)/include \
285 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include \
286 $(TARGET_CPPFLAGS)
287
288 TARGET_CFLAGS += \
289 -I$(PKG_BUILD_DIR)/include \
290 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include
291
292 CONFIGURE_ARGS += \
293 --enable-shared \
294 --enable-devel \
295 --enable-ipv6 \
296 --enable-libipq \
297 --with-kernel="$(LINUX_DIR)" \
298 --with-xtlibdir=/usr/lib/iptables
299
300 MAKE_FLAGS := \
301 $(TARGET_CONFIGURE_OPTS) \
302 COPT_FLAGS="$(TARGET_CFLAGS)" \
303 LDFLAGS="-rdynamic -static-libgcc" \
304 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
305 KBUILD_OUTPUT="$(LINUX_DIR)" \
306
307 define Build/Prepare
308 $(call Build/Prepare/Default)
309 (cd $(PKG_BUILD_DIR); ./autogen.sh)
310 endef
311
312 define Build/InstallDev
313 $(INSTALL_DIR) $(1)/usr/include
314 $(INSTALL_DIR) $(1)/usr/include/iptables
315 $(INSTALL_DIR) $(1)/usr/include/net/netfilter
316
317 # XXX: iptables header fixup, some headers are not installed by iptables anymore
318 $(CP) $(PKG_BUILD_DIR)/include/net/netfilter/*.h $(1)/usr/include/net/netfilter/
319 $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
320 $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
321 $(CP) $(PKG_BUILD_DIR)/include/libipq/libipq.h $(1)/usr/include/
322 $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
323 $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
324
325 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
326 $(INSTALL_DIR) $(1)/usr/lib
327 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.{a,so*} $(1)/usr/lib/
328 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.{a,so*} $(1)/usr/lib/
329 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.{a,so*} $(1)/usr/lib/
330 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
331 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
332 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libiptc.pc $(1)/usr/lib/pkgconfig/
333 endef
334
335 define Package/iptables/install
336 $(INSTALL_DIR) $(1)/usr/sbin
337 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
338 $(INSTALL_DIR) $(1)/usr/lib/iptables
339 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
340 for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
341 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
342 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
343 fi; \
344 done \
345 )
346 endef
347
348 define Package/iptables-utils/install
349 $(INSTALL_DIR) $(1)/usr/sbin
350 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
351 endef
352
353 define Package/ip6tables/install
354 $(INSTALL_DIR) $(1)/usr/sbin
355 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
356 endef
357
358 define Package/ip6tables-utils/install
359 $(INSTALL_DIR) $(1)/usr/sbin
360 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-{save,restore} $(1)/usr/sbin/
361 endef
362
363 define Package/libiptc/install
364 $(INSTALL_DIR) $(1)/usr/lib
365 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
366 endef
367
368 define Package/libxtables/install
369 $(INSTALL_DIR) $(1)/usr/lib
370 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
371 endef
372
373 define Package/libipq/install
374 $(INSTALL_DIR) $(1)/usr/lib
375 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
376 endef
377
378 define BuildPlugin
379 define Package/$(1)/install
380 $(INSTALL_DIR) $$(1)/usr/lib/iptables
381 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
382 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
383 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
384 fi; \
385 done
386 $(3)
387 endef
388
389 $$(eval $$(call BuildPackage,$(1)))
390 endef
391
392 L7_INSTALL:=\
393 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
394 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
395
396
397 $(eval $(call BuildPackage,iptables))
398 $(eval $(call BuildPackage,iptables-utils))
399 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
400 $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
401 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
402 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
403 $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
404 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
405 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
406 $(eval $(call BuildPlugin,iptables-mod-ipset,ipt_set ipt_SET))
407 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
408 $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
409 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
410 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
411 $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
412 $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
413 $(eval $(call BuildPackage,ip6tables))
414 $(eval $(call BuildPackage,ip6tables-utils))
415 $(eval $(call BuildPackage,libiptc))
416 $(eval $(call BuildPackage,libxtables))
417 $(eval $(call BuildPackage,libipq))