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
:=+libxtables
$(1)
47 define Package
/iptables
48 $(call Package
/iptables
/Default
)
49 TITLE
:=IP firewall administration tool
50 DEPENDS
+= +kmod-ipt-core
+libip4tc
+IPV6
:libip6tc
+libxtables
52 200:/usr
/sbin
/iptables
:/usr
/sbin
/xtables-legacy-multi \
53 200:/usr
/sbin
/iptables-restore
:/usr
/sbin
/xtables-legacy-multi \
54 200:/usr
/sbin
/iptables-save
:/usr
/sbin
/xtables-legacy-multi
57 define Package
/iptables
/description
58 IP firewall administration tool.
97 define Package
/iptables-nft
98 $(call Package
/iptables
/Default
)
99 TITLE
:=IP firewall administration tool nft
100 DEPENDS
:=@IPTABLES_NFTABLES
+libnftnl
+libxtables-nft
+libip4tc
+IPV6
:libip6tc
+kmod-ipt-core
+kmod-nft-compat
102 300:/usr
/sbin
/iptables
:/usr
/sbin
/xtables-nft-multi \
103 300:/usr
/sbin
/iptables-restore
:/usr
/sbin
/xtables-nft-multi \
104 300:/usr
/sbin
/iptables-save
:/usr
/sbin
/xtables-nft-multi
107 define Package
/iptables-nft
/description
108 Extra iptables nftables nft binaries.
113 iptables-restore-translate
116 define Package
/iptables-mod-conntrack-extra
117 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
+kmod-ipt-raw
)
118 TITLE
:=Extra connection tracking extensions
121 define Package
/iptables-mod-conntrack-extra
/description
122 Extra iptables extensions for connection tracking.
136 define Package
/iptables-mod-conntrack-label
137 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-label @IPTABLES_CONNLABEL
)
138 TITLE
:=Connection tracking labeling extension
139 DEFAULT
:=y if IPTABLES_CONNLABEL
142 define Package
/iptables-mod-conntrack-label
/description
143 Match and set label
(s
) on connection tracking entries
150 define Package
/iptables-mod-filter
151 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
152 TITLE
:=Content inspection extensions
155 define Package
/iptables-mod-filter
/description
156 iptables extensions for packet content inspection.
157 Includes support for
:
165 define Package
/iptables-mod-ipopt
166 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
167 TITLE
:=IP
/Packet option extensions
170 define Package
/iptables-mod-ipopt
/description
171 iptables extensions for matching
/changing IP packet options.
190 define Package
/iptables-mod-ipsec
191 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
192 TITLE
:=IPsec extensions
195 define Package
/iptables-mod-ipsec
/description
196 iptables extensions for matching ipsec traffic.
205 define Package
/iptables-mod-nat-extra
206 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
207 TITLE
:=Extra NAT extensions
210 define Package
/iptables-mod-nat-extra
/description
211 iptables extensions for extra NAT targets.
218 define Package
/iptables-mod-ulog
219 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
220 TITLE
:=user-space packet logging
223 define Package
/iptables-mod-ulog
/description
224 iptables extensions for user-space packet logging.
231 define Package
/iptables-mod-nflog
232 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
233 TITLE
:=Netfilter NFLOG target
236 define Package
/iptables-mod-nflog
/description
237 iptables extension for user-space logging via NFNETLINK.
244 define Package
/iptables-mod-trace
245 $(call Package
/iptables
/Module
, +kmod-ipt-debug
)
246 TITLE
:=Netfilter TRACE target
249 define Package
/iptables-mod-trace
/description
250 iptables extension for TRACE target
258 define Package
/iptables-mod-nfqueue
259 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
260 TITLE
:=Netfilter NFQUEUE target
263 define Package
/iptables-mod-nfqueue
/description
264 iptables extension for user-space queuing via NFNETLINK.
271 define Package
/iptables-mod-hashlimit
272 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
273 TITLE
:=hashlimit matching
276 define Package
/iptables-mod-hashlimit
/description
277 iptables extensions for hashlimit matching
284 define Package
/iptables-mod-rpfilter
285 $(call Package
/iptables
/Module
, +kmod-ipt-rpfilter
)
286 TITLE
:=rpfilter iptables extension
289 define Package
/iptables-mod-rpfilter
/description
290 iptables extensions for reverse path
filter test on a packet
297 define Package
/iptables-mod-iprange
298 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
299 TITLE
:=IP range extension
302 define Package
/iptables-mod-iprange
/description
303 iptables extensions for matching ip ranges.
310 define Package
/iptables-mod-cluster
311 $(call Package
/iptables
/Module
, +kmod-ipt-cluster
)
312 TITLE
:=Match cluster extension
315 define Package
/iptables-mod-cluster
/description
316 iptables extensions for matching cluster.
318 Netfilter
(IPv4
/IPv6
) module for matching cluster
319 This option allows you to build work-load-sharing clusters of
320 network servers
/stateful firewalls without having a dedicated
321 load-balancing router
/server
/switch. Basically
, this match returns
322 true when the packet must be handled by this cluster node. Thus
,
323 all nodes see
all packets and this match decides which node handles
324 what packets. The work-load sharing algorithm is based on source
327 This module is usable for ipv4 and ipv6.
329 If you select it
, it enables kmod-ipt-cluster.
331 see
`iptables -m cluster --help` for more information.
334 define Package
/iptables-mod-clusterip
335 $(call Package
/iptables
/Module
, +kmod-ipt-clusterip
)
336 TITLE
:=Clusterip extension
339 define Package
/iptables-mod-clusterip
/description
340 iptables extensions for CLUSTERIP.
341 The CLUSTERIP target allows you to build load-balancing clusters of
342 network servers without having a dedicated load-balancing
343 router
/server
/switch.
345 If you select it
, it enables kmod-ipt-clusterip.
347 see
`iptables -j CLUSTERIP --help` for more information.
350 define Package
/iptables-mod-extra
351 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
352 TITLE
:=Other extra iptables extensions
355 define Package
/iptables-mod-extra
/description
356 Other extra iptables extensions.
367 define Package
/iptables-mod-physdev
368 $(call Package
/iptables
/Module
, +kmod-ipt-physdev
)
369 TITLE
:=physdev iptables extension
372 define Package
/iptables-mod-physdev
/description
373 The iptables physdev match.
376 define Package
/iptables-mod-led
377 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
378 TITLE
:=LED trigger iptables extension
381 define Package
/iptables-mod-led
/description
382 iptables extension for triggering a LED.
389 define Package
/iptables-mod-tproxy
390 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
391 TITLE
:=Transparent proxy iptables extensions
394 define Package
/iptables-mod-tproxy
/description
395 Transparent proxy iptables extensions.
405 define Package
/iptables-mod-tee
406 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
407 TITLE
:=TEE iptables extensions
410 define Package
/iptables-mod-tee
/description
411 TEE iptables extensions.
418 define Package
/iptables-mod-u32
419 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
420 TITLE
:=U32 iptables extensions
423 define Package
/iptables-mod-u32
/description
424 U32 iptables extensions.
431 define Package
/iptables-mod-checksum
432 $(call Package
/iptables
/Module
, +kmod-ipt-checksum
)
433 TITLE
:=IP CHECKSUM target extension
436 define Package
/iptables-mod-checksum
/description
437 iptables extension for the CHECKSUM calculation target
440 define Package
/ip6tables
441 $(call Package
/iptables
/Default
)
442 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
444 TITLE
:=IPv6 firewall administration tool
446 200:/usr
/sbin
/ip6tables
:/usr
/sbin
/xtables-legacy-multi \
447 200:/usr
/sbin
/ip6tables-restore
:/usr
/sbin
/xtables-legacy-multi \
448 200:/usr
/sbin
/ip6tables-save
:/usr
/sbin
/xtables-legacy-multi
451 define Package
/ip6tables-nft
452 $(call Package
/iptables
/Default
)
453 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables-nft
454 TITLE
:=IP firewall administration tool nft
456 300:/usr
/sbin
/ip6tables
:/usr
/sbin
/xtables-nft-multi \
457 300:/usr
/sbin
/ip6tables-restore
:/usr
/sbin
/xtables-nft-multi \
458 300:/usr
/sbin
/ip6tables-save
:/usr
/sbin
/xtables-nft-multi
461 define Package
/ip6tables-nft
/description
462 Extra ip6tables nftables nft binaries.
464 ip6tables-nft-restore
467 ip6tables-restore-translate
470 define Package
/ip6tables-extra
471 $(call Package
/iptables
/Default
)
472 DEPENDS
:=+libxtables
+kmod-ip6tables-extra
473 TITLE
:=IPv6 header matching modules
476 define Package
/ip6tables-extra
/description
477 iptables header matching modules for IPv6
480 define Package
/ip6tables-mod-nat
481 $(call Package
/iptables
/Default
)
482 DEPENDS
:=+libxtables
+kmod-ipt-nat6
483 TITLE
:=IPv6 NAT extensions
486 define Package
/ip6tables-mod-nat
/description
487 iptables extensions for IPv6-NAT targets.
490 define Package
/libip4tc
491 $(call Package
/iptables
/Default
)
494 TITLE
:=IPv4 firewall
- shared libiptc library
499 define Package
/libip6tc
500 $(call Package
/iptables
/Default
)
503 TITLE
:=IPv6 firewall
- shared libiptc library
508 define Package
/libxtables
509 $(call Package
/iptables
/Default
)
512 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
515 DEPENDS
:=+IPTABLES_CONNLABEL
:libnetfilter-conntrack
518 define Package
/libxtables
/config
519 config IPTABLES_CONNLABEL
520 bool
"Enable Connlabel support"
523 This enable connlabel support in iptables.
525 config IPTABLES_NFTABLES
526 bool
"Enable Nftables support"
529 This enable nftables support in iptables.
532 define Package
/libxtables-nft
533 $(call Package
/iptables
/Default
)
536 TITLE
:=IPv4
/IPv6 firewall
- shared xtables nft library
538 DEPENDS
:=@IPTABLES_NFTABLES
+libxtables
542 -I
$(PKG_BUILD_DIR
)/include \
543 -I
$(LINUX_DIR
)/user_headers
/include \
547 -I
$(PKG_BUILD_DIR
)/include \
548 -I
$(LINUX_DIR
)/user_headers
/include \
549 -ffunction-sections
-fdata-sections \
559 --with-kernel
="$(LINUX_DIR)/user_headers" \
560 --with-xtlibdir
=/usr
/lib
/iptables \
561 --with-xt-lock-name
=/var
/run
/xtables.lock \
562 $(if
$(CONFIG_IPTABLES_CONNLABEL
),,--disable-connlabel
) \
563 $(if
$(CONFIG_IPTABLES_NFTABLES
),,--disable-nftables
) \
564 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
567 $(TARGET_CONFIGURE_OPTS
) \
568 COPT_FLAGS
="$(TARGET_CFLAGS)" \
569 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
570 KBUILD_OUTPUT
="$(LINUX_DIR)" \
571 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
573 ifneq ($(wildcard $(PKG_BUILD_DIR
)/.config_
*),$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
)))
574 define Build
/Configure
/rebuild
575 $(FIND
) $(PKG_BUILD_DIR
) -name \
*.o
-or
-name \
*.
\?o
-or
-name \
*.a |
$(XARGS
) rm -f
576 rm -f
$(PKG_BUILD_DIR
)/.config_
*
577 rm -f
$(PKG_BUILD_DIR
)/.configured_
*
578 touch
$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
))
582 define Build
/Configure
583 $(Build
/Configure
/rebuild
)
584 $(Build
/Configure
/Default
)
587 define Build
/InstallDev
588 $(INSTALL_DIR
) $(1)/usr
/include
589 $(INSTALL_DIR
) $(1)/usr
/include/iptables
590 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
592 # XXX: iptables header fixup, some headers are not installed by iptables anymore
593 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
594 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
595 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
596 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
597 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
599 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
600 $(INSTALL_DIR
) $(1)/usr
/lib
601 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
602 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
603 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
604 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
605 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
607 # XXX: needed by firewall3
608 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext
*.so
$(1)/usr
/lib
/
611 define Package
/iptables
/install
612 $(INSTALL_DIR
) $(1)/usr
/sbin
613 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-legacy-multi
$(1)/usr
/sbin
/
614 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables-legacy
{,-restore
,-save
} $(1)/usr
/sbin
/
615 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
618 define Package
/iptables-nft
/install
619 $(INSTALL_DIR
) $(1)/usr
/sbin
620 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-nft-multi
$(1)/usr
/sbin
/
621 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables-nft
{,-restore
,-save
} $(1)/usr
/sbin
/
622 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
}-translate
$(1)/usr
/sbin
/
625 define Package
/ip6tables
/install
626 $(INSTALL_DIR
) $(1)/usr
/sbin
627 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables-legacy
{,-restore
,-save
} $(1)/usr
/sbin
/
630 define Package
/ip6tables-nft
/install
631 $(INSTALL_DIR
) $(1)/usr
/sbin
632 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables-nft
{,-restore
,-save
} $(1)/usr
/sbin
/
633 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
}-translate
$(1)/usr
/sbin
/
636 define Package
/libip4tc
/install
637 $(INSTALL_DIR
) $(1)/usr
/lib
638 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so.
* $(1)/usr
/lib
/
639 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext4.so
$(1)/usr
/lib
/
642 define Package
/libip6tc
/install
643 $(INSTALL_DIR
) $(1)/usr
/lib
644 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so.
* $(1)/usr
/lib
/
645 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext6.so
$(1)/usr
/lib
/
648 define Package
/libxtables
/install
649 $(INSTALL_DIR
) $(1)/usr
/lib
650 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so.
* $(1)/usr
/lib
/
651 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext.so
$(1)/usr
/lib
/
654 define Package
/libxtables-nft
/install
655 $(INSTALL_DIR
) $(1)/usr
/lib
656 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext_
*.so
$(1)/usr
/lib
/
660 define Package
/$(1)/install
661 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
662 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
663 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
664 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
670 $$(eval
$$(call BuildPackage
,$(1)))
673 $(eval
$(call BuildPackage
,libxtables
))
674 $(eval
$(call BuildPackage
,libxtables-nft
))
675 $(eval
$(call BuildPackage
,libip4tc
))
676 $(eval
$(call BuildPackage
,libip6tc
))
677 $(eval
$(call BuildPackage
,iptables
))
678 $(eval
$(call BuildPackage
,iptables-nft
))
679 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
680 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-label
,$(IPT_CONNTRACK_LABEL-m
)))
681 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
682 $(eval
$(call BuildPlugin
,iptables-mod-physdev
,$(IPT_PHYSDEV-m
)))
683 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
)))
684 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
685 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
686 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
687 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
688 $(eval
$(call BuildPlugin
,iptables-mod-cluster
,$(IPT_CLUSTER-m
)))
689 $(eval
$(call BuildPlugin
,iptables-mod-clusterip
,$(IPT_CLUSTERIP-m
)))
690 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
691 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
692 $(eval
$(call BuildPlugin
,iptables-mod-rpfilter
,$(IPT_RPFILTER-m
)))
693 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
694 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
695 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
696 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
697 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
698 $(eval
$(call BuildPlugin
,iptables-mod-trace
,$(IPT_DEBUG-m
)))
699 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
700 $(eval
$(call BuildPlugin
,iptables-mod-checksum
,$(IPT_CHECKSUM-m
)))
701 $(eval
$(call BuildPackage
,ip6tables
))
702 $(eval
$(call BuildPackage
,ip6tables-nft
))
703 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
704 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))