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
16 PKG_SOURCE_URL
:=https
://git.netfilter.org
/iptables
17 PKG_SOURCE_VERSION
:=c16bdec15137b241586310d0e61bc88cc3726004
18 PKG_MIRROR_HASH
:=72e4bec94a56dd600097846c773e1074ff705e38f800ef221db646c064371a53
26 PKG_CPE_ID
:=cpe
:/a
:netfilter_core_team
:iptables
28 include $(INCLUDE_DIR
)/package.mk
30 -include $(LINUX_DIR
)/.config
31 include $(INCLUDE_DIR
)/netfilter.mk
32 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell grep
'NETFILTER' $(LINUX_DIR
)/.config | mkhash md5
)
36 define Package
/iptables
/Default
40 URL
:=http
://netfilter.org
/
43 define Package
/iptables
/Module
44 $(call Package
/iptables
/Default
)
45 DEPENDS
:=iptables
$(1)
48 define Package
/iptables
49 $(call Package
/iptables
/Default
)
50 TITLE
:=IP firewall administration tool
52 DEPENDS
+= +kmod-ipt-core
+libip4tc
+IPV6
:libip6tc
+libxtables
55 define Package
/iptables
/config
56 config IPTABLES_CONNLABEL
57 bool
"Enable Connlabel support"
60 This enable connlabel support in iptables.
62 config IPTABLES_NFTABLES
63 bool
"Enable Nftables support"
66 This enable nftables support in iptables.
69 define Package
/iptables
/description
70 IP firewall administration tool.
109 define Package
/iptables-mod-conntrack-extra
110 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
111 TITLE
:=Extra connection tracking extensions
114 define Package
/iptables-mod-conntrack-extra
/description
115 Extra iptables extensions for connection tracking.
129 define Package
/iptables-mod-conntrack-label
130 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-label @IPTABLES_CONNLABEL
)
131 TITLE
:=Connection tracking labeling extension
132 DEFAULT
:=y if IPTABLES_CONNLABEL
135 define Package
/iptables-mod-conntrack-label
/description
136 Match and set label
(s
) on connection tracking entries
143 define Package
/iptables-mod-filter
144 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
145 TITLE
:=Content inspection extensions
148 define Package
/iptables-mod-filter
/description
149 iptables extensions for packet content inspection.
150 Includes support for
:
157 define Package
/iptables-mod-ipopt
158 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
159 TITLE
:=IP
/Packet option extensions
162 define Package
/iptables-mod-ipopt
/description
163 iptables extensions for matching
/changing IP packet options.
182 define Package
/iptables-mod-ipsec
183 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
184 TITLE
:=IPsec extensions
187 define Package
/iptables-mod-ipsec
/description
188 iptables extensions for matching ipsec traffic.
197 define Package
/iptables-mod-nat-extra
198 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
199 TITLE
:=Extra NAT extensions
202 define Package
/iptables-mod-nat-extra
/description
203 iptables extensions for extra NAT targets.
210 define Package
/iptables-mod-ulog
211 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
212 TITLE
:=user-space packet logging
215 define Package
/iptables-mod-ulog
/description
216 iptables extensions for user-space packet logging.
223 define Package
/iptables-mod-nflog
224 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
225 TITLE
:=Netfilter NFLOG target
228 define Package
/iptables-mod-nflog
/description
229 iptables extension for user-space logging via NFNETLINK.
236 define Package
/iptables-mod-trace
237 $(call Package
/iptables
/Module
, +kmod-ipt-debug
)
238 TITLE
:=Netfilter TRACE target
241 define Package
/iptables-mod-trace
/description
242 iptables extension for TRACE target
250 define Package
/iptables-mod-nfqueue
251 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
252 TITLE
:=Netfilter NFQUEUE target
255 define Package
/iptables-mod-nfqueue
/description
256 iptables extension for user-space queuing via NFNETLINK.
263 define Package
/iptables-mod-hashlimit
264 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
265 TITLE
:=hashlimit matching
268 define Package
/iptables-mod-hashlimit
/description
269 iptables extensions for hashlimit matching
276 define Package
/iptables-mod-rpfilter
277 $(call Package
/iptables
/Module
, +kmod-ipt-rpfilter
)
278 TITLE
:=rpfilter iptables extension
281 define Package
/iptables-mod-rpfilter
/description
282 iptables extensions for reverse path
filter test on a packet
289 define Package
/iptables-mod-iprange
290 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
291 TITLE
:=IP range extension
294 define Package
/iptables-mod-iprange
/description
295 iptables extensions for matching ip ranges.
302 define Package
/iptables-mod-cluster
303 $(call Package
/iptables
/Module
, +kmod-ipt-cluster
)
304 TITLE
:=Match cluster extension
307 define Package
/iptables-mod-cluster
/description
308 iptables extensions for matching cluster.
310 Netfilter
(IPv4
/IPv6
) module for matching cluster
311 This option allows you to build work-load-sharing clusters of
312 network servers
/stateful firewalls without having a dedicated
313 load-balancing router
/server
/switch. Basically
, this match returns
314 true when the packet must be handled by this cluster node. Thus
,
315 all nodes see
all packets and this match decides which node handles
316 what packets. The work-load sharing algorithm is based on source
319 This module is usable for ipv4 and ipv6.
321 If you select it
, it enables kmod-ipt-cluster.
323 see
`iptables -m cluster --help` for more information.
326 define Package
/iptables-mod-clusterip
327 $(call Package
/iptables
/Module
, +kmod-ipt-clusterip
)
328 TITLE
:=Clusterip extension
331 define Package
/iptables-mod-clusterip
/description
332 iptables extensions for CLUSTERIP.
333 The CLUSTERIP target allows you to build load-balancing clusters of
334 network servers without having a dedicated load-balancing
335 router
/server
/switch.
337 If you select it
, it enables kmod-ipt-clusterip.
339 see
`iptables -j CLUSTERIP --help` for more information.
342 define Package
/iptables-mod-extra
343 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
344 TITLE
:=Other extra iptables extensions
347 define Package
/iptables-mod-extra
/description
348 Other extra iptables extensions.
359 define Package
/iptables-mod-physdev
360 $(call Package
/iptables
/Module
, +kmod-ipt-physdev
)
361 TITLE
:=physdev iptables extension
364 define Package
/iptables-mod-physdev
/description
365 The iptables physdev match.
368 define Package
/iptables-mod-led
369 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
370 TITLE
:=LED trigger iptables extension
373 define Package
/iptables-mod-led
/description
374 iptables extension for triggering a LED.
381 define Package
/iptables-mod-tproxy
382 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
383 TITLE
:=Transparent proxy iptables extensions
386 define Package
/iptables-mod-tproxy
/description
387 Transparent proxy iptables extensions.
397 define Package
/iptables-mod-tee
398 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
399 TITLE
:=TEE iptables extensions
402 define Package
/iptables-mod-tee
/description
403 TEE iptables extensions.
410 define Package
/iptables-mod-u32
411 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
412 TITLE
:=U32 iptables extensions
415 define Package
/iptables-mod-u32
/description
416 U32 iptables extensions.
423 define Package
/iptables-mod-checksum
424 $(call Package
/iptables
/Module
, +kmod-ipt-checksum
)
425 TITLE
:=IP CHECKSUM target extension
428 define Package
/iptables-mod-checksum
/description
429 iptables extension for the CHECKSUM calculation target
432 define Package
/ip6tables
433 $(call Package
/iptables
/Default
)
434 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
436 TITLE
:=IPv6 firewall administration tool
441 define Package
/ip6tables-extra
442 $(call Package
/iptables
/Default
)
443 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
444 TITLE
:=IPv6 header matching modules
447 define Package
/ip6tables-mod-extra
/description
448 iptables header matching modules for IPv6
451 define Package
/ip6tables-mod-nat
452 $(call Package
/iptables
/Default
)
453 DEPENDS
:=ip6tables
+kmod-ipt-nat6
454 TITLE
:=IPv6 NAT extensions
457 define Package
/ip6tables-mod-nat
/description
458 iptables extensions for IPv6-NAT targets.
461 define Package
/libiptc
462 $(call Package
/iptables
/Default
)
465 DEPENDS
:=+libip4tc
+libip6tc
+libxtables
466 ABI_VERSION
:=$(PKG_VERSION
)
467 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
470 define Package
/libip4tc
471 $(call Package
/iptables
/Default
)
474 TITLE
:=IPv4 firewall
- shared libiptc library
475 ABI_VERSION
:=$(PKG_VERSION
)
479 define Package
/libip6tc
480 $(call Package
/iptables
/Default
)
483 TITLE
:=IPv6 firewall
- shared libiptc library
484 ABI_VERSION
:=$(PKG_VERSION
)
488 define Package
/libxtables
489 $(call Package
/iptables
/Default
)
492 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
493 ABI_VERSION
:=$(PKG_VERSION
)
495 +IPTABLES_CONNLABEL
:libnetfilter-conntrack \
496 +IPTABLES_NFTABLES
:libnftnl
500 -I
$(PKG_BUILD_DIR
)/include \
501 -I
$(LINUX_DIR
)/user_headers
/include \
505 -I
$(PKG_BUILD_DIR
)/include \
506 -I
$(LINUX_DIR
)/user_headers
/include \
507 -ffunction-sections
-fdata-sections \
517 --with-kernel
="$(LINUX_DIR)/user_headers" \
518 --with-xtlibdir
=/usr
/lib
/iptables \
519 --with-xt-lock-name
=/var
/run
/xtables.lock \
520 $(if
$(CONFIG_IPTABLES_CONNLABEL
),,--disable-connlabel
) \
521 $(if
$(CONFIG_IPTABLES_NFTABLES
),,--disable-nftables
) \
522 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
525 $(TARGET_CONFIGURE_OPTS
) \
526 COPT_FLAGS
="$(TARGET_CFLAGS)" \
527 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
528 KBUILD_OUTPUT
="$(LINUX_DIR)" \
529 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
531 ifneq ($(wildcard $(PKG_BUILD_DIR
)/.config_
*),$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
)))
532 define Build
/Configure
/rebuild
533 $(FIND
) $(PKG_BUILD_DIR
) -name \
*.o
-or
-name \
*.
\?o
-or
-name \
*.a |
$(XARGS
) rm -f
534 rm -f
$(PKG_BUILD_DIR
)/.config_
*
535 rm -f
$(PKG_BUILD_DIR
)/.configured_
*
536 touch
$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
))
540 define Build
/Configure
541 $(Build
/Configure
/rebuild
)
542 $(Build
/Configure
/Default
)
545 define Build
/InstallDev
546 $(INSTALL_DIR
) $(1)/usr
/include
547 $(INSTALL_DIR
) $(1)/usr
/include/iptables
548 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
550 # XXX: iptables header fixup, some headers are not installed by iptables anymore
551 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
552 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
553 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
554 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
555 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
557 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
558 $(INSTALL_DIR
) $(1)/usr
/lib
559 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
560 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
561 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
562 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
563 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
565 # XXX: needed by firewall3
566 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext
*.so
$(1)/usr
/lib
/
569 define Package
/iptables
/install
570 $(INSTALL_DIR
) $(1)/usr
/sbin
571 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
572 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
573 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
576 define Package
/ip6tables
/install
577 $(INSTALL_DIR
) $(1)/usr
/sbin
578 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
581 define Package
/libiptc
/install
582 $(INSTALL_DIR
) $(1)/usr
/lib
583 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
586 define Package
/libip4tc
/install
587 $(INSTALL_DIR
) $(1)/usr
/lib
588 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
589 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext4.so
$(1)/usr
/lib
/
592 define Package
/libip6tc
/install
593 $(INSTALL_DIR
) $(1)/usr
/lib
594 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
595 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext6.so
$(1)/usr
/lib
/
598 define Package
/libxtables
/install
599 $(INSTALL_DIR
) $(1)/usr
/lib
600 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
601 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext.so
$(1)/usr
/lib
/
605 define Package
/$(1)/install
606 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
607 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
608 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
609 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
615 $$(eval
$$(call BuildPackage
,$(1)))
618 $(eval
$(call BuildPackage
,iptables
))
619 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
620 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-label
,$(IPT_CONNTRACK_LABEL-m
)))
621 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
622 $(eval
$(call BuildPlugin
,iptables-mod-physdev
,$(IPT_PHYSDEV-m
)))
623 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
)))
624 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
625 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
626 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
627 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
628 $(eval
$(call BuildPlugin
,iptables-mod-cluster
,$(IPT_CLUSTER-m
)))
629 $(eval
$(call BuildPlugin
,iptables-mod-clusterip
,$(IPT_CLUSTERIP-m
)))
630 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
631 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
632 $(eval
$(call BuildPlugin
,iptables-mod-rpfilter
,$(IPT_RPFILTER-m
)))
633 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
634 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
635 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
636 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
637 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
638 $(eval
$(call BuildPlugin
,iptables-mod-trace
,$(IPT_DEBUG-m
)))
639 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
640 $(eval
$(call BuildPlugin
,iptables-mod-checksum
,$(IPT_CHECKSUM-m
)))
641 $(eval
$(call BuildPackage
,ip6tables
))
642 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
643 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))
644 $(eval
$(call BuildPackage
,libiptc
))
645 $(eval
$(call BuildPackage
,libip4tc
))
646 $(eval
$(call BuildPackage
,libip6tc
))
647 $(eval
$(call BuildPackage
,libxtables
))