2 # Copyright (C) 2006-2012 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.
164 define Package
/iptables-mod-ipsec
165 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
166 TITLE
:=IPsec extensions
169 define Package
/iptables-mod-ipsec
/description
170 iptables extensions for matching ipsec traffic.
179 define Package
/iptables-mod-ipset
180 $(call Package
/iptables
/Module
,)
181 TITLE
:=IPset iptables extensions
184 define Package
/iptables-mod-ipset
/description
185 IPset iptables extensions.
195 define Package
/iptables-mod-nat
196 $(call Package
/iptables
/Module
, +kmod-ipt-nat
)
197 TITLE
:=Basic NAT extensions
200 define Package
/iptables-mod-nat
/description
201 iptables extensions for basic NAT targets.
213 define Package
/iptables-mod-nat-extra
214 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
215 TITLE
:=Extra NAT extensions
218 define Package
/iptables-mod-nat-extra
/description
219 iptables extensions for extra NAT targets.
227 define Package
/iptables-mod-ulog
228 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
229 TITLE
:=user-space packet logging
232 define Package
/iptables-mod-ulog
/description
233 iptables extensions for user-space packet logging.
240 define Package
/iptables-mod-hashlimit
241 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
242 TITLE
:=hashlimit matching
245 define Package
/iptables-mod-hashlimit
/description
246 iptables extensions for hashlimit matching
253 define Package
/iptables-mod-iprange
254 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
255 TITLE
:=IP range extension
258 define Package
/iptables-mod-iprange
/description
259 iptables extensions for matching ip ranges.
266 define Package
/iptables-mod-extra
267 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
268 TITLE
:=Other extra iptables extensions
271 define Package
/iptables-mod-extra
/description
272 Other extra iptables extensions.
277 - physdev
(if ebtables is enabled
)
283 define Package
/iptables-mod-led
284 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
285 TITLE
:=LED trigger iptables extension
288 define Package
/iptables-mod-led
/description
289 iptables extension for triggering a LED.
296 define Package
/iptables-mod-tproxy
297 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
298 TITLE
:=Transparent proxy iptables extensions
301 define Package
/iptables-mod-tproxy
/description
302 Transparent proxy iptables extensions.
312 define Package
/iptables-mod-tee
313 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
314 TITLE
:=TEE iptables extensions
317 define Package
/iptables-mod-tee
/description
318 TEE iptables extensions.
325 define Package
/iptables-mod-u32
326 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
327 TITLE
:=U32 iptables extensions
330 define Package
/iptables-mod-u32
/description
331 U32 iptables extensions.
338 define Package
/ip6tables
339 $(call Package
/iptables
/Default
)
340 DEPENDS
:=+kmod-ip6tables
+libip6tc
+libxtables
342 TITLE
:=IPv6 firewall administration tool
346 define Package
/libiptc
347 $(call Package
/iptables
/Default
)
350 DEPENDS
:=+libip4tc
+libip6tc
351 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
354 define Package
/libip4tc
355 $(call Package
/iptables
/Default
)
358 TITLE
:=IPv4 firewall
- shared libiptc library
361 define Package
/libip6tc
362 $(call Package
/iptables
/Default
)
365 TITLE
:=IPv6 firewall
- shared libiptc library
368 define Package
/libxtables
369 $(call Package
/iptables
/Default
)
372 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
375 define Package
/libipq
376 $(call Package
/iptables
/Default
)
379 TITLE
:=IPv4
/IPv6 firewall
- shared libipq library
383 -I
$(PKG_BUILD_DIR
)/include \
384 -I
$(LINUX_DIR
)/arch
/$(LINUX_KARCH
)/include \
388 -I
$(PKG_BUILD_DIR
)/include \
389 -I
$(LINUX_DIR
)/arch
/$(LINUX_KARCH
)/include
394 $(if
$(CONFIG_IPV6
),--enable-ipv6
,--disable-ipv6
) \
396 --with-kernel
="$(LINUX_DIR)" \
397 --with-xtlibdir
=/usr
/lib
/iptables
400 $(TARGET_CONFIGURE_OPTS
) \
401 COPT_FLAGS
="$(TARGET_CFLAGS)" \
402 LDFLAGS
="-rdynamic" \
403 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
404 KBUILD_OUTPUT
="$(LINUX_DIR)" \
406 define Build
/InstallDev
407 $(INSTALL_DIR
) $(1)/usr
/include
408 $(INSTALL_DIR
) $(1)/usr
/include/iptables
409 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
411 # XXX: iptables header fixup, some headers are not installed by iptables anymore
412 $(CP
) $(PKG_BUILD_DIR
)/include/net
/netfilter
/*.h
$(1)/usr
/include/net
/netfilter
/
413 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
414 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
415 $(CP
) $(PKG_BUILD_DIR
)/include/libipq
/libipq.h
$(1)/usr
/include/
416 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
417 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
419 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
420 $(INSTALL_DIR
) $(1)/usr
/lib
421 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
422 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
423 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libipq.so
* $(1)/usr
/lib
/
424 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
425 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
426 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libiptc.
pc $(1)/usr
/lib
/pkgconfig
/
429 define Package
/iptables
/install
430 $(INSTALL_DIR
) $(1)/usr
/sbin
431 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
$(1)/usr
/sbin
/
432 $(LN
) iptables
$(1)/usr
/sbin
/iptables-save
433 $(LN
) iptables
$(1)/usr
/sbin
/iptables-restore
434 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
435 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
436 for m in
$(patsubst xt_
%,ipt_
%,$(IPT_BUILTIN
)) $(patsubst ipt_
%,xt_
%,$(IPT_BUILTIN
)); do \
437 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
]; then \
438 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$${m}.so
$(1)/usr
/lib
/iptables
/ ;\
444 define Package
/ip6tables
/install
445 $(INSTALL_DIR
) $(1)/usr
/sbin
446 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
$(1)/usr
/sbin
/
447 $(LN
) ip6tables
$(1)/usr
/sbin
/ip6tables-save
448 $(LN
) ip6tables
$(1)/usr
/sbin
/ip6tables-restore
449 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
450 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
451 $(CP
) libip6t_
*.so
$(1)/usr
/lib
/iptables
/ \
455 define Package
/libiptc
/install
456 $(INSTALL_DIR
) $(1)/usr
/lib
457 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
460 define Package
/libip4tc
/install
461 $(INSTALL_DIR
) $(1)/usr
/lib
462 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
465 define Package
/libip6tc
/install
466 $(INSTALL_DIR
) $(1)/usr
/lib
467 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
470 define Package
/libxtables
/install
471 $(INSTALL_DIR
) $(1)/usr
/lib
472 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
475 define Package
/libipq
/install
476 $(INSTALL_DIR
) $(1)/usr
/lib
477 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libipq.so
* $(1)/usr
/lib
/
481 define Package
/$(1)/install
482 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
483 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)); do \
484 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
485 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
491 $$(eval
$$(call BuildPackage
,$(1)))
495 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
496 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
499 $(eval
$(call BuildPackage
,iptables
))
500 $(eval
$(call BuildPlugin
,iptables-mod-conntrack
,$(IPT_CONNTRACK-m
)))
501 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
502 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
503 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
504 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
505 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
506 $(eval
$(call BuildPlugin
,iptables-mod-ipset
,ipt_set ipt_SET
))
507 $(eval
$(call BuildPlugin
,iptables-mod-nat
,$(IPT_NAT-m
)))
508 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
509 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
510 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
511 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
512 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
513 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
514 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
515 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
516 $(eval
$(call BuildPackage
,ip6tables
))
517 $(eval
$(call BuildPackage
,libiptc
))
518 $(eval
$(call BuildPackage
,libip4tc
))
519 $(eval
$(call BuildPackage
,libip6tc
))
520 $(eval
$(call BuildPackage
,libxtables
))
521 $(eval
$(call BuildPackage
,libipq
))