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:=be97ce9007fa42c867901b496c935a0a
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.
115 define Package/iptables-mod-filter
116 $(call Package/iptables/Module, +kmod-ipt-filter)
117 TITLE:=Content inspection extensions
120 define Package/iptables-mod-filter/description
121 iptables extensions for packet content inspection.
122 Includes support for:
130 define Package/iptables-mod-ipopt
131 $(call Package/iptables/Module, +kmod-ipt-ipopt)
132 TITLE:=IP/Packet option extensions
135 define Package/iptables-mod-ipopt/description
136 iptables extensions for matching/changing IP packet options.
155 define Package/iptables-mod-ipsec
156 $(call Package/iptables/Module, +kmod-ipt-ipsec)
157 TITLE:=IPsec extensions
160 define Package/iptables-mod-ipsec/description
161 iptables extensions for matching ipsec traffic.
170 define Package/iptables-mod-nat-extra
171 $(call Package/iptables/Module, +kmod-ipt-nat-extra)
172 TITLE:=Extra NAT extensions
175 define Package/iptables-mod-nat-extra/description
176 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.
196 define Package/iptables-mod-hashlimit
197 $(call Package/iptables/Module, +kmod-ipt-hashlimit)
198 TITLE:=hashlimit matching
201 define Package/iptables-mod-hashlimit/description
202 iptables extensions for hashlimit matching
209 define Package/iptables-mod-iprange
210 $(call Package/iptables/Module, +kmod-ipt-iprange)
211 TITLE:=IP range extension
214 define Package/iptables-mod-iprange/description
215 iptables extensions for matching ip ranges.
222 define Package/iptables-mod-extra
223 $(call Package/iptables/Module, +kmod-ipt-extra)
224 TITLE:=Other extra iptables extensions
227 define Package/iptables-mod-extra/description
228 Other extra iptables extensions.
234 - physdev (if ebtables is enabled)
240 define Package/iptables-mod-led
241 $(call Package/iptables/Module, +kmod-ipt-led)
242 TITLE:=LED trigger iptables extension
245 define Package/iptables-mod-led/description
246 iptables extension for triggering a LED.
253 define Package/iptables-mod-tproxy
254 $(call Package/iptables/Module, +kmod-ipt-tproxy)
255 TITLE:=Transparent proxy iptables extensions
258 define Package/iptables-mod-tproxy/description
259 Transparent proxy iptables extensions.
269 define Package/iptables-mod-tee
270 $(call Package/iptables/Module, +kmod-ipt-tee)
271 TITLE:=TEE iptables extensions
274 define Package/iptables-mod-tee/description
275 TEE iptables extensions.
282 define Package/iptables-mod-u32
283 $(call Package/iptables/Module, +kmod-ipt-u32)
284 TITLE:=U32 iptables extensions
287 define Package/iptables-mod-u32/description
288 U32 iptables extensions.
295 define Package/ip6tables
296 $(call Package/iptables/Default)
297 DEPENDS:=@IPV6 +kmod-ip6tables +iptables
299 TITLE:=IPv6 firewall administration tool
303 define Package/libiptc
304 $(call Package/iptables/Default)
307 DEPENDS:=+libip4tc +libip6tc
308 TITLE:=IPv4/IPv6 firewall - shared libiptc library (compatibility stub)
311 define Package/libip4tc
312 $(call Package/iptables/Default)
315 TITLE:=IPv4 firewall - shared libiptc library
318 define Package/libip6tc
319 $(call Package/iptables/Default)
322 TITLE:=IPv6 firewall - shared libiptc library
325 define Package/libxtables
326 $(call Package/iptables/Default)
329 TITLE:=IPv4/IPv6 firewall - shared xtables library
333 -I$(PKG_BUILD_DIR)/include \
334 -I$(LINUX_DIR)/user_headers/include \
338 -I$(PKG_BUILD_DIR)/include \
339 -I$(LINUX_DIR)/user_headers/include \
340 -ffunction-sections -fdata-sections
348 --with-kernel="$(LINUX_DIR)/user_headers" \
349 --with-xtlibdir=/usr/lib/iptables \
353 $(TARGET_CONFIGURE_OPTS) \
354 COPT_FLAGS="$(TARGET_CFLAGS)" \
355 KERNEL_DIR="$(LINUX_DIR)/user_headers/" PREFIX=/usr \
356 KBUILD_OUTPUT="$(LINUX_DIR)" \
357 BUILTIN_MODULES="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
359 define Build/InstallDev
360 $(INSTALL_DIR) $(1)/usr/include
361 $(INSTALL_DIR) $(1)/usr/include/iptables
362 $(INSTALL_DIR) $(1)/usr/include/net/netfilter
364 # XXX: iptables header fixup, some headers are not installed by iptables anymore
365 $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
366 $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
367 $(CP) $(PKG_BUILD_DIR)/include/ip6tables.h $(1)/usr/include/
368 $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
369 $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
371 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
372 $(INSTALL_DIR) $(1)/usr/lib
373 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
374 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
375 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
376 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
377 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libip*tc.pc $(1)/usr/lib/pkgconfig/
380 define Package/iptables/install
381 $(INSTALL_DIR) $(1)/usr/sbin
382 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-multi $(1)/usr/sbin/
383 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore,-save} $(1)/usr/sbin/
384 $(INSTALL_DIR) $(1)/usr/lib/iptables
387 define Package/ip6tables/install
388 $(INSTALL_DIR) $(1)/usr/sbin
389 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-restore,-save} $(1)/usr/sbin/
392 define Package/libiptc/install
393 $(INSTALL_DIR) $(1)/usr/lib
394 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so* $(1)/usr/lib/
397 define Package/libip4tc/install
398 $(INSTALL_DIR) $(1)/usr/lib
399 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so* $(1)/usr/lib/
402 define Package/libip6tc/install
403 $(INSTALL_DIR) $(1)/usr/lib
404 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip6tc.so* $(1)/usr/lib/
407 define Package/libxtables/install
408 $(INSTALL_DIR) $(1)/usr/lib
409 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
413 define Package/$(1)/install
414 $(INSTALL_DIR) $$(1)/usr/lib/iptables
415 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)) $(patsubst xt_%,ip6t_%,$(2)) $(patsubst ip6t_%,xt_%,$(2)); do \
416 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
417 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
423 $$(eval $$(call BuildPackage,$(1)))
427 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
428 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
431 $(eval $(call BuildPackage,iptables))
432 $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
433 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
434 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
435 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
436 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
437 $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
438 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
439 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
440 $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
441 $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
442 $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
443 $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
444 $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
445 $(eval $(call BuildPackage,ip6tables))
446 $(eval $(call BuildPackage,libiptc))
447 $(eval $(call BuildPackage,libip4tc))
448 $(eval $(call BuildPackage,libip6tc))
449 $(eval $(call BuildPackage,libxtables))