2 # Copyright (C) 2006-2011 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
38 URL:=http://netfilter.org/
41 define Package/iptables/Module
42 $(call Package/iptables/Default)
43 DEPENDS:=iptables $(1)
46 define Package/iptables
47 $(call Package/iptables/Default)
48 TITLE:=IPv4 firewall administration tool
50 DEPENDS+= +kmod-ipt-core +libip4tc +libxtables
53 define Package/iptables/description
54 IPv4 firewall administration tool.
78 define Package/iptables-mod-conntrack
79 $(call Package/iptables/Module, +kmod-ipt-conntrack)
80 TITLE:=Basic connection tracking extensions
83 define Package/iptables-mod-conntrack/description
84 Basic iptables extensions for connection tracking.
98 define Package/iptables-mod-conntrack-extra
99 $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
100 TITLE:=Extra connection tracking extensions
103 define Package/iptables-mod-conntrack-extra/description
104 Extra iptables extensions for connection tracking.
117 define Package/iptables-mod-filter
118 $(call Package/iptables/Module, +kmod-ipt-filter)
119 TITLE:=Content inspection extensions
122 define Package/iptables-mod-filter/description
123 iptables extensions for packet content inspection.
124 Includes support for:
132 define Package/iptables-mod-ipopt
133 $(call Package/iptables/Module, +kmod-ipt-ipopt)
134 TITLE:=IP/Packet option extensions
137 define Package/iptables-mod-ipopt/description
138 iptables extensions for matching/changing IP packet options.
161 define Package/iptables-mod-ipsec
162 $(call Package/iptables/Module, +kmod-ipt-ipsec)
163 TITLE:=IPsec extensions
166 define Package/iptables-mod-ipsec/description
167 iptables extensions for matching ipsec traffic.
176 define Package/iptables-mod-ipset
177 $(call Package/iptables/Module,)
178 TITLE:=IPset iptables extensions
181 define Package/iptables-mod-ipset/description
182 IPset iptables extensions.
192 define Package/iptables-mod-nat
193 $(call Package/iptables/Module, +kmod-ipt-nat)
194 TITLE:=Basic NAT extensions
197 define Package/iptables-mod-nat/description
198 iptables extensions for basic NAT targets.
210 define Package/iptables-mod-nat-extra
211 $(call Package/iptables/Module, +kmod-ipt-nat-extra)
212 TITLE:=Extra NAT extensions
215 define Package/iptables-mod-nat-extra/description
216 iptables extensions for extra NAT targets.
224 define Package/iptables-mod-ulog
225 $(call Package/iptables/Module, +kmod-ipt-ulog)
226 TITLE:=user-space packet logging
229 define Package/iptables-mod-ulog/description
230 iptables extensions for user-space packet logging.
237 define Package/iptables-mod-hashlimit
238 $(call Package/iptables/Module, +kmod-ipt-hashlimit)
239 TITLE:=hashlimit matching
242 define Package/iptables-mod-hashlimit/description
243 iptables extensions for hashlimit matching
250 define Package/iptables-mod-iprange
251 $(call Package/iptables/Module, +kmod-ipt-iprange)
252 TITLE:=IP range extension
255 define Package/iptables-mod-iprange/description
256 iptables extensions for matching ip ranges.
263 define Package/iptables-mod-extra
264 $(call Package/iptables/Module, +kmod-ipt-extra)
265 TITLE:=Other extra iptables extensions
268 define Package/iptables-mod-extra/description
269 Other extra iptables extensions.
274 - physdev (if ebtables is enabled)
280 define Package/iptables-mod-led
281 $(call Package/iptables/Module, +kmod-ipt-led)
282 TITLE:=LED trigger iptables extension
285 define Package/iptables-mod-led/description
286 iptables extension for triggering a LED.
293 define Package/iptables-mod-tproxy
294 $(call Package/iptables/Module, +kmod-ipt-tproxy)
295 TITLE:=Transparent proxy iptables extensions
298 define Package/iptables-mod-tproxy/description
299 Transparent proxy iptables extensions.
309 define Package/iptables-mod-tee
310 $(call Package/iptables/Module, +kmod-ipt-tee)
311 TITLE:=TEE iptables extensions
314 define Package/iptables-mod-tee/description
315 TEE iptables extensions.
322 define Package/iptables-mod-u32
323 $(call Package/iptables/Module, +kmod-ipt-u32)
324 TITLE:=U32 iptables extensions
327 define Package/iptables-mod-u32/description
328 U32 iptables extensions.
335 define Package/ip6tables
336 $(call Package/iptables/Default)
337 DEPENDS:=+kmod-ip6tables +libip6tc +libxtables
339 TITLE:=IPv6 firewall administration tool
343 define Package/libiptc
344 $(call Package/iptables/Default)
347 DEPENDS:=+libip4tc +libip6tc
348 TITLE:=IPv4/IPv6 firewall - shared libiptc library (compatibility stub)
351 define Package/libip4tc
352 $(call Package/iptables/Default)
355 TITLE:=IPv4 firewall - shared libiptc library
358 define Package/libip6tc
359 $(call Package/iptables/Default)
362 TITLE:=IPv6 firewall - shared libiptc library
365 define Package/libxtables
366 $(call Package/iptables/Default)
369 TITLE:=IPv4/IPv6 firewall - shared xtables library
372 define Package/libipq
373 $(call Package/iptables/Default)
376 TITLE:=IPv4/IPv6 firewall - shared libipq library
380 -I$(PKG_BUILD_DIR)/include \
381 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include \
385 -I$(PKG_BUILD_DIR)/include \
386 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include
393 --with-kernel="$(LINUX_DIR)" \
394 --with-xtlibdir=/usr/lib/iptables
397 $(TARGET_CONFIGURE_OPTS) \
398 COPT_FLAGS="$(TARGET_CFLAGS)" \
399 LDFLAGS="-rdynamic" \
400 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
401 KBUILD_OUTPUT="$(LINUX_DIR)" \
403 define Build/InstallDev
404 $(INSTALL_DIR) $(1)/usr/include
405 $(INSTALL_DIR) $(1)/usr/include/iptables
406 $(INSTALL_DIR) $(1)/usr/include/net/netfilter
408 # XXX: iptables header fixup, some headers are not installed by iptables anymore
409 $(CP) $(PKG_BUILD_DIR)/include/net/netfilter/*.h $(1)/usr/include/net/netfilter/
410 $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
411 $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
412 $(CP) $(PKG_BUILD_DIR)/include/libipq/libipq.h $(1)/usr/include/
413 $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
414 $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
416 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
417 $(INSTALL_DIR) $(1)/usr/lib
418 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
419 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
420 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
421 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
422 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
423 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libiptc.pc $(1)/usr/lib/pkgconfig/
426 define Package/iptables/install
427 $(INSTALL_DIR) $(1)/usr/sbin
428 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
429 $(LN) iptables $(1)/usr/sbin/iptables-save
430 $(LN) iptables $(1)/usr/sbin/iptables-restore
431 $(INSTALL_DIR) $(1)/usr/lib/iptables
432 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
433 for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
434 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
435 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
441 define Package/ip6tables/install
442 $(INSTALL_DIR) $(1)/usr/sbin
443 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
444 $(LN) ip6tables $(1)/usr/sbin/ip6tables-save
445 $(LN) ip6tables $(1)/usr/sbin/ip6tables-restore
446 $(INSTALL_DIR) $(1)/usr/lib/iptables
447 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
448 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
452 define Package/libiptc/install
453 $(INSTALL_DIR) $(1)/usr/lib
454 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so* $(1)/usr/lib/
457 define Package/libip4tc/install
458 $(INSTALL_DIR) $(1)/usr/lib
459 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so* $(1)/usr/lib/
462 define Package/libip6tc/install
463 $(INSTALL_DIR) $(1)/usr/lib
464 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip6tc.so* $(1)/usr/lib/
467 define Package/libxtables/install
468 $(INSTALL_DIR) $(1)/usr/lib
469 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
472 define Package/libipq/install
473 $(INSTALL_DIR) $(1)/usr/lib
474 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
478 define Package/$(1)/install
479 $(INSTALL_DIR) $$(1)/usr/lib/iptables
480 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
481 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
482 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
488 $$(eval $$(call BuildPackage,$(1)))
492 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
493 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
496 $(eval $(call BuildPackage,iptables))
497 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
498 $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
499 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
500 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
501 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
502 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
503 $(eval $(call BuildPlugin,iptables-mod-ipset,ipt_set ipt_SET))
504 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
505 $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
506 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
507 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
508 $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
509 $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
510 $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
511 $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
512 $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
513 $(eval $(call BuildPackage,ip6tables))
514 $(eval $(call BuildPackage,libiptc))
515 $(eval $(call BuildPackage,libip4tc))
516 $(eval $(call BuildPackage,libip6tc))
517 $(eval $(call BuildPackage,libxtables))
518 $(eval $(call BuildPackage,libipq))