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
27 ifneq ($(CONFIG_EXTERNAL_KERNEL_TREE
),"")
31 include $(INCLUDE_DIR
)/package.mk
33 -include $(LINUX_DIR
)/.config
34 include $(INCLUDE_DIR
)/netfilter.mk
35 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell $(SH_FUNC
) grep
'NETFILTER' $(LINUX_DIR
)/.config | md5s
)
39 define Package
/iptables
/Default
43 URL
:=http
://netfilter.org
/
46 define Package
/iptables
/Module
47 $(call Package
/iptables
/Default
)
48 DEPENDS
:=iptables
$(1)
51 define Package
/iptables
52 $(call Package
/iptables
/Default
)
53 TITLE
:=IP firewall administration tool
55 DEPENDS
+= +kmod-ipt-core
+libip4tc
+IPV6
:libip6tc
+libxtables
58 define Package
/iptables
/description
59 IP firewall administration tool.
97 define Package
/iptables-mod-conntrack-extra
98 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
99 TITLE
:=Extra connection tracking extensions
102 define Package
/iptables-mod-conntrack-extra
/description
103 Extra iptables extensions for connection tracking.
117 define Package
/iptables-mod-filter
118 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
119 TITLE
:=Content inspection extensions
122 define Package
/iptables-mod-filter
/description
123 iptables extensions for packet content inspection.
124 Includes support for
:
132 define Package
/iptables-mod-ipopt
133 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
134 TITLE
:=IP
/Packet option extensions
137 define Package
/iptables-mod-ipopt
/description
138 iptables extensions for matching
/changing IP packet options.
157 define Package
/iptables-mod-ipsec
158 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
159 TITLE
:=IPsec extensions
162 define Package
/iptables-mod-ipsec
/description
163 iptables extensions for matching ipsec traffic.
172 define Package
/iptables-mod-nat-extra
173 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
174 TITLE
:=Extra NAT extensions
177 define Package
/iptables-mod-nat-extra
/description
178 iptables extensions for extra NAT targets.
185 define Package
/iptables-mod-ulog
186 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
187 TITLE
:=user-space packet logging
190 define Package
/iptables-mod-ulog
/description
191 iptables extensions for user-space packet logging.
198 define Package
/iptables-mod-nflog
199 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
200 TITLE
:=Netfilter NFLOG target
203 define Package
/iptables-mod-nflog
/description
204 iptables extension for user-space logging via NFNETLINK.
211 define Package
/iptables-mod-nfqueue
212 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
213 TITLE
:=Netfilter NFQUEUE target
216 define Package
/iptables-mod-nfqueue
/description
217 iptables extension for user-space queuing via NFNETLINK.
224 define Package
/iptables-mod-hashlimit
225 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
226 TITLE
:=hashlimit matching
229 define Package
/iptables-mod-hashlimit
/description
230 iptables extensions for hashlimit matching
237 define Package
/iptables-mod-iprange
238 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
239 TITLE
:=IP range extension
242 define Package
/iptables-mod-iprange
/description
243 iptables extensions for matching ip ranges.
250 define Package
/iptables-mod-extra
251 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
252 TITLE
:=Other extra iptables extensions
255 define Package
/iptables-mod-extra
/description
256 Other extra iptables extensions.
262 - physdev
(if ebtables is enabled
)
268 define Package
/iptables-mod-led
269 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
270 TITLE
:=LED trigger iptables extension
273 define Package
/iptables-mod-led
/description
274 iptables extension for triggering a LED.
281 define Package
/iptables-mod-tproxy
282 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
283 TITLE
:=Transparent proxy iptables extensions
286 define Package
/iptables-mod-tproxy
/description
287 Transparent proxy iptables extensions.
297 define Package
/iptables-mod-tee
298 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
299 TITLE
:=TEE iptables extensions
302 define Package
/iptables-mod-tee
/description
303 TEE iptables extensions.
310 define Package
/iptables-mod-u32
311 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
312 TITLE
:=U32 iptables extensions
315 define Package
/iptables-mod-u32
/description
316 U32 iptables extensions.
323 define Package
/ip6tables
324 $(call Package
/iptables
/Default
)
325 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
327 TITLE
:=IPv6 firewall administration tool
332 define Package
/ip6tables-extra
333 $(call Package
/iptables
/Default
)
334 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
335 TITLE
:=IPv6 header matching modules
338 define Package
/ip6tables-mod-extra
/description
339 iptables header matching modules for IPv6
342 define Package
/ip6tables-mod-nat
343 $(call Package
/iptables
/Default
)
344 DEPENDS
:=ip6tables
+kmod-ipt-nat6
345 TITLE
:=IPv6 NAT extensions
348 define Package
/ip6tables-mod-nat
/description
349 iptables extensions for IPv6-NAT targets.
352 define Package
/libiptc
353 $(call Package
/iptables
/Default
)
356 DEPENDS
:=+libip4tc
+IPV6
:libip6tc
357 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
360 define Package
/libip4tc
361 $(call Package
/iptables
/Default
)
364 TITLE
:=IPv4 firewall
- shared libiptc library
367 define Package
/libip6tc
368 $(call Package
/iptables
/Default
)
371 TITLE
:=IPv6 firewall
- shared libiptc library
374 define Package
/libxtables
375 $(call Package
/iptables
/Default
)
378 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
382 -I
$(PKG_BUILD_DIR
)/include \
383 -I
$(LINUX_DIR
)/user_headers
/include \
387 -I
$(PKG_BUILD_DIR
)/include \
388 -I
$(LINUX_DIR
)/user_headers
/include \
389 -ffunction-sections
-fdata-sections
397 --with-kernel
="$(LINUX_DIR)/user_headers" \
398 --with-xtlibdir
=/usr
/lib
/iptables \
400 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
403 $(TARGET_CONFIGURE_OPTS
) \
404 COPT_FLAGS
="$(TARGET_CFLAGS)" \
405 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
406 KBUILD_OUTPUT
="$(LINUX_DIR)" \
407 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
409 define Build
/InstallDev
410 $(INSTALL_DIR
) $(1)/usr
/include
411 $(INSTALL_DIR
) $(1)/usr
/include/iptables
412 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
414 # XXX: iptables header fixup, some headers are not installed by iptables anymore
415 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
416 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
417 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
418 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
419 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
421 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
422 $(INSTALL_DIR
) $(1)/usr
/lib
423 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
424 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.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
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
429 # XXX: needed by firewall3
430 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
431 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libext
*.a
$(1)/usr
/lib
/iptables
/
434 define Package
/iptables
/install
435 $(INSTALL_DIR
) $(1)/usr
/sbin
436 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
437 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
438 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
441 define Package
/ip6tables
/install
442 $(INSTALL_DIR
) $(1)/usr
/sbin
443 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
446 define Package
/libiptc
/install
447 $(INSTALL_DIR
) $(1)/usr
/lib
448 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
451 define Package
/libip4tc
/install
452 $(INSTALL_DIR
) $(1)/usr
/lib
453 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
456 define Package
/libip6tc
/install
457 $(INSTALL_DIR
) $(1)/usr
/lib
458 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
461 define Package
/libxtables
/install
462 $(INSTALL_DIR
) $(1)/usr
/lib
463 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
467 define Package
/$(1)/install
468 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
469 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
470 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
471 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
477 $$(eval
$$(call BuildPackage
,$(1)))
481 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
482 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
485 $(eval
$(call BuildPackage
,iptables
))
486 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
487 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
488 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
489 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
490 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
491 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
492 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
493 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
494 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
495 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
496 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
497 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
498 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
499 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
500 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
501 $(eval
$(call BuildPackage
,ip6tables
))
502 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
503 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))
504 $(eval
$(call BuildPackage
,libiptc
))
505 $(eval
$(call BuildPackage
,libip4tc
))
506 $(eval
$(call BuildPackage
,libip6tc
))
507 $(eval
$(call BuildPackage
,libxtables
))