2 # Copyright (C) 2006-2011 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
:=f382fe693f0b59d87bd47bea65eca198
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
/
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
:=IPv4 firewall administration tool
54 DEPENDS
+= +kmod-ipt-core
+libip4tc
+libxtables
57 define Package
/iptables
/description
58 IPv4 firewall administration tool.
82 define Package
/iptables-mod-conntrack
83 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack
)
84 TITLE
:=Basic connection tracking extensions
87 define Package
/iptables-mod-conntrack
/description
88 Basic iptables extensions for connection tracking.
102 define Package
/iptables-mod-conntrack-extra
103 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
104 TITLE
:=Extra connection tracking extensions
107 define Package
/iptables-mod-conntrack-extra
/description
108 Extra iptables extensions for connection tracking.
121 define Package
/iptables-mod-filter
122 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
123 TITLE
:=Content inspection extensions
126 define Package
/iptables-mod-filter
/description
127 iptables extensions for packet content inspection.
128 Includes support for
:
136 define Package
/iptables-mod-ipopt
137 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
138 TITLE
:=IP
/Packet option extensions
141 define Package
/iptables-mod-ipopt
/description
142 iptables extensions for matching
/changing IP packet options.
165 define Package
/iptables-mod-ipsec
166 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
167 TITLE
:=IPsec extensions
170 define Package
/iptables-mod-ipsec
/description
171 iptables extensions for matching ipsec traffic.
180 define Package
/iptables-mod-ipset
181 $(call Package
/iptables
/Module
,)
182 TITLE
:=IPset iptables extensions
185 define Package
/iptables-mod-ipset
/description
186 IPset iptables extensions.
196 define Package
/iptables-mod-nat
197 $(call Package
/iptables
/Module
, +kmod-ipt-nat
)
198 TITLE
:=Basic NAT extensions
201 define Package
/iptables-mod-nat
/description
202 iptables extensions for basic NAT targets.
214 define Package
/iptables-mod-nat-extra
215 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
216 TITLE
:=Extra NAT extensions
219 define Package
/iptables-mod-nat-extra
/description
220 iptables extensions for extra NAT targets.
228 define Package
/iptables-mod-ulog
229 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
230 TITLE
:=user-space packet logging
233 define Package
/iptables-mod-ulog
/description
234 iptables extensions for user-space packet logging.
241 define Package
/iptables-mod-hashlimit
242 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
243 TITLE
:=hashlimit matching
246 define Package
/iptables-mod-hashlimit
/description
247 iptables extensions for hashlimit matching
254 define Package
/iptables-mod-iprange
255 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
256 TITLE
:=IP range extension
259 define Package
/iptables-mod-iprange
/description
260 iptables extensions for matching ip ranges.
267 define Package
/iptables-mod-extra
268 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
269 TITLE
:=Other extra iptables extensions
272 define Package
/iptables-mod-extra
/description
273 Other extra iptables extensions.
278 - physdev
(if ebtables is enabled
)
284 define Package
/iptables-mod-led
285 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
286 TITLE
:=LED trigger iptables extension
289 define Package
/iptables-mod-led
/description
290 iptables extension for triggering a LED.
297 define Package
/iptables-mod-tproxy
298 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
299 TITLE
:=Transparent proxy iptables extensions
302 define Package
/iptables-mod-tproxy
/description
303 Transparent proxy iptables extensions.
313 define Package
/iptables-mod-tee
314 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
315 TITLE
:=TEE iptables extensions
318 define Package
/iptables-mod-tee
/description
319 TEE iptables extensions.
326 define Package
/iptables-mod-u32
327 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
328 TITLE
:=U32 iptables extensions
331 define Package
/iptables-mod-u32
/description
332 U32 iptables extensions.
339 define Package
/ip6tables
340 $(call Package
/iptables
/Default
)
341 DEPENDS
:=+kmod-ip6tables
+libip6tc
+libxtables
343 TITLE
:=IPv6 firewall administration tool
347 define Package
/libiptc
348 $(call Package
/iptables
/Default
)
351 DEPENDS
:=+libip4tc
+libip6tc
352 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
355 define Package
/libip4tc
356 $(call Package
/iptables
/Default
)
359 TITLE
:=IPv4 firewall
- shared libiptc library
362 define Package
/libip6tc
363 $(call Package
/iptables
/Default
)
366 TITLE
:=IPv6 firewall
- shared libiptc library
369 define Package
/libxtables
370 $(call Package
/iptables
/Default
)
373 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
376 define Package
/libipq
377 $(call Package
/iptables
/Default
)
380 TITLE
:=IPv4
/IPv6 firewall
- shared libipq library
384 -I
$(PKG_BUILD_DIR
)/include \
385 -I
$(LINUX_DIR
)/arch
/$(LINUX_KARCH
)/include \
389 -I
$(PKG_BUILD_DIR
)/include \
390 -I
$(LINUX_DIR
)/arch
/$(LINUX_KARCH
)/include
395 $(if
$(CONFIG_IPV6
),--enable-ipv6
,--disable-ipv6
) \
397 --with-kernel
="$(LINUX_DIR)" \
398 --with-xtlibdir
=/usr
/lib
/iptables
401 $(TARGET_CONFIGURE_OPTS
) \
402 COPT_FLAGS
="$(TARGET_CFLAGS)" \
403 LDFLAGS
="-rdynamic" \
404 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
405 KBUILD_OUTPUT
="$(LINUX_DIR)" \
407 define Build
/InstallDev
408 $(INSTALL_DIR
) $(1)/usr
/include
409 $(INSTALL_DIR
) $(1)/usr
/include/iptables
410 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
412 # XXX: iptables header fixup, some headers are not installed by iptables anymore
413 $(CP
) $(PKG_BUILD_DIR
)/include/net
/netfilter
/*.h
$(1)/usr
/include/net
/netfilter
/
414 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
415 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
416 $(CP
) $(PKG_BUILD_DIR
)/include/libipq
/libipq.h
$(1)/usr
/include/
417 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
418 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
420 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
421 $(INSTALL_DIR
) $(1)/usr
/lib
422 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
423 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
424 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libipq.so
* $(1)/usr
/lib
/
425 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
426 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
427 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libiptc.
pc $(1)/usr
/lib
/pkgconfig
/
430 define Package
/iptables
/install
431 $(INSTALL_DIR
) $(1)/usr
/sbin
432 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
$(1)/usr
/sbin
/
433 $(LN
) iptables
$(1)/usr
/sbin
/iptables-save
434 $(LN
) iptables
$(1)/usr
/sbin
/iptables-restore
435 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
436 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
437 for m in
$(patsubst xt_
%,ipt_
%,$(IPT_BUILTIN
)) $(patsubst ipt_
%,xt_
%,$(IPT_BUILTIN
)); do \
438 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
]; then \
439 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
$(1)/usr
/lib
/iptables
/ ;\
445 define Package
/ip6tables
/install
446 $(INSTALL_DIR
) $(1)/usr
/sbin
447 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
$(1)/usr
/sbin
/
448 $(LN
) ip6tables
$(1)/usr
/sbin
/ip6tables-save
449 $(LN
) ip6tables
$(1)/usr
/sbin
/ip6tables-restore
450 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
451 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
452 $(CP
) libip6t_
*.so
$(1)/usr
/lib
/iptables
/ \
456 define Package
/libiptc
/install
457 $(INSTALL_DIR
) $(1)/usr
/lib
458 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
461 define Package
/libip4tc
/install
462 $(INSTALL_DIR
) $(1)/usr
/lib
463 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
466 define Package
/libip6tc
/install
467 $(INSTALL_DIR
) $(1)/usr
/lib
468 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
471 define Package
/libxtables
/install
472 $(INSTALL_DIR
) $(1)/usr
/lib
473 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
476 define Package
/libipq
/install
477 $(INSTALL_DIR
) $(1)/usr
/lib
478 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libipq.so
* $(1)/usr
/lib
/
482 define Package
/$(1)/install
483 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
484 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)); do \
485 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
486 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
492 $$(eval
$$(call BuildPackage
,$(1)))
496 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
497 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
500 $(eval
$(call BuildPackage
,iptables
))
501 $(eval
$(call BuildPlugin
,iptables-mod-conntrack
,$(IPT_CONNTRACK-m
)))
502 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
503 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
504 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
505 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
506 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
507 $(eval
$(call BuildPlugin
,iptables-mod-ipset
,ipt_set ipt_SET
))
508 $(eval
$(call BuildPlugin
,iptables-mod-nat
,$(IPT_NAT-m
)))
509 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
510 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
511 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
512 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
513 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
514 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
515 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
516 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
517 $(eval
$(call BuildPackage
,ip6tables
))
518 $(eval
$(call BuildPackage
,libiptc
))
519 $(eval
$(call BuildPackage
,libip4tc
))
520 $(eval
$(call BuildPackage
,libip6tc
))
521 $(eval
$(call BuildPackage
,libxtables
))
522 $(eval
$(call BuildPackage
,libipq
))