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
54 define Package
/iptables
/config
55 config IPTABLES_CONNLABEL
56 bool
"Enable Connlabel support"
59 This enable connlabel support in iptables.
61 config IPTABLES_NFTABLES
62 bool
"Enable Nftables support"
65 This enable nftables support in iptables.
68 define Package
/iptables
/description
69 IP firewall administration tool.
108 define Package
/iptables-nft
109 $(call Package
/iptables
/Default
)
110 TITLE
:=IP firewall administration tool nft
111 DEPENDS
:=iptables @IPTABLES_NFTABLES
+libxtables-nft
114 define Package
/iptables-nft
/description
115 Extra iptables nftables nft binaries.
120 iptables-restore-translate
123 define Package
/iptables-mod-conntrack-extra
124 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
+kmod-ipt-raw
)
125 TITLE
:=Extra connection tracking extensions
128 define Package
/iptables-mod-conntrack-extra
/description
129 Extra iptables extensions for connection tracking.
143 define Package
/iptables-mod-conntrack-label
144 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-label @IPTABLES_CONNLABEL
)
145 TITLE
:=Connection tracking labeling extension
146 DEFAULT
:=y if IPTABLES_CONNLABEL
149 define Package
/iptables-mod-conntrack-label
/description
150 Match and set label
(s
) on connection tracking entries
157 define Package
/iptables-mod-filter
158 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
159 TITLE
:=Content inspection extensions
162 define Package
/iptables-mod-filter
/description
163 iptables extensions for packet content inspection.
164 Includes support for
:
172 define Package
/iptables-mod-ipopt
173 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
174 TITLE
:=IP
/Packet option extensions
177 define Package
/iptables-mod-ipopt
/description
178 iptables extensions for matching
/changing IP packet options.
197 define Package
/iptables-mod-ipsec
198 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
199 TITLE
:=IPsec extensions
202 define Package
/iptables-mod-ipsec
/description
203 iptables extensions for matching ipsec traffic.
212 define Package
/iptables-mod-nat-extra
213 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
214 TITLE
:=Extra NAT extensions
217 define Package
/iptables-mod-nat-extra
/description
218 iptables extensions for extra NAT targets.
225 define Package
/iptables-mod-nflog
226 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
227 TITLE
:=Netfilter NFLOG target
230 define Package
/iptables-mod-nflog
/description
231 iptables extension for user-space logging via NFNETLINK.
238 define Package
/iptables-mod-trace
239 $(call Package
/iptables
/Module
, +kmod-ipt-debug
)
240 TITLE
:=Netfilter TRACE target
243 define Package
/iptables-mod-trace
/description
244 iptables extension for TRACE target
252 define Package
/iptables-mod-nfqueue
253 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
254 TITLE
:=Netfilter NFQUEUE target
257 define Package
/iptables-mod-nfqueue
/description
258 iptables extension for user-space queuing via NFNETLINK.
265 define Package
/iptables-mod-hashlimit
266 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
267 TITLE
:=hashlimit matching
270 define Package
/iptables-mod-hashlimit
/description
271 iptables extensions for hashlimit matching
278 define Package
/iptables-mod-rpfilter
279 $(call Package
/iptables
/Module
, +kmod-ipt-rpfilter
)
280 TITLE
:=rpfilter iptables extension
283 define Package
/iptables-mod-rpfilter
/description
284 iptables extensions for reverse path
filter test on a packet
291 define Package
/iptables-mod-iprange
292 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
293 TITLE
:=IP range extension
296 define Package
/iptables-mod-iprange
/description
297 iptables extensions for matching ip ranges.
304 define Package
/iptables-mod-cluster
305 $(call Package
/iptables
/Module
, +kmod-ipt-cluster
)
306 TITLE
:=Match cluster extension
309 define Package
/iptables-mod-cluster
/description
310 iptables extensions for matching cluster.
312 Netfilter
(IPv4
/IPv6
) module for matching cluster
313 This option allows you to build work-load-sharing clusters of
314 network servers
/stateful firewalls without having a dedicated
315 load-balancing router
/server
/switch. Basically
, this match returns
316 true when the packet must be handled by this cluster node. Thus
,
317 all nodes see
all packets and this match decides which node handles
318 what packets. The work-load sharing algorithm is based on source
321 This module is usable for ipv4 and ipv6.
323 If you select it
, it enables kmod-ipt-cluster.
325 see
`iptables -m cluster --help` for more information.
328 define Package
/iptables-mod-clusterip
329 $(call Package
/iptables
/Module
, +kmod-ipt-clusterip
)
330 TITLE
:=Clusterip extension
333 define Package
/iptables-mod-clusterip
/description
334 iptables extensions for CLUSTERIP.
335 The CLUSTERIP target allows you to build load-balancing clusters of
336 network servers without having a dedicated load-balancing
337 router
/server
/switch.
339 If you select it
, it enables kmod-ipt-clusterip.
341 see
`iptables -j CLUSTERIP --help` for more information.
344 define Package
/iptables-mod-extra
345 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
346 TITLE
:=Other extra iptables extensions
349 define Package
/iptables-mod-extra
/description
350 Other extra iptables extensions.
361 define Package
/iptables-mod-physdev
362 $(call Package
/iptables
/Module
, +kmod-ipt-physdev
)
363 TITLE
:=physdev iptables extension
366 define Package
/iptables-mod-physdev
/description
367 The iptables physdev match.
370 define Package
/iptables-mod-led
371 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
372 TITLE
:=LED trigger iptables extension
375 define Package
/iptables-mod-led
/description
376 iptables extension for triggering a LED.
383 define Package
/iptables-mod-tproxy
384 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
385 TITLE
:=Transparent proxy iptables extensions
388 define Package
/iptables-mod-tproxy
/description
389 Transparent proxy iptables extensions.
399 define Package
/iptables-mod-tee
400 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
401 TITLE
:=TEE iptables extensions
404 define Package
/iptables-mod-tee
/description
405 TEE iptables extensions.
412 define Package
/iptables-mod-u32
413 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
414 TITLE
:=U32 iptables extensions
417 define Package
/iptables-mod-u32
/description
418 U32 iptables extensions.
425 define Package
/iptables-mod-checksum
426 $(call Package
/iptables
/Module
, +kmod-ipt-checksum
)
427 TITLE
:=IP CHECKSUM target extension
430 define Package
/iptables-mod-checksum
/description
431 iptables extension for the CHECKSUM calculation target
434 define Package
/ip6tables
435 $(call Package
/iptables
/Default
)
436 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
438 TITLE
:=IPv6 firewall administration tool
442 define Package
/ip6tables-nft
443 $(call Package
/iptables
/Default
)
444 DEPENDS
:=ip6tables @IPTABLES_NFTABLES
+libxtables-nft
445 TITLE
:=IP firewall administration tool nft
448 define Package
/ip6tables-nft
/description
449 Extra ip6tables nftables nft binaries.
454 iptables-restore-translate
457 define Package
/ip6tables-extra
458 $(call Package
/iptables
/Default
)
459 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
460 TITLE
:=IPv6 header matching modules
463 define Package
/ip6tables-mod-extra
/description
464 iptables header matching modules for IPv6
467 define Package
/ip6tables-mod-nat
468 $(call Package
/iptables
/Default
)
469 DEPENDS
:=ip6tables
+kmod-ipt-nat6
470 TITLE
:=IPv6 NAT extensions
473 define Package
/ip6tables-mod-nat
/description
474 iptables extensions for IPv6-NAT targets.
477 define Package
/libip4tc
478 $(call Package
/iptables
/Default
)
481 TITLE
:=IPv4 firewall
- shared libiptc library
486 define Package
/libip6tc
487 $(call Package
/iptables
/Default
)
490 TITLE
:=IPv6 firewall
- shared libiptc library
495 define Package
/libxtables
496 $(call Package
/iptables
/Default
)
499 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
502 +IPTABLES_CONNLABEL
:libnetfilter-conntrack \
503 +IPTABLES_NFTABLES
:libnftnl
506 define Package
/libxtables-nft
507 $(call Package
/iptables
/Default
)
510 TITLE
:=IPv4
/IPv6 firewall
- shared xtables nft library
516 -I
$(PKG_BUILD_DIR
)/include \
517 -I
$(LINUX_DIR
)/user_headers
/include \
521 -I
$(PKG_BUILD_DIR
)/include \
522 -I
$(LINUX_DIR
)/user_headers
/include \
523 -ffunction-sections
-fdata-sections \
533 --with-kernel
="$(LINUX_DIR)/user_headers" \
534 --with-xtlibdir
=/usr
/lib
/iptables \
535 --with-xt-lock-name
=/var
/run
/xtables.lock \
536 $(if
$(CONFIG_IPTABLES_CONNLABEL
),,--disable-connlabel
) \
537 $(if
$(CONFIG_IPTABLES_NFTABLES
),,--disable-nftables
) \
538 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
541 $(TARGET_CONFIGURE_OPTS
) \
542 COPT_FLAGS
="$(TARGET_CFLAGS)" \
543 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
544 KBUILD_OUTPUT
="$(LINUX_DIR)" \
545 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
547 ifneq ($(wildcard $(PKG_BUILD_DIR
)/.config_
*),$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
)))
548 define Build
/Configure
/rebuild
549 $(FIND
) $(PKG_BUILD_DIR
) -name \
*.o
-or
-name \
*.
\?o
-or
-name \
*.a |
$(XARGS
) rm -f
550 rm -f
$(PKG_BUILD_DIR
)/.config_
*
551 rm -f
$(PKG_BUILD_DIR
)/.configured_
*
552 touch
$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
))
556 define Build
/Configure
557 $(Build
/Configure
/rebuild
)
558 $(Build
/Configure
/Default
)
561 define Build
/InstallDev
562 $(INSTALL_DIR
) $(1)/usr
/include
563 $(INSTALL_DIR
) $(1)/usr
/include/iptables
564 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
566 # XXX: iptables header fixup, some headers are not installed by iptables anymore
567 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
568 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
569 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
570 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
571 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
573 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
574 $(INSTALL_DIR
) $(1)/usr
/lib
575 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
576 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
577 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
578 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
579 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
581 # XXX: needed by firewall3
582 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext
*.so
$(1)/usr
/lib
/
585 define Package
/iptables
/install
586 $(INSTALL_DIR
) $(1)/usr
/sbin
587 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-legacy-multi
$(1)/usr
/sbin
/
588 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
589 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
592 define Package
/iptables-nft
/install
593 $(INSTALL_DIR
) $(1)/usr
/sbin
594 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-nft-multi
$(1)/usr
/sbin
/
595 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables-nft
{,-restore
,-save
} $(1)/usr
/sbin
/
596 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
}-translate
$(1)/usr
/sbin
/
599 define Package
/ip6tables
/install
600 $(INSTALL_DIR
) $(1)/usr
/sbin
601 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
604 define Package
/ip6tables-nft
/install
605 $(INSTALL_DIR
) $(1)/usr
/sbin
606 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables-nft
{,-restore
,-save
} $(1)/usr
/sbin
/
607 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
}-translate
$(1)/usr
/sbin
/
610 define Package
/libip4tc
/install
611 $(INSTALL_DIR
) $(1)/usr
/lib
612 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so.
* $(1)/usr
/lib
/
613 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext4.so
$(1)/usr
/lib
/
616 define Package
/libip6tc
/install
617 $(INSTALL_DIR
) $(1)/usr
/lib
618 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so.
* $(1)/usr
/lib
/
619 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext6.so
$(1)/usr
/lib
/
622 define Package
/libxtables
/install
623 $(INSTALL_DIR
) $(1)/usr
/lib
624 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so.
* $(1)/usr
/lib
/
625 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext.so
$(1)/usr
/lib
/
628 define Package
/libxtables-nft
/install
629 $(INSTALL_DIR
) $(1)/usr
/lib
630 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext_
*.so
$(1)/usr
/lib
/
634 define Package
/$(1)/install
635 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
636 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
637 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
638 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
644 $$(eval
$$(call BuildPackage
,$(1)))
647 $(eval
$(call BuildPackage
,libxtables
))
648 $(eval
$(call BuildPackage
,libxtables-nft
))
649 $(eval
$(call BuildPackage
,libip4tc
))
650 $(eval
$(call BuildPackage
,libip6tc
))
651 $(eval
$(call BuildPackage
,iptables
))
652 $(eval
$(call BuildPackage
,iptables-nft
))
653 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
654 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-label
,$(IPT_CONNTRACK_LABEL-m
)))
655 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
656 $(eval
$(call BuildPlugin
,iptables-mod-physdev
,$(IPT_PHYSDEV-m
)))
657 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
)))
658 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
659 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
660 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
661 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
662 $(eval
$(call BuildPlugin
,iptables-mod-cluster
,$(IPT_CLUSTER-m
)))
663 $(eval
$(call BuildPlugin
,iptables-mod-clusterip
,$(IPT_CLUSTERIP-m
)))
664 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
665 $(eval
$(call BuildPlugin
,iptables-mod-rpfilter
,$(IPT_RPFILTER-m
)))
666 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
667 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
668 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
669 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
670 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
671 $(eval
$(call BuildPlugin
,iptables-mod-trace
,$(IPT_DEBUG-m
)))
672 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
673 $(eval
$(call BuildPlugin
,iptables-mod-checksum
,$(IPT_CHECKSUM-m
)))
674 $(eval
$(call BuildPackage
,ip6tables
))
675 $(eval
$(call BuildPackage
,ip6tables-nft
))
676 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
677 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))