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
18 MAKE_TARGETS
:=experimental install-experimental
21 ifeq ($(CONFIG_LINUX_2_6
),y
)
24 PKG_MD5SUM
:=90cfa8a554a29b0b859a625e701af2a7
27 PKG_VERSION?
=<IPTABLES_VERSION
>
29 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
30 PKG_SOURCE_URL
:=http
://www.netfilter.org
/projects
/iptables
/files \
31 ftp
://ftp.be.netfilter.org
/pub
/netfilter
/iptables
/ \
32 ftp
://ftp.de.netfilter.org
/pub
/netfilter
/iptables
/ \
33 ftp
://ftp.no.netfilter.org
/pub
/netfilter
/iptables
/
35 PATCH_DIR
:=.
/patches
/$(PKG_VERSION
)
37 include $(INCLUDE_DIR
)/package.mk
39 -include $(LINUX_DIR
)/.config
40 include $(INCLUDE_DIR
)/netfilter.mk
41 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell grep
'NETFILTER' $(LINUX_DIR
)/.config | md5s
)
44 define Package
/iptables
/Default
47 URL
:=http
://netfilter.org
/
50 define Package
/iptables
/Module
51 $(call Package
/iptables
/Default
)
52 DEPENDS
:=iptables
$(1)
55 define Package
/iptables
56 $(call Package
/iptables
/Default
)
57 TITLE
:=IPv4 firewall administration tool
61 define Package
/iptables
/conffiles
66 define Package
/iptables-mod-conntrack
67 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack
)
68 TITLE
:=connection tracking modules
71 define Package
/iptables-mod-conntrack
/description
72 iptables extensions for connection tracking.
76 - libipt_connmark
/CONNMARK
79 define Package
/iptables-mod-filter
80 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
84 define Package
/iptables-mod-filter
/description
85 iptables extensions for packet content inspection.
91 define Package
/iptables-mod-imq
92 $(call Package
/iptables
/Module
, +kmod-ipt-imq
)
96 define Package
/iptables-mod-imq
/description
97 iptables extension for IMQ support.
102 define Package
/iptables-mod-ipopt
103 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
104 TITLE
:=IP
/Packet option modules
107 define Package
/iptables-mod-ipopt
/description
108 iptables extensions for matching
/changing IP packet options.
\\\
123 define Package
/iptables-mod-ipsec
124 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
125 TITLE
:=IPSec extensions
128 define Package
/iptables-mod-ipsec
/description
129 iptables extensions for matching ipsec traffic.
136 define Package
/iptables-mod-nat
137 $(call Package
/iptables
/Module
, +kmod-ipt-nat
)
138 TITLE
:=extra NAT targets
141 define Package
/iptables-mod-nat
/description
142 iptables extensions for different NAT targets.
147 define Package
/iptables-mod-ulog
148 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
149 TITLE
:=user-space packet logging
152 define Package
/iptables-mod-ulog
/description
153 iptables extensions for user-space packet logging.
158 define Package
/iptables-mod-iprange
159 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
160 TITLE
:=ip range module
163 define Package
/iptables-mod-iprange
/description
164 iptables extensions for matching ip ranges.
169 define Package
/iptables-mod-extra
170 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
171 TITLE
:=other extra iptables extensions
174 define Package
/iptables-mod-extra
/description
175 other extra iptables extensions.
189 define Package
/iptables-mod-ipset
190 $(call Package
/iptables
/Module
, +kmod-ipt-ipset
)
191 TITLE
:=ipset iptables extension
194 define Package
/iptables-utils
195 $(call Package
/iptables
/Module
, )
196 TITLE
:=iptables save and restore utilities
199 define Package
/ip6tables
200 $(call Package
/iptables
/Default
)
201 DEPENDS
:=+kmod-ip6tables
203 TITLE
:=IPv6 firewall administration tool
207 define Package
/ip6tables-utils
208 $(call Package
/iptables
/Default
)
211 TITLE
:=ip6tables save and restore utilities
215 $(call Build
/Prepare
/Default
)
218 define Build
/Configure
219 chmod a
+x
$(PKG_BUILD_DIR
)/extensions
/.
*-test*
220 rm -f
$(PKG_BUILD_DIR
)/.configured
*
221 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
226 mkdir
-p
$(PKG_INSTALL_DIR
)
227 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
228 $(TARGET_CONFIGURE_OPTS
) \
229 COPT_FLAGS
="$(TARGET_CFLAGS)" \
230 LDFLAGS
="-rdynamic -static-libgcc" \
231 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
232 KBUILD_OUTPUT
="$(LINUX_DIR)" \
233 DESTDIR
="$(PKG_INSTALL_DIR)" \
234 all install $(MAKE_TARGETS
)
237 define Build
/InstallDev
238 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
239 $(TARGET_CONFIGURE_OPTS
) \
240 COPT_FLAGS
="$(TARGET_CFLAGS)" \
241 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
242 KBUILD_OUTPUT
="$(LINUX_DIR)" \
245 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
246 $(CP
) $(PKG_BUILD_DIR
)/libiptc
/libiptc.a
$(1)/usr
/lib
249 define Package
/iptables
/install
250 $(INSTALL_DIR
) $(1)/etc
/config
251 $(INSTALL_DATA
) .
/files
/firewall.config
$(1)/etc
/
252 $(INSTALL_DIR
) $(1)/etc
/init.d
253 $(INSTALL_BIN
) .
/files
/firewall.init
$(1)/etc
/init.d
/firewall
254 $(INSTALL_BIN
) .
/files
/firewall.user
$(1)/etc
/
255 $(INSTALL_DIR
) $(1)/usr
/lib
256 $(INSTALL_DATA
) .
/files
/firewall.awk
$(1)/usr
/lib
257 $(INSTALL_DIR
) $(1)/usr
/sbin
258 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
$(1)/usr
/sbin
/
259 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
260 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
261 for m in
$(patsubst xt_
%,ipt_
%,$(IPT_BUILTIN
)) $(patsubst ipt_
%,xt_
%,$(IPT_BUILTIN
)); do \
262 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
]; then \
263 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
$(1)/usr
/lib
/iptables
/ ;\
269 define Package
/iptables-utils
/install
270 $(INSTALL_DIR
) $(1)/usr
/sbin
271 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables-
{save
,restore
} $(1)/usr
/sbin
/
274 define Package
/ip6tables
/install
275 $(INSTALL_DIR
) $(1)/usr
/sbin
276 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
$(1)/usr
/sbin
/
277 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
278 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
279 $(CP
) libip6t_
*.so
$(1)/usr
/lib
/iptables
/ \
283 define Package
/ip6tables-utils
/install
284 $(INSTALL_DIR
) $(1)/usr
/sbin
285 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables-
{save
,restore
} $(1)/usr
/sbin
/
289 define Package
/$(1)/install
290 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
291 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)); do \
292 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
293 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
299 $$(eval
$$(call BuildPackage
,$(1)))
303 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
304 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
306 $(eval
$(call BuildPackage
,iptables
))
307 $(eval
$(call BuildPackage
,iptables-utils
))
308 $(eval
$(call BuildPlugin
,iptables-mod-conntrack
,$(IPT_CONNTRACK-m
)))
309 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
310 $(eval
$(call BuildPlugin
,iptables-mod-ipset
,$(IPT_IPSET-m
)))
311 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
312 $(eval
$(call BuildPlugin
,iptables-mod-imq
,$(IPT_IMQ-m
)))
313 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
314 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
315 $(eval
$(call BuildPlugin
,iptables-mod-nat
,$(IPT_NAT-m
)))
316 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
317 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
318 $(eval
$(call BuildPackage
,ip6tables
))
319 $(eval
$(call BuildPackage
,ip6tables-utils
))