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