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
:
158 define Package
/iptables-mod-ipopt
159 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
160 TITLE
:=IP
/Packet option extensions
163 define Package
/iptables-mod-ipopt
/description
164 iptables extensions for matching
/changing IP packet options.
183 define Package
/iptables-mod-ipsec
184 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
185 TITLE
:=IPsec extensions
188 define Package
/iptables-mod-ipsec
/description
189 iptables extensions for matching ipsec traffic.
198 define Package
/iptables-mod-nat-extra
199 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
200 TITLE
:=Extra NAT extensions
203 define Package
/iptables-mod-nat-extra
/description
204 iptables extensions for extra NAT targets.
211 define Package
/iptables-mod-ulog
212 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
213 TITLE
:=user-space packet logging
216 define Package
/iptables-mod-ulog
/description
217 iptables extensions for user-space packet logging.
224 define Package
/iptables-mod-nflog
225 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
226 TITLE
:=Netfilter NFLOG target
229 define Package
/iptables-mod-nflog
/description
230 iptables extension for user-space logging via NFNETLINK.
237 define Package
/iptables-mod-trace
238 $(call Package
/iptables
/Module
, +kmod-ipt-debug
)
239 TITLE
:=Netfilter TRACE target
242 define Package
/iptables-mod-trace
/description
243 iptables extension for TRACE target
251 define Package
/iptables-mod-nfqueue
252 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
253 TITLE
:=Netfilter NFQUEUE target
256 define Package
/iptables-mod-nfqueue
/description
257 iptables extension for user-space queuing via NFNETLINK.
264 define Package
/iptables-mod-hashlimit
265 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
266 TITLE
:=hashlimit matching
269 define Package
/iptables-mod-hashlimit
/description
270 iptables extensions for hashlimit matching
277 define Package
/iptables-mod-rpfilter
278 $(call Package
/iptables
/Module
, +kmod-ipt-rpfilter
)
279 TITLE
:=rpfilter iptables extension
282 define Package
/iptables-mod-rpfilter
/description
283 iptables extensions for reverse path
filter test on a packet
290 define Package
/iptables-mod-iprange
291 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
292 TITLE
:=IP range extension
295 define Package
/iptables-mod-iprange
/description
296 iptables extensions for matching ip ranges.
303 define Package
/iptables-mod-cluster
304 $(call Package
/iptables
/Module
, +kmod-ipt-cluster
)
305 TITLE
:=Match cluster extension
308 define Package
/iptables-mod-cluster
/description
309 iptables extensions for matching cluster.
311 Netfilter
(IPv4
/IPv6
) module for matching cluster
312 This option allows you to build work-load-sharing clusters of
313 network servers
/stateful firewalls without having a dedicated
314 load-balancing router
/server
/switch. Basically
, this match returns
315 true when the packet must be handled by this cluster node. Thus
,
316 all nodes see
all packets and this match decides which node handles
317 what packets. The work-load sharing algorithm is based on source
320 This module is usable for ipv4 and ipv6.
322 If you select it
, it enables kmod-ipt-cluster.
324 see
`iptables -m cluster --help` for more information.
327 define Package
/iptables-mod-clusterip
328 $(call Package
/iptables
/Module
, +kmod-ipt-clusterip
)
329 TITLE
:=Clusterip extension
332 define Package
/iptables-mod-clusterip
/description
333 iptables extensions for CLUSTERIP.
334 The CLUSTERIP target allows you to build load-balancing clusters of
335 network servers without having a dedicated load-balancing
336 router
/server
/switch.
338 If you select it
, it enables kmod-ipt-clusterip.
340 see
`iptables -j CLUSTERIP --help` for more information.
343 define Package
/iptables-mod-extra
344 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
345 TITLE
:=Other extra iptables extensions
348 define Package
/iptables-mod-extra
/description
349 Other extra iptables extensions.
360 define Package
/iptables-mod-physdev
361 $(call Package
/iptables
/Module
, +kmod-ipt-physdev
)
362 TITLE
:=physdev iptables extension
365 define Package
/iptables-mod-physdev
/description
366 The iptables physdev match.
369 define Package
/iptables-mod-led
370 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
371 TITLE
:=LED trigger iptables extension
374 define Package
/iptables-mod-led
/description
375 iptables extension for triggering a LED.
382 define Package
/iptables-mod-tproxy
383 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
384 TITLE
:=Transparent proxy iptables extensions
387 define Package
/iptables-mod-tproxy
/description
388 Transparent proxy iptables extensions.
398 define Package
/iptables-mod-tee
399 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
400 TITLE
:=TEE iptables extensions
403 define Package
/iptables-mod-tee
/description
404 TEE iptables extensions.
411 define Package
/iptables-mod-u32
412 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
413 TITLE
:=U32 iptables extensions
416 define Package
/iptables-mod-u32
/description
417 U32 iptables extensions.
424 define Package
/iptables-mod-checksum
425 $(call Package
/iptables
/Module
, +kmod-ipt-checksum
)
426 TITLE
:=IP CHECKSUM target extension
429 define Package
/iptables-mod-checksum
/description
430 iptables extension for the CHECKSUM calculation target
433 define Package
/ip6tables
434 $(call Package
/iptables
/Default
)
435 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
437 TITLE
:=IPv6 firewall administration tool
442 define Package
/ip6tables-extra
443 $(call Package
/iptables
/Default
)
444 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
445 TITLE
:=IPv6 header matching modules
448 define Package
/ip6tables-mod-extra
/description
449 iptables header matching modules for IPv6
452 define Package
/ip6tables-mod-nat
453 $(call Package
/iptables
/Default
)
454 DEPENDS
:=ip6tables
+kmod-ipt-nat6
455 TITLE
:=IPv6 NAT extensions
458 define Package
/ip6tables-mod-nat
/description
459 iptables extensions for IPv6-NAT targets.
462 define Package
/libiptc
463 $(call Package
/iptables
/Default
)
466 DEPENDS
:=+libip4tc
+libip6tc
+libxtables
467 ABI_VERSION
:=$(PKG_VERSION
)
468 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
471 define Package
/libip4tc
472 $(call Package
/iptables
/Default
)
475 TITLE
:=IPv4 firewall
- shared libiptc library
476 ABI_VERSION
:=$(PKG_VERSION
)
480 define Package
/libip6tc
481 $(call Package
/iptables
/Default
)
484 TITLE
:=IPv6 firewall
- shared libiptc library
485 ABI_VERSION
:=$(PKG_VERSION
)
489 define Package
/libxtables
490 $(call Package
/iptables
/Default
)
493 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
494 ABI_VERSION
:=$(PKG_VERSION
)
496 +IPTABLES_CONNLABEL
:libnetfilter-conntrack \
497 +IPTABLES_NFTABLES
:libnftnl
501 -I
$(PKG_BUILD_DIR
)/include \
502 -I
$(LINUX_DIR
)/user_headers
/include \
506 -I
$(PKG_BUILD_DIR
)/include \
507 -I
$(LINUX_DIR
)/user_headers
/include \
508 -ffunction-sections
-fdata-sections \
518 --with-kernel
="$(LINUX_DIR)/user_headers" \
519 --with-xtlibdir
=/usr
/lib
/iptables \
520 --with-xt-lock-name
=/var
/run
/xtables.lock \
521 $(if
$(CONFIG_IPTABLES_CONNLABEL
),,--disable-connlabel
) \
522 $(if
$(CONFIG_IPTABLES_NFTABLES
),,--disable-nftables
) \
523 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
526 $(TARGET_CONFIGURE_OPTS
) \
527 COPT_FLAGS
="$(TARGET_CFLAGS)" \
528 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
529 KBUILD_OUTPUT
="$(LINUX_DIR)" \
530 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
532 ifneq ($(wildcard $(PKG_BUILD_DIR
)/.config_
*),$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
)))
533 define Build
/Configure
/rebuild
534 $(FIND
) $(PKG_BUILD_DIR
) -name \
*.o
-or
-name \
*.
\?o
-or
-name \
*.a |
$(XARGS
) rm -f
535 rm -f
$(PKG_BUILD_DIR
)/.config_
*
536 rm -f
$(PKG_BUILD_DIR
)/.configured_
*
537 touch
$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
))
541 define Build
/Configure
542 $(Build
/Configure
/rebuild
)
543 $(Build
/Configure
/Default
)
546 define Build
/InstallDev
547 $(INSTALL_DIR
) $(1)/usr
/include
548 $(INSTALL_DIR
) $(1)/usr
/include/iptables
549 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
551 # XXX: iptables header fixup, some headers are not installed by iptables anymore
552 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
553 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
554 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
555 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
556 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
558 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
559 $(INSTALL_DIR
) $(1)/usr
/lib
560 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
561 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
562 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
563 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
564 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
566 # XXX: needed by firewall3
567 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext
*.so
$(1)/usr
/lib
/
570 define Package
/iptables
/install
571 $(INSTALL_DIR
) $(1)/usr
/sbin
572 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
573 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
574 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
577 define Package
/ip6tables
/install
578 $(INSTALL_DIR
) $(1)/usr
/sbin
579 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
582 define Package
/libiptc
/install
583 $(INSTALL_DIR
) $(1)/usr
/lib
584 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
587 define Package
/libip4tc
/install
588 $(INSTALL_DIR
) $(1)/usr
/lib
589 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
590 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext4.so
$(1)/usr
/lib
/
593 define Package
/libip6tc
/install
594 $(INSTALL_DIR
) $(1)/usr
/lib
595 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
596 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext6.so
$(1)/usr
/lib
/
599 define Package
/libxtables
/install
600 $(INSTALL_DIR
) $(1)/usr
/lib
601 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
602 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext.so
$(1)/usr
/lib
/
606 define Package
/$(1)/install
607 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
608 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
609 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
610 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
616 $$(eval
$$(call BuildPackage
,$(1)))
619 $(eval
$(call BuildPackage
,iptables
))
620 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
621 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-label
,$(IPT_CONNTRACK_LABEL-m
)))
622 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
623 $(eval
$(call BuildPlugin
,iptables-mod-physdev
,$(IPT_PHYSDEV-m
)))
624 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
)))
625 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
626 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
627 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
628 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
629 $(eval
$(call BuildPlugin
,iptables-mod-cluster
,$(IPT_CLUSTER-m
)))
630 $(eval
$(call BuildPlugin
,iptables-mod-clusterip
,$(IPT_CLUSTERIP-m
)))
631 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
632 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
633 $(eval
$(call BuildPlugin
,iptables-mod-rpfilter
,$(IPT_RPFILTER-m
)))
634 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
635 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
636 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
637 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
638 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
639 $(eval
$(call BuildPlugin
,iptables-mod-trace
,$(IPT_DEBUG-m
)))
640 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
641 $(eval
$(call BuildPlugin
,iptables-mod-checksum
,$(IPT_CHECKSUM-m
)))
642 $(eval
$(call BuildPackage
,ip6tables
))
643 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
644 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))
645 $(eval
$(call BuildPackage
,libiptc
))
646 $(eval
$(call BuildPackage
,libip4tc
))
647 $(eval
$(call BuildPackage
,libip6tc
))
648 $(eval
$(call BuildPackage
,libxtables
))