2 # Copyright (C) 2006-2009 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
:=08cd9196881657ea0615d926334cb7e9
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
/
24 include $(INCLUDE_DIR
)/package.mk
26 -include $(LINUX_DIR
)/.config
27 include $(INCLUDE_DIR
)/netfilter.mk
28 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell grep
'NETFILTER' $(LINUX_DIR
)/.config | md5s
)
32 define Package
/iptables
/Default
35 URL
:=http
://netfilter.org
/
38 define Package
/iptables
/Module
39 $(call Package
/iptables
/Default
)
40 DEPENDS
:=iptables
$(1)
43 define Package
/iptables
44 $(call Package
/iptables
/Default
)
45 TITLE
:=IPv4 firewall administration tool
47 DEPENDS
+= +kmod-ipt-core
+libiptc
+libxtables
50 define Package
/iptables
/description
51 IPv4 firewall administration tool.
61 define Package
/iptables-mod-conntrack
62 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack
)
63 TITLE
:=Basic connection tracking extensions
66 define Package
/iptables-mod-conntrack
/description
67 Basic iptables extensions for connection tracking.
72 define Package
/iptables-mod-conntrack-extra
73 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
74 TITLE
:=Extra connection tracking extensions
77 define Package
/iptables-mod-conntrack-extra
/description
78 Extra iptables extensions for connection tracking.
82 - libipt_connmark
/CONNMARK
85 define Package
/iptables-mod-filter
86 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
87 TITLE
:=Content inspection extensions
90 define Package
/iptables-mod-filter
/description
91 iptables extensions for packet content inspection.
97 define Package
/iptables-mod-imq
98 $(call Package
/iptables
/Module
, +kmod-ipt-imq
)
102 define Package
/iptables-mod-imq
/description
103 iptables extension for IMQ support.
108 define Package
/iptables-mod-ipopt
109 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
110 TITLE
:=IP
/Packet option extensions
113 define Package
/iptables-mod-ipopt
/description
114 iptables extensions for matching
/changing IP packet options.
129 define Package
/iptables-mod-ipsec
130 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
131 TITLE
:=IPsec extensions
134 define Package
/iptables-mod-ipsec
/description
135 iptables extensions for matching ipsec traffic.
142 define Package
/iptables-mod-nat
143 $(call Package
/iptables
/Module
, +kmod-ipt-nat
)
144 TITLE
:=Basic NAT extensions
147 define Package
/iptables-mod-nat
/description
148 iptables extensions for basic NAT targets.
155 define Package
/iptables-mod-nat-extra
156 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
157 TITLE
:=Extra NAT extensions
160 define Package
/iptables-mod-nat-extra
/description
161 iptables extensions for extra NAT targets.
166 define Package
/iptables-mod-ulog
167 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
168 TITLE
:=user-space packet logging
171 define Package
/iptables-mod-ulog
/description
172 iptables extensions for user-space packet logging.
177 define Package
/iptables-mod-iprange
178 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
179 TITLE
:=IP range extension
182 define Package
/iptables-mod-iprange
/description
183 iptables extensions for matching ip ranges.
188 define Package
/iptables-mod-extra
189 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
190 TITLE
:=Other extra iptables extensions
193 define Package
/iptables-mod-extra
/description
194 other extra iptables extensions.
204 define Package
/iptables-utils
205 $(call Package
/iptables
/Module
, )
206 TITLE
:=iptables save and restore utilities
209 define Package
/ip6tables
210 $(call Package
/iptables
/Default
)
211 DEPENDS
:=+kmod-ip6tables
213 TITLE
:=IPv6 firewall administration tool
217 define Package
/ip6tables-utils
218 $(call Package
/iptables
/Default
)
221 TITLE
:=ip6tables save and restore utilities
224 define Package
/libiptc
225 $(call Package
/iptables
/Default
)
228 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
231 define Package
/libxtables
232 $(call Package
/iptables
/Default
)
235 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
240 -I
$(PKG_BUILD_DIR
)/include \
241 -I
$(LINUX_DIR
)/arch
/$(LINUX_KARCH
)/include \
249 --with-kernel
="$(LINUX_DIR)" \
250 --with-xtlibdir
=/usr
/lib
/iptables
252 IPTABLES_MAKEOPTS
= \
253 $(TARGET_CONFIGURE_OPTS
) \
254 COPT_FLAGS
="$(TARGET_CFLAGS)" \
255 LDFLAGS
="-rdynamic -static-libgcc" \
256 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
257 KBUILD_OUTPUT
="$(LINUX_DIR)" \
258 DESTDIR
="$(PKG_INSTALL_DIR)" \
259 all install $(MAKE_TARGETS
)
262 mkdir
-p
$(PKG_INSTALL_DIR
)
263 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(IPTABLES_MAKEOPTS
)
264 $(MAKE
) -C
$(PKG_BUILD_DIR
)/libipq
$(IPTABLES_MAKEOPTS
)
267 define Build
/InstallDev
268 mkdir
-p
$(1)/usr
/include
269 mkdir
-p
$(1)/usr
/include/iptables
270 mkdir
-p
$(1)/usr
/include/net
/netfilter
272 # XXX: iptables header fixup, some headers are not installed by iptables anymore
273 $(CP
) $(PKG_BUILD_DIR
)/include/net
/netfilter
/*.h
$(1)/usr
/include/net
/netfilter
/
274 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
275 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
276 $(CP
) $(PKG_BUILD_DIR
)/include/libipq
/libipq.h
$(1)/usr
/include/
277 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
278 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
280 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
281 mkdir
-p
$(1)/usr
/lib
282 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.
{a
,so
*} $(1)/usr
/lib
/
283 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.
{a
,so
*} $(1)/usr
/lib
/
284 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libipq.a
$(1)/usr
/lib
/
285 mkdir
-p
$(1)/usr
/lib
/pkgconfig
286 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
287 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libiptc.
pc $(1)/usr
/lib
/pkgconfig
/
290 define Package
/iptables
/install
291 $(INSTALL_DIR
) $(1)/usr
/sbin
292 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
$(1)/usr
/sbin
/
293 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
294 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
295 for m in
$(patsubst xt_
%,ipt_
%,$(IPT_BUILTIN
)) $(patsubst ipt_
%,xt_
%,$(IPT_BUILTIN
)); do \
296 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
]; then \
297 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
$(1)/usr
/lib
/iptables
/ ;\
303 define Package
/iptables-utils
/install
304 $(INSTALL_DIR
) $(1)/usr
/sbin
305 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables-
{save
,restore
} $(1)/usr
/sbin
/
308 define Package
/ip6tables
/install
309 $(INSTALL_DIR
) $(1)/usr
/sbin
310 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
$(1)/usr
/sbin
/
311 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
312 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
313 $(CP
) libip6t_
*.so
$(1)/usr
/lib
/iptables
/ \
317 define Package
/ip6tables-utils
/install
318 $(INSTALL_DIR
) $(1)/usr
/sbin
319 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables-
{save
,restore
} $(1)/usr
/sbin
/
322 define Package
/libiptc
/install
323 $(INSTALL_DIR
) $(1)/usr
/lib
324 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
327 define Package
/libxtables
/install
328 $(INSTALL_DIR
) $(1)/usr
/lib
329 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
333 define Package
/$(1)/install
334 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
335 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)); do \
336 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
337 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
343 $$(eval
$$(call BuildPackage
,$(1)))
347 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
348 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
351 $(eval
$(call BuildPackage
,iptables
))
352 $(eval
$(call BuildPackage
,iptables-utils
))
353 $(eval
$(call BuildPlugin
,iptables-mod-conntrack
,$(IPT_CONNTRACK-m
)))
354 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
355 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
356 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
357 $(eval
$(call BuildPlugin
,iptables-mod-imq
,$(IPT_IMQ-m
)))
358 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
359 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
360 $(eval
$(call BuildPlugin
,iptables-mod-nat
,$(IPT_NAT-m
)))
361 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
362 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
363 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
364 $(eval
$(call BuildPackage
,ip6tables
))
365 $(eval
$(call BuildPackage
,ip6tables-utils
))
366 $(eval
$(call BuildPackage
,libiptc
))
367 $(eval
$(call BuildPackage
,libxtables
))