3 include $(TOPDIR)/rules.mk
8 PKG_MD5SUM:=00fb916fa8040ca992a5ace56d905ea5
10 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
11 ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
12 ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
13 ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
18 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
20 PKG_MENU:=IPv4 / IPv6 firewall administration
22 include $(TOPDIR)/package/rules.mk
24 include $(LINUX_DIR)/.config
25 include $(TOPDIR)/target/linux/netfilter.mk
28 define Package/iptables
31 TITLE:=IPv4 firewall administration tool
32 URL:=http://netfilter.org/
35 define Package/iptables-mod-conntrack
39 TITLE:=iptables extensions for connection tracking
40 DESCRIPTION:=Includes: \\\
41 * libipt_conntrack \\\
43 * libipt_connmark/CONNMARK
47 define Package/iptables-mod-filter
51 TITLE:=iptables extensions for packet content inspection
52 DESCRIPTION:=Includes: \\\
58 define Package/iptables-mod-imq
62 TITLE:=iptables extension for IMQ support
63 DESCRIPTION:=Includes: \\\
68 define Package/iptables-mod-ipopt
72 TITLE:=iptables extensions for matching/changing IP packet options
73 DESCRIPTION:=Includes: \\\
74 * libipt_dscp/DSCP \\\
85 define Package/iptables-mod-ipsec
89 TITLE:=iptables extensions for matching ipsec traffic
90 DESCRIPTION:=Includes: \\\
96 define Package/iptables-mod-nat
100 TITLE:=iptables extensions for different NAT targets
101 DESCRIPTION:=Includes: \\\
105 define Package/iptables-mod-ulog
107 CATEGORY:=Base system
109 TITLE:=iptables extensions for user-space packet logging
110 DESCRIPTION:=Includes: \\\
114 define Package/iptables-mod-extra
116 CATEGORY:=Base system
118 TITLE:=other extra iptables extensions
119 DESCRIPTION:=Includes: \\\
128 define Package/iptables-utils
130 CATEGORY:=Base system
132 TITLE:=iptables save and restore utilities
135 define Package/ip6tables
137 CATEGORY:=Base system
138 TITLE:=IPv6 firewall administration tool
142 define Build/Configure
146 chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
147 mkdir -p $(PKG_INSTALL_DIR)
148 $(MAKE) -C $(PKG_BUILD_DIR) \
149 $(TARGET_CONFIGURE_OPTS) \
150 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
151 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
152 DESTDIR="$(PKG_INSTALL_DIR)" \
153 all install install-devel
156 define Package/iptables/install
157 install -d -m0755 $(1)/etc/config
158 install -m0644 ./files/firewall.config $(1)/etc/config/firewall
159 install -d -m0755 $(1)/etc/init.d
160 install -m0755 ./files/firewall.init $(1)/etc/init.d/S45firewall
161 install -m0755 ./files/firewall.user $(1)/etc/
162 install -d -m0755 $(1)/usr/lib
163 install -m0644 ./files/firewall.awk $(1)/usr/lib
164 install -d -m0755 $(1)/usr/sbin
165 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
166 install -d -m0755 $(1)/usr/lib/iptables
167 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
168 $(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(1)/usr/lib/iptables/ \
173 define Package/iptables-utils/install
174 install -d -m0755 $(1)/usr/sbin
175 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
179 define Package/ip6tables/install
180 install -d -m0755 $(1)/usr/sbin
181 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
182 install -d -m0755 $(1)/usr/lib/iptables
183 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
184 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
189 $(eval $(call BuildPackage,iptables))
190 $(eval $(call BuildPackage,iptables-utils))
191 $(eval $(call BuildPackage,ip6tables))
194 define Package/$(1)/install
195 install -m0755 -d $$(1)/usr/lib/iptables
196 for m in $$(patsubst xt_%,ipt_%,$(2)); do \
197 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
203 $$(eval $$(call BuildPackage,$(1)))
206 L7_INSTALL:=mkdir -p $$(1)/etc/l7-protocols; \
207 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
209 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
210 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
211 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
212 $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
213 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
214 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
215 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
216 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
219 $(STAGING_DIR)/usr/lib/libipq.a: $(PKG_BUILD_DIR)/.built
220 mkdir -p $(STAGING_DIR)/usr/include
221 $(CP) $(PKG_INSTALL_DIR)/usr/include/libipq.h $(STAGING_DIR)/usr/include/
222 mkdir -p $(STAGING_DIR)/usr/lib
223 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.a $(STAGING_DIR)/usr/lib/
225 install-dev: $(STAGING_DIR)/usr/lib/libipq.a
227 rm -rf $(STAGING_DIR)/usr/include/libipq.h
228 rm -rf $(STAGING_DIR)/usr/lib/libipq.a
230 compile-targets: install-dev
231 clean-targets: uninstall-dev