2 # Copyright (C) 2006-2008 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
14 ifeq ($(CONFIG_LINUX_2_4),y)
17 PKG_MD5SUM:=0a9209f928002e5eee9cdff8fef4d4b3
20 ifeq ($(CONFIG_LINUX_2_6),y)
23 PKG_MD5SUM:=90cfa8a554a29b0b859a625e701af2a7
26 PKG_VERSION?=<IPTABLES_VERSION>
28 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
29 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
30 ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
31 ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
32 ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
34 PATCH_DIR:=./patches/$(PKG_VERSION)
36 include $(INCLUDE_DIR)/package.mk
38 -include $(LINUX_DIR)/.config
39 include $(INCLUDE_DIR)/netfilter.mk
40 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
43 define Package/iptables/Default
46 URL:=http://netfilter.org/
49 define Package/iptables/Module
50 $(call Package/iptables/Default)
51 DEPENDS:=iptables $(1)
54 define Package/iptables
55 $(call Package/iptables/Default)
56 TITLE:=IPv4 firewall administration tool
60 define Package/iptables/conffiles
65 define Package/iptables-mod-conntrack
66 $(call Package/iptables/Module, +kmod-ipt-conntrack)
67 TITLE:=connection tracking modules
70 define Package/iptables-mod-conntrack/description
71 iptables extensions for connection tracking.
75 - libipt_connmark/CONNMARK
78 define Package/iptables-mod-filter
79 $(call Package/iptables/Module, +kmod-ipt-filter)
83 define Package/iptables-mod-filter/description
84 iptables extensions for packet content inspection.
90 define Package/iptables-mod-imq
91 $(call Package/iptables/Module, +kmod-ipt-imq @!LINUX_2_6_25)
95 define Package/iptables-mod-imq/description
96 iptables extension for IMQ support.
101 define Package/iptables-mod-ipopt
102 $(call Package/iptables/Module, +kmod-ipt-ipopt)
103 TITLE:=IP/Packet option modules
106 define Package/iptables-mod-ipopt/description
107 iptables extensions for matching/changing IP packet options.\\\
122 define Package/iptables-mod-ipsec
123 $(call Package/iptables/Module, +kmod-ipt-ipsec)
124 TITLE:=IPSec extensions
127 define Package/iptables-mod-ipsec/description
128 iptables extensions for matching ipsec traffic.
135 define Package/iptables-mod-nat
136 $(call Package/iptables/Module, +kmod-ipt-nat)
137 TITLE:=extra NAT targets
140 define Package/iptables-mod-nat/description
141 iptables extensions for different NAT targets.
146 define Package/iptables-mod-ulog
147 $(call Package/iptables/Module, +kmod-ipt-ulog)
148 TITLE:=user-space packet logging
151 define Package/iptables-mod-ulog/description
152 iptables extensions for user-space packet logging.
157 define Package/iptables-mod-iprange
158 $(call Package/iptables/Module, +kmod-ipt-iprange)
159 TITLE:=ip range module
162 define Package/iptables-mod-iprange/description
163 iptables extensions for matching ip ranges.
168 define Package/iptables-mod-extra
169 $(call Package/iptables/Module, +kmod-ipt-extra)
170 TITLE:=other extra iptables extensions
173 define Package/iptables-mod-extra/description
174 other extra iptables extensions.
188 define Package/iptables-mod-ipset
189 $(call Package/iptables/Module, +kmod-ipt-ipset)
190 TITLE:=ipset iptables extension
193 define Package/iptables-utils
194 $(call Package/iptables/Module, )
195 TITLE:=iptables save and restore utilities
198 define Package/ip6tables
199 $(call Package/iptables/Default)
200 DEPENDS:=+kmod-ip6tables
202 TITLE:=IPv6 firewall administration tool
206 define Package/ip6tables-utils
207 $(call Package/iptables/Default)
210 TITLE:=ip6tables save and restore utilities
214 $(call Build/Prepare/Default)
217 define Build/Configure
218 chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
219 rm -f $(PKG_BUILD_DIR)/.configured*
220 $(MAKE) -C $(PKG_BUILD_DIR) \
225 mkdir -p $(PKG_INSTALL_DIR)
226 $(MAKE) -C $(PKG_BUILD_DIR) \
227 $(TARGET_CONFIGURE_OPTS) \
228 COPT_FLAGS="$(TARGET_CFLAGS)" \
229 LDFLAGS="-rdynamic -static-libgcc" \
230 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
231 KBUILD_OUTPUT="$(LINUX_DIR)" \
232 DESTDIR="$(PKG_INSTALL_DIR)" \
233 all experimental install install-experimental
236 define Build/InstallDev
237 $(MAKE) -C $(PKG_BUILD_DIR) \
238 $(TARGET_CONFIGURE_OPTS) \
239 COPT_FLAGS="$(TARGET_CFLAGS)" \
240 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
241 KBUILD_OUTPUT="$(LINUX_DIR)" \
244 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr
245 $(CP) $(PKG_BUILD_DIR)/libiptc/libiptc.a $(1)/usr/lib
248 define Package/iptables/install
249 $(INSTALL_DIR) $(1)/etc/config
250 $(INSTALL_DATA) ./files/firewall.config $(1)/etc/
251 $(INSTALL_DIR) $(1)/etc/init.d
252 $(INSTALL_BIN) ./files/firewall.init $(1)/etc/init.d/firewall
253 $(INSTALL_BIN) ./files/firewall.user $(1)/etc/
254 $(INSTALL_DIR) $(1)/usr/lib
255 $(INSTALL_DATA) ./files/firewall.awk $(1)/usr/lib
256 $(INSTALL_DIR) $(1)/usr/sbin
257 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
258 $(INSTALL_DIR) $(1)/usr/lib/iptables
259 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
260 for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
261 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
262 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
268 define Package/iptables-utils/install
269 $(INSTALL_DIR) $(1)/usr/sbin
270 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
273 define Package/ip6tables/install
274 $(INSTALL_DIR) $(1)/usr/sbin
275 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
276 $(INSTALL_DIR) $(1)/usr/lib/iptables
277 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
278 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
282 define Package/ip6tables-utils/install
283 $(INSTALL_DIR) $(1)/usr/sbin
284 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-{save,restore} $(1)/usr/sbin/
288 define Package/$(1)/install
289 $(INSTALL_DIR) $$(1)/usr/lib/iptables
290 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
291 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
292 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
298 $$(eval $$(call BuildPackage,$(1)))
302 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
303 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
305 $(eval $(call BuildPackage,iptables))
306 $(eval $(call BuildPackage,iptables-utils))
307 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
308 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
309 $(eval $(call BuildPlugin,iptables-mod-ipset,$(IPT_IPSET-m)))
310 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
311 $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
312 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
313 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
314 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
315 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
316 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
317 $(eval $(call BuildPackage,ip6tables))
318 $(eval $(call BuildPackage,ip6tables-utils))