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
59 DEPENDS
+= +kmod-ipt-core
62 define Package
/iptables
/description
63 IPv4 firewall administration tool.
73 define Package
/iptables-mod-conntrack
74 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack
)
75 TITLE
:=Basic connection tracking extensions
78 define Package
/iptables-mod-conntrack
/description
79 Basic iptables extensions for connection tracking.
84 define Package
/iptables-mod-conntrack-extra
85 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
86 TITLE
:=Extra connection tracking extensions
89 define Package
/iptables-mod-conntrack-extra
/description
90 Extra iptables extensions for connection tracking.
94 - libipt_connmark
/CONNMARK
97 define Package
/iptables-mod-filter
98 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
99 TITLE
:=Content inspection extensions
102 define Package
/iptables-mod-filter
/description
103 iptables extensions for packet content inspection.
109 define Package
/iptables-mod-imq
110 $(call Package
/iptables
/Module
, +kmod-ipt-imq @
!LINUX_2_6_27
)
114 define Package
/iptables-mod-imq
/description
115 iptables extension for IMQ support.
120 define Package
/iptables-mod-ipopt
121 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
122 TITLE
:=IP
/Packet option extensions
125 define Package
/iptables-mod-ipopt
/description
126 iptables extensions for matching
/changing IP packet options.
141 define Package
/iptables-mod-ipsec
142 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
143 TITLE
:=IPsec extensions
146 define Package
/iptables-mod-ipsec
/description
147 iptables extensions for matching ipsec traffic.
154 define Package
/iptables-mod-nat
155 $(call Package
/iptables
/Module
, +kmod-ipt-nat
)
156 TITLE
:=Basic NAT extensions
159 define Package
/iptables-mod-nat
/description
160 iptables extensions for basic NAT targets.
167 define Package
/iptables-mod-nat-extra
168 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
169 TITLE
:=Extra NAT extensions
172 define Package
/iptables-mod-nat-extra
/description
173 iptables extensions for extra NAT targets.
178 define Package
/iptables-mod-ulog
179 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
180 TITLE
:=user-space packet logging
183 define Package
/iptables-mod-ulog
/description
184 iptables extensions for user-space packet logging.
189 define Package
/iptables-mod-iprange
190 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
191 TITLE
:=IP range extension
194 define Package
/iptables-mod-iprange
/description
195 iptables extensions for matching ip ranges.
200 define Package
/iptables-mod-extra
201 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
202 TITLE
:=Other extra iptables extensions
205 define Package
/iptables-mod-extra
/description
206 other extra iptables extensions.
219 define Package
/iptables-mod-ipset
220 $(call Package
/iptables
/Module
, +kmod-ipt-ipset
)
221 TITLE
:=IPset extension
224 define Package
/iptables-utils
225 $(call Package
/iptables
/Module
, )
226 TITLE
:=iptables save and restore utilities
229 define Package
/ip6tables
230 $(call Package
/iptables
/Default
)
231 DEPENDS
:=+kmod-ip6tables
233 TITLE
:=IPv6 firewall administration tool
237 define Package
/ip6tables-utils
238 $(call Package
/iptables
/Default
)
241 TITLE
:=ip6tables save and restore utilities
245 $(call Build
/Prepare
/Default
)
248 define Build
/Configure
249 chmod a
+x
$(PKG_BUILD_DIR
)/extensions
/.
*-test*
250 rm -f
$(PKG_BUILD_DIR
)/.configured
*
251 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
255 TARGET_CFLAGS
+= $(FPIC
)
258 mkdir
-p
$(PKG_INSTALL_DIR
)
259 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
260 $(TARGET_CONFIGURE_OPTS
) \
261 COPT_FLAGS
="$(TARGET_CFLAGS)" \
262 LDFLAGS
="-rdynamic -static-libgcc" \
263 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
264 KBUILD_OUTPUT
="$(LINUX_DIR)" \
265 DESTDIR
="$(PKG_INSTALL_DIR)" \
266 all install $(MAKE_TARGETS
)
269 define Build
/InstallDev
270 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
271 $(TARGET_CONFIGURE_OPTS
) \
272 COPT_FLAGS
="$(TARGET_CFLAGS)" \
273 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
274 KBUILD_OUTPUT
="$(LINUX_DIR)" \
277 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
278 $(CP
) $(PKG_BUILD_DIR
)/libiptc
/libiptc.a
$(1)/usr
/lib
281 define Package
/iptables
/install
282 $(INSTALL_DIR
) $(1)/usr
/sbin
283 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
$(1)/usr
/sbin
/
284 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
285 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
286 for m in
$(patsubst xt_
%,ipt_
%,$(IPT_BUILTIN
)) $(patsubst ipt_
%,xt_
%,$(IPT_BUILTIN
)); do \
287 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
]; then \
288 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
$(1)/usr
/lib
/iptables
/ ;\
294 define Package
/iptables-utils
/install
295 $(INSTALL_DIR
) $(1)/usr
/sbin
296 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables-
{save
,restore
} $(1)/usr
/sbin
/
299 define Package
/ip6tables
/install
300 $(INSTALL_DIR
) $(1)/usr
/sbin
301 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
$(1)/usr
/sbin
/
302 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
303 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
304 $(CP
) libip6t_
*.so
$(1)/usr
/lib
/iptables
/ \
308 define Package
/ip6tables-utils
/install
309 $(INSTALL_DIR
) $(1)/usr
/sbin
310 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables-
{save
,restore
} $(1)/usr
/sbin
/
314 define Package
/$(1)/install
315 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
316 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)); do \
317 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
318 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
324 $$(eval
$$(call BuildPackage
,$(1)))
328 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
329 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
331 $(eval
$(call BuildPackage
,iptables
))
332 $(eval
$(call BuildPackage
,iptables-utils
))
333 $(eval
$(call BuildPlugin
,iptables-mod-conntrack
,$(IPT_CONNTRACK-m
)))
334 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
335 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
336 $(eval
$(call BuildPlugin
,iptables-mod-ipset
,$(IPT_IPSET-m
)))
337 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
338 $(eval
$(call BuildPlugin
,iptables-mod-imq
,$(IPT_IMQ-m
)))
339 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
340 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
341 $(eval
$(call BuildPlugin
,iptables-mod-nat
,$(IPT_NAT-m
)))
342 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
343 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
344 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
345 $(eval
$(call BuildPackage
,ip6tables
))
346 $(eval
$(call BuildPackage
,ip6tables-utils
))