2 # Copyright (C) 2006-2013 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_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
26 ifneq ($(CONFIG_EXTERNAL_KERNEL_TREE),"")
30 include $(INCLUDE_DIR)/package.mk
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)
38 define Package/iptables/Default
42 URL:=http://netfilter.org/
45 define Package/iptables/Module
46 $(call Package/iptables/Default)
47 DEPENDS:=iptables $(1)
50 define Package/iptables
51 $(call Package/iptables/Default)
52 TITLE:=IP firewall administration tool
54 DEPENDS+= +kmod-ipt-core +libip4tc +IPV6:libip6tc +libxtables
57 define Package/iptables/description
58 IP firewall administration tool.
96 define Package/iptables-mod-conntrack-extra
97 $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
98 TITLE:=Extra connection tracking extensions
101 define Package/iptables-mod-conntrack-extra/description
102 Extra iptables extensions for connection tracking.
116 define Package/iptables-mod-filter
117 $(call Package/iptables/Module, +kmod-ipt-filter)
118 TITLE:=Content inspection extensions
121 define Package/iptables-mod-filter/description
122 iptables extensions for packet content inspection.
123 Includes support for:
131 define Package/iptables-mod-ipopt
132 $(call Package/iptables/Module, +kmod-ipt-ipopt)
133 TITLE:=IP/Packet option extensions
136 define Package/iptables-mod-ipopt/description
137 iptables extensions for matching/changing IP packet options.
156 define Package/iptables-mod-ipsec
157 $(call Package/iptables/Module, +kmod-ipt-ipsec)
158 TITLE:=IPsec extensions
161 define Package/iptables-mod-ipsec/description
162 iptables extensions for matching ipsec traffic.
171 define Package/iptables-mod-nat-extra
172 $(call Package/iptables/Module, +kmod-ipt-nat-extra)
173 TITLE:=Extra NAT extensions
176 define Package/iptables-mod-nat-extra/description
177 iptables extensions for extra NAT targets.
184 define Package/iptables-mod-ulog
185 $(call Package/iptables/Module, +kmod-ipt-ulog)
186 TITLE:=user-space packet logging
189 define Package/iptables-mod-ulog/description
190 iptables extensions for user-space packet logging.
197 define Package/iptables-mod-hashlimit
198 $(call Package/iptables/Module, +kmod-ipt-hashlimit)
199 TITLE:=hashlimit matching
202 define Package/iptables-mod-hashlimit/description
203 iptables extensions for hashlimit matching
210 define Package/iptables-mod-iprange
211 $(call Package/iptables/Module, +kmod-ipt-iprange)
212 TITLE:=IP range extension
215 define Package/iptables-mod-iprange/description
216 iptables extensions for matching ip ranges.
223 define Package/iptables-mod-extra
224 $(call Package/iptables/Module, +kmod-ipt-extra)
225 TITLE:=Other extra iptables extensions
228 define Package/iptables-mod-extra/description
229 Other extra iptables extensions.
235 - physdev (if ebtables is enabled)
241 define Package/iptables-mod-led
242 $(call Package/iptables/Module, +kmod-ipt-led)
243 TITLE:=LED trigger iptables extension
246 define Package/iptables-mod-led/description
247 iptables extension for triggering a LED.
254 define Package/iptables-mod-tproxy
255 $(call Package/iptables/Module, +kmod-ipt-tproxy)
256 TITLE:=Transparent proxy iptables extensions
259 define Package/iptables-mod-tproxy/description
260 Transparent proxy iptables extensions.
270 define Package/iptables-mod-tee
271 $(call Package/iptables/Module, +kmod-ipt-tee)
272 TITLE:=TEE iptables extensions
275 define Package/iptables-mod-tee/description
276 TEE iptables extensions.
283 define Package/iptables-mod-u32
284 $(call Package/iptables/Module, +kmod-ipt-u32)
285 TITLE:=U32 iptables extensions
288 define Package/iptables-mod-u32/description
289 U32 iptables extensions.
296 define Package/ip6tables
297 $(call Package/iptables/Default)
298 DEPENDS:=@IPV6 +kmod-ip6tables +iptables
300 TITLE:=IPv6 firewall administration tool
305 define Package/ip6tables-mod-nat
306 $(call Package/iptables/Default)
307 DEPENDS:=ip6tables +kmod-ipt-nat6
308 TITLE:=IPv6 NAT extensions
311 define Package/ip6tables-mod-nat/description
312 iptables extensions for IPv6-NAT targets.
315 define Package/libiptc
316 $(call Package/iptables/Default)
319 DEPENDS:=+libip4tc +IPV6:libip6tc
320 TITLE:=IPv4/IPv6 firewall - shared libiptc library (compatibility stub)
323 define Package/libip4tc
324 $(call Package/iptables/Default)
327 TITLE:=IPv4 firewall - shared libiptc library
330 define Package/libip6tc
331 $(call Package/iptables/Default)
334 TITLE:=IPv6 firewall - shared libiptc library
337 define Package/libxtables
338 $(call Package/iptables/Default)
341 TITLE:=IPv4/IPv6 firewall - shared xtables library
345 -I$(PKG_BUILD_DIR)/include \
346 -I$(LINUX_DIR)/user_headers/include \
350 -I$(PKG_BUILD_DIR)/include \
351 -I$(LINUX_DIR)/user_headers/include \
352 -ffunction-sections -fdata-sections
360 --with-kernel="$(LINUX_DIR)/user_headers" \
361 --with-xtlibdir=/usr/lib/iptables \
365 $(TARGET_CONFIGURE_OPTS) \
366 COPT_FLAGS="$(TARGET_CFLAGS)" \
367 KERNEL_DIR="$(LINUX_DIR)/user_headers/" PREFIX=/usr \
368 KBUILD_OUTPUT="$(LINUX_DIR)" \
369 BUILTIN_MODULES="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
371 define Build/InstallDev
372 $(INSTALL_DIR) $(1)/usr/include
373 $(INSTALL_DIR) $(1)/usr/include/iptables
374 $(INSTALL_DIR) $(1)/usr/include/net/netfilter
376 # XXX: iptables header fixup, some headers are not installed by iptables anymore
377 $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
378 $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
379 $(CP) $(PKG_BUILD_DIR)/include/ip6tables.h $(1)/usr/include/
380 $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
381 $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
383 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
384 $(INSTALL_DIR) $(1)/usr/lib
385 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
386 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
387 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
388 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
389 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libip*tc.pc $(1)/usr/lib/pkgconfig/
391 # XXX: needed by firewall3
392 $(INSTALL_DIR) $(1)/usr/lib/iptables
393 $(CP) $(PKG_BUILD_DIR)/extensions/libext*.a $(1)/usr/lib/iptables/
396 define Package/iptables/install
397 $(INSTALL_DIR) $(1)/usr/sbin
398 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-multi $(1)/usr/sbin/
399 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore,-save} $(1)/usr/sbin/
400 $(INSTALL_DIR) $(1)/usr/lib/iptables
403 define Package/ip6tables/install
404 $(INSTALL_DIR) $(1)/usr/sbin
405 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-restore,-save} $(1)/usr/sbin/
408 define Package/libiptc/install
409 $(INSTALL_DIR) $(1)/usr/lib
410 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so* $(1)/usr/lib/
413 define Package/libip4tc/install
414 $(INSTALL_DIR) $(1)/usr/lib
415 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so* $(1)/usr/lib/
418 define Package/libip6tc/install
419 $(INSTALL_DIR) $(1)/usr/lib
420 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip6tc.so* $(1)/usr/lib/
423 define Package/libxtables/install
424 $(INSTALL_DIR) $(1)/usr/lib
425 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
429 define Package/$(1)/install
430 $(INSTALL_DIR) $$(1)/usr/lib/iptables
431 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)) $(patsubst xt_%,ip6t_%,$(2)) $(patsubst ip6t_%,xt_%,$(2)); do \
432 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
433 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
439 $$(eval $$(call BuildPackage,$(1)))
443 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
444 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
447 $(eval $(call BuildPackage,iptables))
448 $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
449 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
450 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
451 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
452 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
453 $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
454 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
455 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
456 $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
457 $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
458 $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
459 $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
460 $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
461 $(eval $(call BuildPackage,ip6tables))
462 $(eval $(call BuildPlugin,ip6tables-mod-nat,$(IPT_NAT6-m)))
463 $(eval $(call BuildPackage,libiptc))
464 $(eval $(call BuildPackage,libip4tc))
465 $(eval $(call BuildPackage,libip6tc))
466 $(eval $(call BuildPackage,libxtables))