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.
8 include $(TOPDIR
)/rules.mk
9 include $(INCLUDE_DIR
)/kernel.mk
15 PKG_MD5SUM
:=545698693b636cfc844aafc6729fd48a
17 PKG_VERSION?
=<IPTABLES_VERSION
>
19 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
20 PKG_SOURCE_URL
:=http
://www.netfilter.org
/projects
/iptables
/files \
21 ftp
://ftp.be.netfilter.org
/pub
/netfilter
/iptables
/ \
22 ftp
://ftp.de.netfilter.org
/pub
/netfilter
/iptables
/ \
23 ftp
://ftp.no.netfilter.org
/pub
/netfilter
/iptables
/
25 PATCH_DIR
:=.
/patches
/$(PKG_VERSION
)
27 include $(INCLUDE_DIR
)/package.mk
29 -include $(LINUX_DIR
)/.config
30 include $(INCLUDE_DIR
)/netfilter.mk
31 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell grep
'NETFILTER' $(LINUX_DIR
)/.config | md5s
)
35 define Package
/libiptc
38 URL
:=http
://netfilter.org
/
39 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
42 define Package
/libxtables
45 URL
:=http
://netfilter.org
/
46 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
50 define Package
/iptables
/Default
53 URL
:=http
://netfilter.org
/
54 DEPENDS
:=+libiptc
+libxtables
57 define Package
/iptables
/Module
58 $(call Package
/iptables
/Default
)
59 DEPENDS
:=iptables
$(1)
62 define Package
/iptables
63 $(call Package
/iptables
/Default
)
64 TITLE
:=IPv4 firewall administration tool
66 DEPENDS
+= +kmod-ipt-core
69 define Package
/iptables
/description
70 IPv4 firewall administration tool.
80 define Package
/iptables-mod-conntrack
81 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack
)
82 TITLE
:=Basic connection tracking extensions
85 define Package
/iptables-mod-conntrack
/description
86 Basic iptables extensions for connection tracking.
91 define Package
/iptables-mod-conntrack-extra
92 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
93 TITLE
:=Extra connection tracking extensions
96 define Package
/iptables-mod-conntrack-extra
/description
97 Extra iptables extensions for connection tracking.
101 - libipt_connmark
/CONNMARK
104 define Package
/iptables-mod-filter
105 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
106 TITLE
:=Content inspection extensions
109 define Package
/iptables-mod-filter
/description
110 iptables extensions for packet content inspection.
116 define Package
/iptables-mod-imq
117 $(call Package
/iptables
/Module
, +kmod-ipt-imq
)
121 define Package
/iptables-mod-imq
/description
122 iptables extension for IMQ support.
127 define Package
/iptables-mod-ipopt
128 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
129 TITLE
:=IP
/Packet option extensions
132 define Package
/iptables-mod-ipopt
/description
133 iptables extensions for matching
/changing IP packet options.
148 define Package
/iptables-mod-ipsec
149 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
150 TITLE
:=IPsec extensions
153 define Package
/iptables-mod-ipsec
/description
154 iptables extensions for matching ipsec traffic.
161 define Package
/iptables-mod-nat
162 $(call Package
/iptables
/Module
, +kmod-ipt-nat
)
163 TITLE
:=Basic NAT extensions
166 define Package
/iptables-mod-nat
/description
167 iptables extensions for basic NAT targets.
174 define Package
/iptables-mod-nat-extra
175 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
176 TITLE
:=Extra NAT extensions
179 define Package
/iptables-mod-nat-extra
/description
180 iptables extensions for extra NAT targets.
185 define Package
/iptables-mod-ulog
186 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
187 TITLE
:=user-space packet logging
190 define Package
/iptables-mod-ulog
/description
191 iptables extensions for user-space packet logging.
196 define Package
/iptables-mod-iprange
197 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
198 TITLE
:=IP range extension
201 define Package
/iptables-mod-iprange
/description
202 iptables extensions for matching ip ranges.
207 define Package
/iptables-mod-extra
208 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
209 TITLE
:=Other extra iptables extensions
212 define Package
/iptables-mod-extra
/description
213 other extra iptables extensions.
223 define Package
/iptables-mod-ipset
224 $(call Package
/iptables
/Module
, +kmod-ipt-ipset
)
225 TITLE
:=IPset extension
228 define Package
/iptables-utils
229 $(call Package
/iptables
/Module
, )
230 TITLE
:=iptables save and restore utilities
233 define Package
/ip6tables
234 $(call Package
/iptables
/Default
)
235 DEPENDS
:=+kmod-ip6tables
237 TITLE
:=IPv6 firewall administration tool
241 define Package
/ip6tables-utils
242 $(call Package
/iptables
/Default
)
245 TITLE
:=ip6tables save and restore utilities
249 $(call Build
/Prepare
/Default
)
252 TARGET_CPPFLAGS
:= -I
$(PKG_BUILD_DIR
)/include $(TARGET_CPPFLAGS
)
253 TARGET_CFLAGS
+= $(FPIC
)
256 --with-kernel
="$(LINUX_DIR)" \
257 --with-xtlibdir
=/usr
/lib
/iptables
260 mkdir
-p
$(PKG_INSTALL_DIR
)
261 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
262 $(TARGET_CONFIGURE_OPTS
) \
263 COPT_FLAGS
="$(TARGET_CFLAGS)" \
264 LDFLAGS
="-rdynamic -static-libgcc" \
265 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
266 KBUILD_OUTPUT
="$(LINUX_DIR)" \
267 DESTDIR
="$(PKG_INSTALL_DIR)" \
268 all install $(MAKE_TARGETS
)
271 define Build
/InstallDev
272 $(INSTALL_DIR
) $(1)/usr
/lib
273 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
276 define Package
/iptables
/install
277 $(INSTALL_DIR
) $(1)/usr
/sbin
278 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
$(1)/usr
/sbin
/
279 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
280 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
281 for m in
$(patsubst xt_
%,ipt_
%,$(IPT_BUILTIN
)) $(patsubst ipt_
%,xt_
%,$(IPT_BUILTIN
)); do \
282 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
]; then \
283 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
$(1)/usr
/lib
/iptables
/ ;\
290 define Package
/libiptc
/install
291 $(INSTALL_DIR
) $(1)/usr
/lib
292 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
.0 $(1)/usr
/lib
/
295 define Package
/libxtables
/install
296 $(INSTALL_DIR
) $(1)/usr
/lib
297 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
.2 $(1)/usr
/lib
/
301 define Package
/iptables-utils
/install
302 $(INSTALL_DIR
) $(1)/usr
/sbin
303 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables-
{save
,restore
} $(1)/usr
/sbin
/
306 define Package
/ip6tables
/install
307 $(INSTALL_DIR
) $(1)/usr
/sbin
308 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
$(1)/usr
/sbin
/
309 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
310 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
311 $(CP
) libip6t_
*.so
$(1)/usr
/lib
/iptables
/ \
315 define Package
/ip6tables-utils
/install
316 $(INSTALL_DIR
) $(1)/usr
/sbin
317 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables-
{save
,restore
} $(1)/usr
/sbin
/
321 define Package
/$(1)/install
322 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
323 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)); do \
324 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
325 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
331 $$(eval
$$(call BuildPackage
,$(1)))
335 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
336 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
339 $(eval
$(call BuildPackage
,libiptc
))
340 $(eval
$(call BuildPackage
,libxtables
))
342 $(eval
$(call BuildPackage
,iptables
))
343 $(eval
$(call BuildPackage
,iptables-utils
))
344 $(eval
$(call BuildPlugin
,iptables-mod-conntrack
,$(IPT_CONNTRACK-m
)))
345 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
346 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
347 $(eval
$(call BuildPlugin
,iptables-mod-ipset
,$(IPT_IPSET-m
)))
348 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
349 $(eval
$(call BuildPlugin
,iptables-mod-imq
,$(IPT_IMQ-m
)))
350 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
351 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
352 $(eval
$(call BuildPlugin
,iptables-mod-nat
,$(IPT_NAT-m
)))
353 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
354 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
355 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
356 $(eval
$(call BuildPackage
,ip6tables
))
357 $(eval
$(call BuildPackage
,ip6tables-utils
))