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
:=7df66f1c13563cfbab75246b009ce36f69ee4487
18 PKG_MIRROR_HASH
:=22f15ef41fd8e3724bedcee666b7b6a3491d2d038d580ef1fb032718dcb73f14
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
:=http
://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.
107 define Package
/iptables-mod-conntrack-extra
108 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
109 TITLE
:=Extra connection tracking extensions
112 define Package
/iptables-mod-conntrack-extra
/description
113 Extra iptables extensions for connection tracking.
127 define Package
/iptables-mod-filter
128 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
129 TITLE
:=Content inspection extensions
132 define Package
/iptables-mod-filter
/description
133 iptables extensions for packet content inspection.
134 Includes support for
:
141 define Package
/iptables-mod-ipopt
142 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
143 TITLE
:=IP
/Packet option extensions
146 define Package
/iptables-mod-ipopt
/description
147 iptables extensions for matching
/changing IP packet options.
166 define Package
/iptables-mod-ipsec
167 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
168 TITLE
:=IPsec extensions
171 define Package
/iptables-mod-ipsec
/description
172 iptables extensions for matching ipsec traffic.
181 define Package
/iptables-mod-nat-extra
182 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
183 TITLE
:=Extra NAT extensions
186 define Package
/iptables-mod-nat-extra
/description
187 iptables extensions for extra NAT targets.
194 define Package
/iptables-mod-ulog
195 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
196 TITLE
:=user-space packet logging
199 define Package
/iptables-mod-ulog
/description
200 iptables extensions for user-space packet logging.
207 define Package
/iptables-mod-nflog
208 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
209 TITLE
:=Netfilter NFLOG target
212 define Package
/iptables-mod-nflog
/description
213 iptables extension for user-space logging via NFNETLINK.
220 define Package
/iptables-mod-trace
221 $(call Package
/iptables
/Module
, +kmod-ipt-debug
+kmod-ipt-raw
)
222 TITLE
:=Netfilter TRACE target
225 define Package
/iptables-mod-trace
/description
226 iptables extension for TRACE target
234 define Package
/iptables-mod-nfqueue
235 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
236 TITLE
:=Netfilter NFQUEUE target
239 define Package
/iptables-mod-nfqueue
/description
240 iptables extension for user-space queuing via NFNETLINK.
247 define Package
/iptables-mod-hashlimit
248 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
249 TITLE
:=hashlimit matching
252 define Package
/iptables-mod-hashlimit
/description
253 iptables extensions for hashlimit matching
260 define Package
/iptables-mod-rpfilter
261 $(call Package
/iptables
/Module
, +kmod-ipt-rpfilter
)
262 TITLE
:=rpfilter iptables extension
265 define Package
/iptables-mod-rpfilter
/description
266 iptables extensions for reverse path
filter test on a packet
273 define Package
/iptables-mod-iprange
274 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
275 TITLE
:=IP range extension
278 define Package
/iptables-mod-iprange
/description
279 iptables extensions for matching ip ranges.
286 define Package
/iptables-mod-cluster
287 $(call Package
/iptables
/Module
, +kmod-ipt-cluster
)
288 TITLE
:=Match cluster extension
291 define Package
/iptables-mod-cluster
/description
292 iptables extensions for matching cluster.
294 Netfilter
(IPv4
/IPv6
) module for matching cluster
295 This option allows you to build work-load-sharing clusters of
296 network servers
/stateful firewalls without having a dedicated
297 load-balancing router
/server
/switch. Basically
, this match returns
298 true when the packet must be handled by this cluster node. Thus
,
299 all nodes see
all packets and this match decides which node handles
300 what packets. The work-load sharing algorithm is based on source
303 This module is usable for ipv4 and ipv6.
305 If you select it
, it enables kmod-ipt-cluster.
307 see
`iptables -m cluster --help` for more information.
310 define Package
/iptables-mod-clusterip
311 $(call Package
/iptables
/Module
, +kmod-ipt-clusterip
)
312 TITLE
:=Clusterip extension
315 define Package
/iptables-mod-clusterip
/description
316 iptables extensions for CLUSTERIP.
317 The CLUSTERIP target allows you to build load-balancing clusters of
318 network servers without having a dedicated load-balancing
319 router
/server
/switch.
321 If you select it
, it enables kmod-ipt-clusterip.
323 see
`iptables -j CLUSTERIP --help` for more information.
326 define Package
/iptables-mod-extra
327 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
328 TITLE
:=Other extra iptables extensions
331 define Package
/iptables-mod-extra
/description
332 Other extra iptables extensions.
338 - physdev
(if ebtables is enabled
)
344 define Package
/iptables-mod-led
345 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
346 TITLE
:=LED trigger iptables extension
349 define Package
/iptables-mod-led
/description
350 iptables extension for triggering a LED.
357 define Package
/iptables-mod-tproxy
358 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
359 TITLE
:=Transparent proxy iptables extensions
362 define Package
/iptables-mod-tproxy
/description
363 Transparent proxy iptables extensions.
373 define Package
/iptables-mod-tee
374 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
375 TITLE
:=TEE iptables extensions
378 define Package
/iptables-mod-tee
/description
379 TEE iptables extensions.
386 define Package
/iptables-mod-u32
387 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
388 TITLE
:=U32 iptables extensions
391 define Package
/iptables-mod-u32
/description
392 U32 iptables extensions.
399 define Package
/iptables-mod-checksum
400 $(call Package
/iptables
/Module
, +kmod-ipt-checksum
)
401 TITLE
:=IP CHECKSUM target extension
404 define Package
/iptables-mod-checksum
/description
405 iptables extension for the CHECKSUM calculation target
408 define Package
/ip6tables
409 $(call Package
/iptables
/Default
)
410 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
412 TITLE
:=IPv6 firewall administration tool
417 define Package
/ip6tables-extra
418 $(call Package
/iptables
/Default
)
419 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
420 TITLE
:=IPv6 header matching modules
423 define Package
/ip6tables-mod-extra
/description
424 iptables header matching modules for IPv6
427 define Package
/ip6tables-mod-nat
428 $(call Package
/iptables
/Default
)
429 DEPENDS
:=ip6tables
+kmod-ipt-nat6
430 TITLE
:=IPv6 NAT extensions
433 define Package
/ip6tables-mod-nat
/description
434 iptables extensions for IPv6-NAT targets.
437 define Package
/libiptc
438 $(call Package
/iptables
/Default
)
441 DEPENDS
:=+libip4tc
+libip6tc
+libxtables
442 ABI_VERSION
:=$(PKG_VERSION
)
443 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
446 define Package
/libip4tc
447 $(call Package
/iptables
/Default
)
450 TITLE
:=IPv4 firewall
- shared libiptc library
451 ABI_VERSION
:=$(PKG_VERSION
)
455 define Package
/libip6tc
456 $(call Package
/iptables
/Default
)
459 TITLE
:=IPv6 firewall
- shared libiptc library
460 ABI_VERSION
:=$(PKG_VERSION
)
464 define Package
/libxtables
465 $(call Package
/iptables
/Default
)
468 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
469 ABI_VERSION
:=$(PKG_VERSION
)
471 +IPTABLES_CONNLABEL
:libnetfilter-conntrack \
472 +IPTABLES_NFTABLES
:libnftnl
476 -I
$(PKG_BUILD_DIR
)/include \
477 -I
$(LINUX_DIR
)/user_headers
/include \
481 -I
$(PKG_BUILD_DIR
)/include \
482 -I
$(LINUX_DIR
)/user_headers
/include \
483 -ffunction-sections
-fdata-sections \
493 --with-kernel
="$(LINUX_DIR)/user_headers" \
494 --with-xtlibdir
=/usr
/lib
/iptables \
495 $(if
$(CONFIG_IPTABLES_CONNLABEL
),,--disable-connlabel
) \
496 $(if
$(CONFIG_IPTABLES_NFTABLES
),,--disable-nftables
) \
497 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
500 $(TARGET_CONFIGURE_OPTS
) \
501 COPT_FLAGS
="$(TARGET_CFLAGS)" \
502 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
503 KBUILD_OUTPUT
="$(LINUX_DIR)" \
504 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
506 ifneq ($(wildcard $(PKG_BUILD_DIR
)/.config_
*),$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
)))
507 define Build
/Configure
/rebuild
508 $(FIND
) $(PKG_BUILD_DIR
) -name \
*.o
-or
-name \
*.
\?o
-or
-name \
*.a |
$(XARGS
) rm -f
509 rm -f
$(PKG_BUILD_DIR
)/.config_
*
510 rm -f
$(PKG_BUILD_DIR
)/.configured_
*
511 touch
$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
))
515 define Build
/Configure
516 $(Build
/Configure
/rebuild
)
517 $(Build
/Configure
/Default
)
520 define Build
/InstallDev
521 $(INSTALL_DIR
) $(1)/usr
/include
522 $(INSTALL_DIR
) $(1)/usr
/include/iptables
523 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
525 # XXX: iptables header fixup, some headers are not installed by iptables anymore
526 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
527 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
528 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
529 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
530 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
532 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
533 $(INSTALL_DIR
) $(1)/usr
/lib
534 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
535 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
536 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
537 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
538 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
540 # XXX: needed by firewall3
541 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext
*.so
$(1)/usr
/lib
/
544 define Package
/iptables
/install
545 $(INSTALL_DIR
) $(1)/usr
/sbin
546 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
547 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
548 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
551 define Package
/ip6tables
/install
552 $(INSTALL_DIR
) $(1)/usr
/sbin
553 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
556 define Package
/libiptc
/install
557 $(INSTALL_DIR
) $(1)/usr
/lib
558 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
561 define Package
/libip4tc
/install
562 $(INSTALL_DIR
) $(1)/usr
/lib
563 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
564 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext4.so
$(1)/usr
/lib
/
567 define Package
/libip6tc
/install
568 $(INSTALL_DIR
) $(1)/usr
/lib
569 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
570 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext6.so
$(1)/usr
/lib
/
573 define Package
/libxtables
/install
574 $(INSTALL_DIR
) $(1)/usr
/lib
575 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
576 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext.so
$(1)/usr
/lib
/
580 define Package
/$(1)/install
581 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
582 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
583 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
584 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
590 $$(eval
$$(call BuildPackage
,$(1)))
593 $(eval
$(call BuildPackage
,iptables
))
594 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
595 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
596 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
)))
597 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
598 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
599 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
600 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
601 $(eval
$(call BuildPlugin
,iptables-mod-cluster
,$(IPT_CLUSTER-m
)))
602 $(eval
$(call BuildPlugin
,iptables-mod-clusterip
,$(IPT_CLUSTERIP-m
)))
603 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
604 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
605 $(eval
$(call BuildPlugin
,iptables-mod-rpfilter
,$(IPT_RPFILTER-m
)))
606 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
607 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
608 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
609 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
610 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
611 $(eval
$(call BuildPlugin
,iptables-mod-trace
,$(IPT_DEBUG-m
)))
612 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
613 $(eval
$(call BuildPlugin
,iptables-mod-checksum
,$(IPT_CHECKSUM-m
)))
614 $(eval
$(call BuildPackage
,ip6tables
))
615 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
616 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))
617 $(eval
$(call BuildPackage
,libiptc
))
618 $(eval
$(call BuildPackage
,libip4tc
))
619 $(eval
$(call BuildPackage
,libip6tc
))
620 $(eval
$(call BuildPackage
,libxtables
))