2 # Copyright (C) 2006-2016 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_URL
:=https
://netfilter.org
/projects
/iptables
/files
16 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
17 PKG_HASH
:=c109c96bb04998cd44156622d36f8e04b140701ec60531a10668cfdff5e8d8f0
25 PKG_CPE_ID
:=cpe
:/a
:netfilter_core_team
:iptables
27 include $(INCLUDE_DIR
)/package.mk
29 -include $(LINUX_DIR
)/.config
30 include $(INCLUDE_DIR
)/netfilter.mk
31 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell grep
'NETFILTER' $(LINUX_DIR
)/.config |
$(MKHASH
) md5
)
35 define Package
/iptables
/Default
39 URL
:=https
://netfilter.org
/
42 define Package
/iptables
/Module
43 $(call Package
/iptables
/Default
)
44 DEPENDS
:=+iptables
$(1)
47 define Package
/iptables
48 $(call Package
/iptables
/Default
)
49 TITLE
:=IP firewall administration tool
51 DEPENDS
+= +kmod-ipt-core
+libip4tc
+IPV6
:libip6tc
+libxtables
53 200:/usr
/sbin
/iptables
:/usr
/sbin
/xtables-legacy-multi \
54 200:/usr
/sbin
/iptables-restore
:/usr
/sbin
/xtables-legacy-multi \
55 200:/usr
/sbin
/iptables-save
:/usr
/sbin
/xtables-legacy-multi
58 define Package
/iptables
/config
59 config IPTABLES_CONNLABEL
60 bool
"Enable Connlabel support"
63 This enable connlabel support in iptables.
65 config IPTABLES_NFTABLES
66 bool
"Enable Nftables support"
69 This enable nftables support in iptables.
72 define Package
/iptables
/description
73 IP firewall administration tool.
112 define Package
/iptables-nft
113 $(call Package
/iptables
/Default
)
114 TITLE
:=IP firewall administration tool nft
115 DEPENDS
:=@IPTABLES_NFTABLES
+libxtables-nft
+libip4tc
+IPV6
:libip6tc
+kmod-ipt-core
+kmod-nft-compat
117 300:/usr
/sbin
/iptables
:/usr
/sbin
/xtables-nft-multi \
118 300:/usr
/sbin
/iptables-restore
:/usr
/sbin
/xtables-nft-multi \
119 300:/usr
/sbin
/iptables-save
:/usr
/sbin
/xtables-nft-multi
122 define Package
/iptables-nft
/description
123 Extra iptables nftables nft binaries.
128 iptables-restore-translate
131 define Package
/iptables-mod-conntrack-extra
132 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
+kmod-ipt-raw
)
133 TITLE
:=Extra connection tracking extensions
136 define Package
/iptables-mod-conntrack-extra
/description
137 Extra iptables extensions for connection tracking.
151 define Package
/iptables-mod-conntrack-label
152 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-label @IPTABLES_CONNLABEL
)
153 TITLE
:=Connection tracking labeling extension
154 DEFAULT
:=y if IPTABLES_CONNLABEL
157 define Package
/iptables-mod-conntrack-label
/description
158 Match and set label
(s
) on connection tracking entries
165 define Package
/iptables-mod-filter
166 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
167 TITLE
:=Content inspection extensions
170 define Package
/iptables-mod-filter
/description
171 iptables extensions for packet content inspection.
172 Includes support for
:
180 define Package
/iptables-mod-ipopt
181 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
182 TITLE
:=IP
/Packet option extensions
185 define Package
/iptables-mod-ipopt
/description
186 iptables extensions for matching
/changing IP packet options.
205 define Package
/iptables-mod-ipsec
206 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
207 TITLE
:=IPsec extensions
210 define Package
/iptables-mod-ipsec
/description
211 iptables extensions for matching ipsec traffic.
220 define Package
/iptables-mod-nat-extra
221 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
222 TITLE
:=Extra NAT extensions
225 define Package
/iptables-mod-nat-extra
/description
226 iptables extensions for extra NAT targets.
233 define Package
/iptables-mod-ulog
234 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
235 TITLE
:=user-space packet logging
238 define Package
/iptables-mod-ulog
/description
239 iptables extensions for user-space packet logging.
246 define Package
/iptables-mod-nflog
247 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
248 TITLE
:=Netfilter NFLOG target
251 define Package
/iptables-mod-nflog
/description
252 iptables extension for user-space logging via NFNETLINK.
259 define Package
/iptables-mod-trace
260 $(call Package
/iptables
/Module
, +kmod-ipt-debug
)
261 TITLE
:=Netfilter TRACE target
264 define Package
/iptables-mod-trace
/description
265 iptables extension for TRACE target
273 define Package
/iptables-mod-nfqueue
274 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
275 TITLE
:=Netfilter NFQUEUE target
278 define Package
/iptables-mod-nfqueue
/description
279 iptables extension for user-space queuing via NFNETLINK.
286 define Package
/iptables-mod-hashlimit
287 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
288 TITLE
:=hashlimit matching
291 define Package
/iptables-mod-hashlimit
/description
292 iptables extensions for hashlimit matching
299 define Package
/iptables-mod-rpfilter
300 $(call Package
/iptables
/Module
, +kmod-ipt-rpfilter
)
301 TITLE
:=rpfilter iptables extension
304 define Package
/iptables-mod-rpfilter
/description
305 iptables extensions for reverse path
filter test on a packet
312 define Package
/iptables-mod-iprange
313 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
314 TITLE
:=IP range extension
317 define Package
/iptables-mod-iprange
/description
318 iptables extensions for matching ip ranges.
325 define Package
/iptables-mod-cluster
326 $(call Package
/iptables
/Module
, +kmod-ipt-cluster
)
327 TITLE
:=Match cluster extension
330 define Package
/iptables-mod-cluster
/description
331 iptables extensions for matching cluster.
333 Netfilter
(IPv4
/IPv6
) module for matching cluster
334 This option allows you to build work-load-sharing clusters of
335 network servers
/stateful firewalls without having a dedicated
336 load-balancing router
/server
/switch. Basically
, this match returns
337 true when the packet must be handled by this cluster node. Thus
,
338 all nodes see
all packets and this match decides which node handles
339 what packets. The work-load sharing algorithm is based on source
342 This module is usable for ipv4 and ipv6.
344 If you select it
, it enables kmod-ipt-cluster.
346 see
`iptables -m cluster --help` for more information.
349 define Package
/iptables-mod-clusterip
350 $(call Package
/iptables
/Module
, +kmod-ipt-clusterip
)
351 TITLE
:=Clusterip extension
354 define Package
/iptables-mod-clusterip
/description
355 iptables extensions for CLUSTERIP.
356 The CLUSTERIP target allows you to build load-balancing clusters of
357 network servers without having a dedicated load-balancing
358 router
/server
/switch.
360 If you select it
, it enables kmod-ipt-clusterip.
362 see
`iptables -j CLUSTERIP --help` for more information.
365 define Package
/iptables-mod-extra
366 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
367 TITLE
:=Other extra iptables extensions
370 define Package
/iptables-mod-extra
/description
371 Other extra iptables extensions.
382 define Package
/iptables-mod-physdev
383 $(call Package
/iptables
/Module
, +kmod-ipt-physdev
)
384 TITLE
:=physdev iptables extension
387 define Package
/iptables-mod-physdev
/description
388 The iptables physdev match.
391 define Package
/iptables-mod-led
392 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
393 TITLE
:=LED trigger iptables extension
396 define Package
/iptables-mod-led
/description
397 iptables extension for triggering a LED.
404 define Package
/iptables-mod-tproxy
405 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
406 TITLE
:=Transparent proxy iptables extensions
409 define Package
/iptables-mod-tproxy
/description
410 Transparent proxy iptables extensions.
420 define Package
/iptables-mod-tee
421 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
422 TITLE
:=TEE iptables extensions
425 define Package
/iptables-mod-tee
/description
426 TEE iptables extensions.
433 define Package
/iptables-mod-u32
434 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
435 TITLE
:=U32 iptables extensions
438 define Package
/iptables-mod-u32
/description
439 U32 iptables extensions.
446 define Package
/iptables-mod-checksum
447 $(call Package
/iptables
/Module
, +kmod-ipt-checksum
)
448 TITLE
:=IP CHECKSUM target extension
451 define Package
/iptables-mod-checksum
/description
452 iptables extension for the CHECKSUM calculation target
455 define Package
/ip6tables
456 $(call Package
/iptables
/Default
)
457 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
459 TITLE
:=IPv6 firewall administration tool
462 200:/usr
/sbin
/ip6tables
:/usr
/sbin
/xtables-legacy-multi \
463 200:/usr
/sbin
/ip6tables-restore
:/usr
/sbin
/xtables-legacy-multi \
464 200:/usr
/sbin
/ip6tables-save
:/usr
/sbin
/xtables-legacy-multi
467 define Package
/ip6tables-nft
468 $(call Package
/iptables
/Default
)
469 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables-nft
470 TITLE
:=IP firewall administration tool nft
472 300:/usr
/sbin
/ip6tables
:/usr
/sbin
/xtables-nft-multi \
473 300:/usr
/sbin
/ip6tables-restore
:/usr
/sbin
/xtables-nft-multi \
474 300:/usr
/sbin
/ip6tables-save
:/usr
/sbin
/xtables-nft-multi
477 define Package
/ip6tables-nft
/description
478 Extra ip6tables nftables nft binaries.
480 ip6tables-nft-restore
483 ip6tables-restore-translate
486 define Package
/ip6tables-extra
487 $(call Package
/iptables
/Default
)
488 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
489 TITLE
:=IPv6 header matching modules
492 define Package
/ip6tables-extra
/description
493 iptables header matching modules for IPv6
496 define Package
/ip6tables-mod-nat
497 $(call Package
/iptables
/Default
)
498 DEPENDS
:=ip6tables
+kmod-ipt-nat6
499 TITLE
:=IPv6 NAT extensions
502 define Package
/ip6tables-mod-nat
/description
503 iptables extensions for IPv6-NAT targets.
506 define Package
/libip4tc
507 $(call Package
/iptables
/Default
)
510 TITLE
:=IPv4 firewall
- shared libiptc library
515 define Package
/libip6tc
516 $(call Package
/iptables
/Default
)
519 TITLE
:=IPv6 firewall
- shared libiptc library
524 define Package
/libxtables
525 $(call Package
/iptables
/Default
)
528 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
531 +IPTABLES_CONNLABEL
:libnetfilter-conntrack \
532 +IPTABLES_NFTABLES
:libnftnl
535 define Package
/libxtables-nft
536 $(call Package
/iptables
/Default
)
539 TITLE
:=IPv4
/IPv6 firewall
- shared xtables nft library
545 -I
$(PKG_BUILD_DIR
)/include \
546 -I
$(LINUX_DIR
)/user_headers
/include \
550 -I
$(PKG_BUILD_DIR
)/include \
551 -I
$(LINUX_DIR
)/user_headers
/include \
552 -ffunction-sections
-fdata-sections \
562 --with-kernel
="$(LINUX_DIR)/user_headers" \
563 --with-xtlibdir
=/usr
/lib
/iptables \
564 --with-xt-lock-name
=/var
/run
/xtables.lock \
565 $(if
$(CONFIG_IPTABLES_CONNLABEL
),,--disable-connlabel
) \
566 $(if
$(CONFIG_IPTABLES_NFTABLES
),,--disable-nftables
) \
567 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
570 $(TARGET_CONFIGURE_OPTS
) \
571 COPT_FLAGS
="$(TARGET_CFLAGS)" \
572 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
573 KBUILD_OUTPUT
="$(LINUX_DIR)" \
574 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
576 ifneq ($(wildcard $(PKG_BUILD_DIR
)/.config_
*),$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
)))
577 define Build
/Configure
/rebuild
578 $(FIND
) $(PKG_BUILD_DIR
) -name \
*.o
-or
-name \
*.
\?o
-or
-name \
*.a |
$(XARGS
) rm -f
579 rm -f
$(PKG_BUILD_DIR
)/.config_
*
580 rm -f
$(PKG_BUILD_DIR
)/.configured_
*
581 touch
$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
))
585 define Build
/Configure
586 $(Build
/Configure
/rebuild
)
587 $(Build
/Configure
/Default
)
590 define Build
/InstallDev
591 $(INSTALL_DIR
) $(1)/usr
/include
592 $(INSTALL_DIR
) $(1)/usr
/include/iptables
593 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
595 # XXX: iptables header fixup, some headers are not installed by iptables anymore
596 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
597 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
598 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
599 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
600 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
602 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
603 $(INSTALL_DIR
) $(1)/usr
/lib
604 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
605 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
606 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
607 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
608 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
610 # XXX: needed by firewall3
611 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext
*.so
$(1)/usr
/lib
/
614 define Package
/iptables
/install
615 $(INSTALL_DIR
) $(1)/usr
/sbin
616 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-legacy-multi
$(1)/usr
/sbin
/
617 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
620 define Package
/iptables-nft
/install
621 $(INSTALL_DIR
) $(1)/usr
/sbin
622 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-nft-multi
$(1)/usr
/sbin
/
623 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables-nft
{,-restore
,-save
} $(1)/usr
/sbin
/
624 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
}-translate
$(1)/usr
/sbin
/
627 define Package
/ip6tables
/install
628 $(INSTALL_DIR
) $(1)/usr
/sbin
631 define Package
/ip6tables-nft
/install
632 $(INSTALL_DIR
) $(1)/usr
/sbin
633 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables-nft
{,-restore
,-save
} $(1)/usr
/sbin
/
634 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
}-translate
$(1)/usr
/sbin
/
637 define Package
/libip4tc
/install
638 $(INSTALL_DIR
) $(1)/usr
/lib
639 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so.
* $(1)/usr
/lib
/
640 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext4.so
$(1)/usr
/lib
/
643 define Package
/libip6tc
/install
644 $(INSTALL_DIR
) $(1)/usr
/lib
645 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so.
* $(1)/usr
/lib
/
646 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext6.so
$(1)/usr
/lib
/
649 define Package
/libxtables
/install
650 $(INSTALL_DIR
) $(1)/usr
/lib
651 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so.
* $(1)/usr
/lib
/
652 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext.so
$(1)/usr
/lib
/
655 define Package
/libxtables-nft
/install
656 $(INSTALL_DIR
) $(1)/usr
/lib
657 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext_
*.so
$(1)/usr
/lib
/
661 define Package
/$(1)/install
662 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
663 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
664 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
665 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
671 $$(eval
$$(call BuildPackage
,$(1)))
674 $(eval
$(call BuildPackage
,libxtables
))
675 $(eval
$(call BuildPackage
,libxtables-nft
))
676 $(eval
$(call BuildPackage
,libip4tc
))
677 $(eval
$(call BuildPackage
,libip6tc
))
678 $(eval
$(call BuildPackage
,iptables
))
679 $(eval
$(call BuildPackage
,iptables-nft
))
680 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
681 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-label
,$(IPT_CONNTRACK_LABEL-m
)))
682 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
683 $(eval
$(call BuildPlugin
,iptables-mod-physdev
,$(IPT_PHYSDEV-m
)))
684 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
)))
685 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
686 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
687 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
688 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
689 $(eval
$(call BuildPlugin
,iptables-mod-cluster
,$(IPT_CLUSTER-m
)))
690 $(eval
$(call BuildPlugin
,iptables-mod-clusterip
,$(IPT_CLUSTERIP-m
)))
691 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
692 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
693 $(eval
$(call BuildPlugin
,iptables-mod-rpfilter
,$(IPT_RPFILTER-m
)))
694 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
695 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
696 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
697 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
698 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
699 $(eval
$(call BuildPlugin
,iptables-mod-trace
,$(IPT_DEBUG-m
)))
700 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
701 $(eval
$(call BuildPlugin
,iptables-mod-checksum
,$(IPT_CHECKSUM-m
)))
702 $(eval
$(call BuildPackage
,ip6tables
))
703 $(eval
$(call BuildPackage
,ip6tables-nft
))
704 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
705 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))