2 # Copyright (C) 2006 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
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/
21 PKG_MD5SUM:=00fb916fa8040ca992a5ace56d905ea5
24 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
25 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
27 include $(INCLUDE_DIR)/package.mk
29 -include $(LINUX_DIR)/.config
30 include $(INCLUDE_DIR)/netfilter.mk
33 define Package/iptables/Default
36 URL:=http://netfilter.org/
39 define Package/iptables
40 $(call Package/iptables/Default)
41 TITLE:=IPv4 firewall administration tool
45 define Package/iptables/conffiles
50 define Package/iptables-mod-conntrack
51 $(call Package/iptables/Default)
52 DEPENDS:=iptables +kmod-ipt-conntrack
53 TITLE:=connection tracking modules
55 iptables extensions for connection tracking.\\\
58 - libipt_conntrack \\\
60 - libipt_connmark/CONNMARK
63 define Package/iptables-mod-filter
64 $(call Package/iptables/Default)
65 DEPENDS:=iptables +kmod-ipt-filter
68 iptables extensions for packet content inspection.\\\
75 define Package/iptables-mod-imq
76 $(call Package/iptables/Default)
77 DEPENDS:=iptables +kmod-ipt-imq
80 iptables extension for IMQ support.\\\
86 define Package/iptables-mod-ipopt
87 $(call Package/iptables/Default)
88 DEPENDS:=iptables +kmod-ipt-ipopt
89 TITLE:=IP/Packet option modules
91 iptables extensions for matching/changing IP packet options.\\\
95 - libipt_dscp/DSCP \\\
105 define Package/iptables-mod-ipsec
106 $(call Package/iptables/Default)
107 DEPENDS:=iptables +kmod-ipt-ipsec
108 TITLE:=IPSec extensions
110 iptables extensions for matching ipsec traffic.\\\
117 define Package/iptables-mod-nat
118 $(call Package/iptables/Default)
119 DEPENDS:=iptables +kmod-ipt-nat
120 TITLE:=extra NAT targets
122 iptables extensions for different NAT targets.\\\
128 define Package/iptables-mod-ulog
129 $(call Package/iptables/Default)
130 DEPENDS:=iptables +kmod-ipt-ulog
131 TITLE:=user-space packet logging
133 iptables extensions for user-space packet logging.\\\
139 define Package/iptables-mod-extra
140 $(call Package/iptables/Default)
141 DEPENDS:=iptables +kmod-ipt-extra
142 TITLE:=other extra iptables extensions
144 other extra iptables extensions.\\\
154 define Package/iptables-utils
155 $(call Package/iptables/Default)
157 TITLE:=iptables save and restore utilities
160 define Package/ip6tables
161 $(call Package/iptables/Default)
163 TITLE:=IPv6 firewall administration tool
166 define Build/Configure
170 chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
171 mkdir -p $(PKG_INSTALL_DIR)
172 $(MAKE) -C $(PKG_BUILD_DIR) \
173 $(TARGET_CONFIGURE_OPTS) \
174 COPT_FLAGS="$(TARGET_CFLAGS)" \
175 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
176 DESTDIR="$(PKG_INSTALL_DIR)" \
180 define Build/InstallDev
181 $(MAKE) -C $(PKG_BUILD_DIR) \
182 $(TARGET_CONFIGURE_OPTS) \
183 COPT_FLAGS="$(TARGET_CFLAGS)" \
184 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
185 DESTDIR="$(STAGING_DIR)" \
187 $(CP) $(PKG_BUILD_DIR)/include $(STAGING_DIR)/usr
188 $(CP) $(PKG_BUILD_DIR)/libiptc/libiptc.a $(STAGING_DIR)/usr/lib
191 define Build/UninstallDev
192 rm -rf $(STAGING_DIR)/usr/include/libipq.h
193 rm -rf $(STAGING_DIR)/usr/include/libipulog
194 rm -rf $(STAGING_DIR)/usr/include/libipq
195 rm -rf $(STAGING_DIR)/usr/include/libiptc
196 rm -rf $(STAGING_DIR)/usr/include/linux/netfilter*
197 rm -rf $(STAGING_DIR)/usr/include/iptables*
198 rm -rf $(STAGING_DIR)/usr/include/ip6tables*
199 rm -rf $(STAGING_DIR)/usr/lib/libipq.a
200 rm -rf $(STAGING_DIR)/usr/lib/libiptc.a
203 define Package/iptables/install
204 $(INSTALL_DIR) $(1)/etc/config
205 $(INSTALL_DATA) ./files/firewall.config $(1)/etc/config/firewall
206 $(INSTALL_DIR) $(1)/etc/init.d
207 $(INSTALL_BIN) ./files/firewall.init $(1)/etc/init.d/firewall
208 $(INSTALL_BIN) ./files/firewall.user $(1)/etc/
209 $(INSTALL_DIR) $(1)/usr/lib
210 $(INSTALL_DATA) ./files/firewall.awk $(1)/usr/lib
211 $(INSTALL_DIR) $(1)/usr/sbin
212 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
213 $(INSTALL_DIR) $(1)/usr/lib/iptables
214 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
215 $(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(1)/usr/lib/iptables/ \
219 define Package/iptables-utils/install
220 $(INSTALL_DIR) $(1)/usr/sbin
221 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
224 define Package/ip6tables/install
225 $(INSTALL_DIR) $(1)/usr/sbin
226 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
227 $(INSTALL_DIR) $(1)/usr/lib/iptables
228 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
229 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
234 define Package/$(1)/install
235 $(INSTALL_DIR) $$(1)/usr/lib/iptables
236 for m in $$(patsubst xt_%,ipt_%,$(2)); do \
237 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
242 $$(eval $$(call BuildPackage,$(1)))
246 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
247 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
249 $(eval $(call BuildPackage,iptables))
250 $(eval $(call BuildPackage,iptables-utils))
251 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
252 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
253 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
254 $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
255 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
256 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
257 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
258 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
259 $(eval $(call BuildPackage,ip6tables))