2 # Copyright (C) 2006-2013 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_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
16 PKG_SOURCE_URL
:=http
://www.netfilter.org
/projects
/iptables
/files \
17 ftp
://ftp.be.netfilter.org
/pub
/netfilter
/iptables
/ \
18 ftp
://ftp.de.netfilter.org
/pub
/netfilter
/iptables
/ \
19 ftp
://ftp.no.netfilter.org
/pub
/netfilter
/iptables
/
20 PKG_MD5SUM
:=536d048c8e8eeebcd9757d0863ebb0c0
26 ifneq ($(CONFIG_EXTERNAL_KERNEL_TREE
),"")
30 include $(INCLUDE_DIR
)/package.mk
32 -include $(LINUX_DIR
)/.config
33 include $(INCLUDE_DIR
)/netfilter.mk
34 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell $(SH_FUNC
) grep
'NETFILTER' $(LINUX_DIR
)/.config | md5s
)
38 define Package
/iptables
/Default
42 URL
:=http
://netfilter.org
/
45 define Package
/iptables
/Module
46 $(call Package
/iptables
/Default
)
47 DEPENDS
:=iptables
$(1)
50 define Package
/iptables
51 $(call Package
/iptables
/Default
)
52 TITLE
:=IP firewall administration tool
54 DEPENDS
+= +kmod-ipt-core
+libip4tc
+IPV6
:libip6tc
+libxtables
57 define Package
/iptables
/description
58 IP firewall administration tool.
96 define Package
/iptables-mod-conntrack-extra
97 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
98 TITLE
:=Extra connection tracking extensions
101 define Package
/iptables-mod-conntrack-extra
/description
102 Extra iptables extensions for connection tracking.
115 define Package
/iptables-mod-filter
116 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
117 TITLE
:=Content inspection extensions
120 define Package
/iptables-mod-filter
/description
121 iptables extensions for packet content inspection.
122 Includes support for
:
130 define Package
/iptables-mod-ipopt
131 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
132 TITLE
:=IP
/Packet option extensions
135 define Package
/iptables-mod-ipopt
/description
136 iptables extensions for matching
/changing IP packet options.
155 define Package
/iptables-mod-ipsec
156 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
157 TITLE
:=IPsec extensions
160 define Package
/iptables-mod-ipsec
/description
161 iptables extensions for matching ipsec traffic.
170 define Package
/iptables-mod-nat-extra
171 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
172 TITLE
:=Extra NAT extensions
175 define Package
/iptables-mod-nat-extra
/description
176 iptables extensions for extra NAT targets.
183 define Package
/iptables-mod-ulog
184 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
185 TITLE
:=user-space packet logging
188 define Package
/iptables-mod-ulog
/description
189 iptables extensions for user-space packet logging.
196 define Package
/iptables-mod-hashlimit
197 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
198 TITLE
:=hashlimit matching
201 define Package
/iptables-mod-hashlimit
/description
202 iptables extensions for hashlimit matching
209 define Package
/iptables-mod-iprange
210 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
211 TITLE
:=IP range extension
214 define Package
/iptables-mod-iprange
/description
215 iptables extensions for matching ip ranges.
222 define Package
/iptables-mod-extra
223 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
224 TITLE
:=Other extra iptables extensions
227 define Package
/iptables-mod-extra
/description
228 Other extra iptables extensions.
234 - physdev
(if ebtables is enabled
)
240 define Package
/iptables-mod-led
241 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
242 TITLE
:=LED trigger iptables extension
245 define Package
/iptables-mod-led
/description
246 iptables extension for triggering a LED.
253 define Package
/iptables-mod-tproxy
254 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
255 TITLE
:=Transparent proxy iptables extensions
258 define Package
/iptables-mod-tproxy
/description
259 Transparent proxy iptables extensions.
269 define Package
/iptables-mod-tee
270 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
271 TITLE
:=TEE iptables extensions
274 define Package
/iptables-mod-tee
/description
275 TEE iptables extensions.
282 define Package
/iptables-mod-u32
283 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
284 TITLE
:=U32 iptables extensions
287 define Package
/iptables-mod-u32
/description
288 U32 iptables extensions.
295 define Package
/ip6tables
296 $(call Package
/iptables
/Default
)
297 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
299 TITLE
:=IPv6 firewall administration tool
304 define Package
/ip6tables-mod-nat
305 $(call Package
/iptables
/Default
)
306 DEPENDS
:=ip6tables
+kmod-ipt-nat6
307 TITLE
:=IPv6 NAT extensions
310 define Package
/ip6tables-mod-nat
/description
311 iptables extensions for IPv6-NAT targets.
314 define Package
/libiptc
315 $(call Package
/iptables
/Default
)
318 DEPENDS
:=+libip4tc
+libip6tc
319 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
322 define Package
/libip4tc
323 $(call Package
/iptables
/Default
)
326 TITLE
:=IPv4 firewall
- shared libiptc library
329 define Package
/libip6tc
330 $(call Package
/iptables
/Default
)
333 TITLE
:=IPv6 firewall
- shared libiptc library
336 define Package
/libxtables
337 $(call Package
/iptables
/Default
)
340 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
344 -I
$(PKG_BUILD_DIR
)/include \
345 -I
$(LINUX_DIR
)/user_headers
/include \
349 -I
$(PKG_BUILD_DIR
)/include \
350 -I
$(LINUX_DIR
)/user_headers
/include \
351 -ffunction-sections
-fdata-sections
359 --with-kernel
="$(LINUX_DIR)/user_headers" \
360 --with-xtlibdir
=/usr
/lib
/iptables \
364 $(TARGET_CONFIGURE_OPTS
) \
365 COPT_FLAGS
="$(TARGET_CFLAGS)" \
366 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
367 KBUILD_OUTPUT
="$(LINUX_DIR)" \
368 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
370 define Build
/InstallDev
371 $(INSTALL_DIR
) $(1)/usr
/include
372 $(INSTALL_DIR
) $(1)/usr
/include/iptables
373 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
375 # XXX: iptables header fixup, some headers are not installed by iptables anymore
376 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
377 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
378 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
379 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
380 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
382 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
383 $(INSTALL_DIR
) $(1)/usr
/lib
384 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
385 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
386 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
387 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
388 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
390 # XXX: needed by firewall3
391 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
392 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libext
*.a
$(1)/usr
/lib
/iptables
/
395 define Package
/iptables
/install
396 $(INSTALL_DIR
) $(1)/usr
/sbin
397 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
398 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
399 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
402 define Package
/ip6tables
/install
403 $(INSTALL_DIR
) $(1)/usr
/sbin
404 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
407 define Package
/libiptc
/install
408 $(INSTALL_DIR
) $(1)/usr
/lib
409 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
412 define Package
/libip4tc
/install
413 $(INSTALL_DIR
) $(1)/usr
/lib
414 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
417 define Package
/libip6tc
/install
418 $(INSTALL_DIR
) $(1)/usr
/lib
419 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
422 define Package
/libxtables
/install
423 $(INSTALL_DIR
) $(1)/usr
/lib
424 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
428 define Package
/$(1)/install
429 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
430 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
431 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
432 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
438 $$(eval
$$(call BuildPackage
,$(1)))
442 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
443 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
446 $(eval
$(call BuildPackage
,iptables
))
447 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
448 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
449 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
450 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
451 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
452 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
453 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
454 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
455 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
456 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
457 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
458 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
459 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
460 $(eval
$(call BuildPackage
,ip6tables
))
461 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))
462 $(eval
$(call BuildPackage
,libiptc
))
463 $(eval
$(call BuildPackage
,libip4tc
))
464 $(eval
$(call BuildPackage
,libip6tc
))
465 $(eval
$(call BuildPackage
,libxtables
))