2 # Copyright (C) 2006-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
15 PKG_MD5SUM:=f382fe693f0b59d87bd47bea65eca198
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/
26 include $(INCLUDE_DIR)/package.mk
28 -include $(LINUX_DIR)/.config
29 include $(INCLUDE_DIR)/netfilter.mk
30 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
34 define Package/iptables/Default
37 URL:=http://netfilter.org/
40 define Package/iptables/Module
41 $(call Package/iptables/Default)
42 DEPENDS:=iptables $(1)
45 define Package/iptables
46 $(call Package/iptables/Default)
47 TITLE:=IPv4 firewall administration tool
49 DEPENDS+= +kmod-ipt-core +libiptc +libxtables
52 define Package/iptables/description
53 IPv4 firewall administration tool.
64 define Package/iptables-mod-conntrack
65 $(call Package/iptables/Module, +kmod-ipt-conntrack)
66 TITLE:=Basic connection tracking extensions
69 define Package/iptables-mod-conntrack/description
70 Basic iptables extensions for connection tracking.
77 define Package/iptables-mod-conntrack-extra
78 $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
79 TITLE:=Extra connection tracking extensions
82 define Package/iptables-mod-conntrack-extra/description
83 Extra iptables extensions for connection tracking.
87 - libipt_connmark/CONNMARK
90 define Package/iptables-mod-filter
91 $(call Package/iptables/Module, +kmod-ipt-filter)
92 TITLE:=Content inspection extensions
95 define Package/iptables-mod-filter/description
96 iptables extensions for packet content inspection.
102 define Package/iptables-mod-imq
103 $(call Package/iptables/Module, +kmod-ipt-imq)
107 define Package/iptables-mod-imq/description
108 iptables extension for IMQ support.
113 define Package/iptables-mod-ipopt
114 $(call Package/iptables/Module, +kmod-ipt-ipopt)
115 TITLE:=IP/Packet option extensions
118 define Package/iptables-mod-ipopt/description
119 iptables extensions for matching/changing IP packet options.
134 define Package/iptables-mod-ipsec
135 $(call Package/iptables/Module, +kmod-ipt-ipsec)
136 TITLE:=IPsec extensions
139 define Package/iptables-mod-ipsec/description
140 iptables extensions for matching ipsec traffic.
147 define Package/iptables-mod-ipset
148 $(call Package/iptables/Module,)
149 TITLE:=IPset iptables extensions
152 define Package/iptables-mod-ipset/description
153 IPset iptables extensions.
159 define Package/iptables-mod-nat
160 $(call Package/iptables/Module, +kmod-ipt-nat)
161 TITLE:=Basic NAT extensions
164 define Package/iptables-mod-nat/description
165 iptables extensions for basic NAT targets.
172 define Package/iptables-mod-nat-extra
173 $(call Package/iptables/Module, +kmod-ipt-nat-extra)
174 TITLE:=Extra NAT extensions
177 define Package/iptables-mod-nat-extra/description
178 iptables extensions for extra NAT targets.
183 define Package/iptables-mod-ulog
184 $(call Package/iptables/Module, +kmod-ipt-ulog)
185 TITLE:=user-space packet logging
188 define Package/iptables-mod-ulog/description
189 iptables extensions for user-space packet logging.
194 define Package/iptables-mod-hashlimit
195 $(call Package/iptables/Module, +kmod-ipt-hashlimit)
196 TITLE:=hashlimit matching
199 define Package/iptables-mod-hashlimit/description
200 iptables extensions for hashlimit matching
205 define Package/iptables-mod-iprange
206 $(call Package/iptables/Module, +kmod-ipt-iprange)
207 TITLE:=IP range extension
210 define Package/iptables-mod-iprange/description
211 iptables extensions for matching ip ranges.
216 define Package/iptables-mod-extra
217 $(call Package/iptables/Module, +kmod-ipt-extra)
218 TITLE:=Other extra iptables extensions
221 define Package/iptables-mod-extra/description
222 Other extra iptables extensions.
230 define Package/iptables-mod-tproxy
231 $(call Package/iptables/Module, +kmod-ipt-tproxy)
232 TITLE:=Transparent proxy iptables extensions
235 define Package/iptables-mod-tproxy/description
236 Transparent proxy iptables extensions.
243 define Package/iptables-utils
244 $(call Package/iptables/Module, )
245 TITLE:=iptables save and restore utilities
248 define Package/ip6tables
249 $(call Package/iptables/Default)
250 DEPENDS:=+kmod-ip6tables +libiptc +libxtables
252 TITLE:=IPv6 firewall administration tool
256 define Package/ip6tables-utils
257 $(call Package/iptables/Default)
260 TITLE:=ip6tables save and restore utilities
263 define Package/libiptc
264 $(call Package/iptables/Default)
267 TITLE:=IPv4/IPv6 firewall - shared libiptc library
270 define Package/libxtables
271 $(call Package/iptables/Default)
274 TITLE:=IPv4/IPv6 firewall - shared xtables library
277 define Package/libipq
278 $(call Package/iptables/Default)
281 TITLE:=IPv4/IPv6 firewall - shared libipq library
285 -I$(PKG_BUILD_DIR)/include \
286 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include \
290 -I$(PKG_BUILD_DIR)/include \
291 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include
298 --with-kernel="$(LINUX_DIR)" \
299 --with-xtlibdir=/usr/lib/iptables
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)" \
308 define Build/InstallDev
309 $(INSTALL_DIR) $(1)/usr/include
310 $(INSTALL_DIR) $(1)/usr/include/iptables
311 $(INSTALL_DIR) $(1)/usr/include/net/netfilter
313 # XXX: iptables header fixup, some headers are not installed by iptables anymore
314 $(CP) $(PKG_BUILD_DIR)/include/net/netfilter/*.h $(1)/usr/include/net/netfilter/
315 $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
316 $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
317 $(CP) $(PKG_BUILD_DIR)/include/libipq/libipq.h $(1)/usr/include/
318 $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
319 $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
321 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
322 $(INSTALL_DIR) $(1)/usr/lib
323 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
324 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
325 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
326 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
327 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
328 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libiptc.pc $(1)/usr/lib/pkgconfig/
331 define Package/iptables/install
332 $(INSTALL_DIR) $(1)/usr/sbin
333 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
334 $(INSTALL_DIR) $(1)/usr/lib/iptables
335 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
336 for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
337 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
338 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
344 define Package/iptables-utils/install
345 $(INSTALL_DIR) $(1)/usr/sbin
346 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
349 define Package/ip6tables/install
350 $(INSTALL_DIR) $(1)/usr/sbin
351 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
352 $(INSTALL_DIR) $(1)/usr/lib/iptables
353 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
354 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
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/
363 define Package/libiptc/install
364 $(INSTALL_DIR) $(1)/usr/lib
365 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
368 define Package/libxtables/install
369 $(INSTALL_DIR) $(1)/usr/lib
370 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
373 define Package/libipq/install
374 $(INSTALL_DIR) $(1)/usr/lib
375 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
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/ ; \
389 $$(eval $$(call BuildPackage,$(1)))
393 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
394 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
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))