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
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
16 PKG_SOURCE_URL
:=http
://www.netfilter.org
/projects
/iptables
/files \
17 ftp
://ftp.be.netfilter.org
/pub
/netfilter
/iptables
/ \
18 ftp
://ftp.de.netfilter.org
/pub
/netfilter
/iptables
/ \
19 ftp
://ftp.no.netfilter.org
/pub
/netfilter
/iptables
/
20 PKG_HASH
:=52004c68021da9a599feed27f65defcfb22128f7da2c0531c0f75de0f479d3e0
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
/description
55 IP firewall administration tool.
93 define Package
/iptables-mod-conntrack-extra
94 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
95 TITLE
:=Extra connection tracking extensions
98 define Package
/iptables-mod-conntrack-extra
/description
99 Extra iptables extensions for connection tracking.
113 define Package
/iptables-mod-filter
114 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
115 TITLE
:=Content inspection extensions
118 define Package
/iptables-mod-filter
/description
119 iptables extensions for packet content inspection.
120 Includes support for
:
127 define Package
/iptables-mod-ipopt
128 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
129 TITLE
:=IP
/Packet option extensions
132 define Package
/iptables-mod-ipopt
/description
133 iptables extensions for matching
/changing IP packet options.
152 define Package
/iptables-mod-ipsec
153 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
154 TITLE
:=IPsec extensions
157 define Package
/iptables-mod-ipsec
/description
158 iptables extensions for matching ipsec traffic.
167 define Package
/iptables-mod-nat-extra
168 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
169 TITLE
:=Extra NAT extensions
172 define Package
/iptables-mod-nat-extra
/description
173 iptables extensions for extra NAT targets.
180 define Package
/iptables-mod-ulog
181 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
182 TITLE
:=user-space packet logging
185 define Package
/iptables-mod-ulog
/description
186 iptables extensions for user-space packet logging.
193 define Package
/iptables-mod-nflog
194 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
195 TITLE
:=Netfilter NFLOG target
198 define Package
/iptables-mod-nflog
/description
199 iptables extension for user-space logging via NFNETLINK.
206 define Package
/iptables-mod-nfqueue
207 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
208 TITLE
:=Netfilter NFQUEUE target
211 define Package
/iptables-mod-nfqueue
/description
212 iptables extension for user-space queuing via NFNETLINK.
219 define Package
/iptables-mod-hashlimit
220 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
221 TITLE
:=hashlimit matching
224 define Package
/iptables-mod-hashlimit
/description
225 iptables extensions for hashlimit matching
232 define Package
/iptables-mod-rpfilter
233 $(call Package
/iptables
/Module
, +kmod-ipt-rpfilter
)
234 TITLE
:=rpfilter iptables extension
237 define Package
/iptables-mod-rpfilter
/description
238 iptables extensions for reverse path
filter test on a packet
245 define Package
/iptables-mod-iprange
246 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
247 TITLE
:=IP range extension
250 define Package
/iptables-mod-iprange
/description
251 iptables extensions for matching ip ranges.
258 define Package
/iptables-mod-cluster
259 $(call Package
/iptables
/Module
, +kmod-ipt-cluster
)
260 TITLE
:=Match cluster extension
263 define Package
/iptables-mod-cluster
/description
264 iptables extensions for matching cluster.
266 Netfilter
(IPv4
/IPv6
) module for matching cluster
267 This option allows you to build work-load-sharing clusters of
268 network servers
/stateful firewalls without having a dedicated
269 load-balancing router
/server
/switch. Basically
, this match returns
270 true when the packet must be handled by this cluster node. Thus
,
271 all nodes see
all packets and this match decides which node handles
272 what packets. The work-load sharing algorithm is based on source
275 This module is usable for ipv4 and ipv6.
277 If you select it
, it enables kmod-ipt-cluster.
279 see
`iptables -m cluster --help` for more information.
282 define Package
/iptables-mod-clusterip
283 $(call Package
/iptables
/Module
, +kmod-ipt-clusterip
)
284 TITLE
:=Clusterip extension
287 define Package
/iptables-mod-clusterip
/description
288 iptables extensions for CLUSTERIP.
289 The CLUSTERIP target allows you to build load-balancing clusters of
290 network servers without having a dedicated load-balancing
291 router
/server
/switch.
293 If you select it
, it enables kmod-ipt-clusterip.
295 see
`iptables -j CLUSTERIP --help` for more information.
298 define Package
/iptables-mod-extra
299 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
300 TITLE
:=Other extra iptables extensions
303 define Package
/iptables-mod-extra
/description
304 Other extra iptables extensions.
310 - physdev
(if ebtables is enabled
)
316 define Package
/iptables-mod-led
317 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
318 TITLE
:=LED trigger iptables extension
321 define Package
/iptables-mod-led
/description
322 iptables extension for triggering a LED.
329 define Package
/iptables-mod-tproxy
330 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
331 TITLE
:=Transparent proxy iptables extensions
334 define Package
/iptables-mod-tproxy
/description
335 Transparent proxy iptables extensions.
345 define Package
/iptables-mod-tee
346 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
347 TITLE
:=TEE iptables extensions
350 define Package
/iptables-mod-tee
/description
351 TEE iptables extensions.
358 define Package
/iptables-mod-u32
359 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
360 TITLE
:=U32 iptables extensions
363 define Package
/iptables-mod-u32
/description
364 U32 iptables extensions.
371 define Package
/ip6tables
372 $(call Package
/iptables
/Default
)
373 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
375 TITLE
:=IPv6 firewall administration tool
380 define Package
/ip6tables-extra
381 $(call Package
/iptables
/Default
)
382 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
383 TITLE
:=IPv6 header matching modules
386 define Package
/ip6tables-mod-extra
/description
387 iptables header matching modules for IPv6
390 define Package
/ip6tables-mod-nat
391 $(call Package
/iptables
/Default
)
392 DEPENDS
:=ip6tables
+kmod-ipt-nat6
393 TITLE
:=IPv6 NAT extensions
396 define Package
/ip6tables-mod-nat
/description
397 iptables extensions for IPv6-NAT targets.
400 define Package
/libiptc
401 $(call Package
/iptables
/Default
)
404 DEPENDS
:=+libip4tc
+libip6tc
+libxtables
405 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
408 define Package
/libip4tc
409 $(call Package
/iptables
/Default
)
412 TITLE
:=IPv4 firewall
- shared libiptc library
416 define Package
/libip6tc
417 $(call Package
/iptables
/Default
)
420 TITLE
:=IPv6 firewall
- shared libiptc library
424 define Package
/libxtables
425 $(call Package
/iptables
/Default
)
428 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
432 -I
$(PKG_BUILD_DIR
)/include \
433 -I
$(LINUX_DIR
)/user_headers
/include \
437 -I
$(PKG_BUILD_DIR
)/include \
438 -I
$(LINUX_DIR
)/user_headers
/include \
439 -ffunction-sections
-fdata-sections \
448 --with-kernel
="$(LINUX_DIR)/user_headers" \
449 --with-xtlibdir
=/usr
/lib
/iptables \
451 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
454 $(TARGET_CONFIGURE_OPTS
) \
455 COPT_FLAGS
="$(TARGET_CFLAGS)" \
456 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
457 KBUILD_OUTPUT
="$(LINUX_DIR)" \
458 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
460 ifneq ($(wildcard $(PKG_BUILD_DIR
)/.config_
*),$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
)))
461 define Build
/Configure
/rebuild
462 $(FIND
) $(PKG_BUILD_DIR
) -name \
*.o
-or
-name \
*.
\?o
-or
-name \
*.a |
$(XARGS
) rm -f
463 rm -f
$(PKG_BUILD_DIR
)/.config_
*
464 rm -f
$(PKG_BUILD_DIR
)/.configured_
*
465 touch
$(subst .configured_
,.config_
,$(STAMP_CONFIGURED
))
469 define Build
/Configure
470 $(Build
/Configure
/rebuild
)
471 $(Build
/Configure
/Default
)
474 define Build
/InstallDev
475 $(INSTALL_DIR
) $(1)/usr
/include
476 $(INSTALL_DIR
) $(1)/usr
/include/iptables
477 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
479 # XXX: iptables header fixup, some headers are not installed by iptables anymore
480 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
481 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
482 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
483 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
484 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
486 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
487 $(INSTALL_DIR
) $(1)/usr
/lib
488 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
489 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
490 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
491 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
492 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
494 # XXX: needed by firewall3
495 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext
*.so
$(1)/usr
/lib
/
498 define Package
/iptables
/install
499 $(INSTALL_DIR
) $(1)/usr
/sbin
500 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
501 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
502 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
505 define Package
/ip6tables
/install
506 $(INSTALL_DIR
) $(1)/usr
/sbin
507 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
510 define Package
/libiptc
/install
511 $(INSTALL_DIR
) $(1)/usr
/lib
512 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
515 define Package
/libip4tc
/install
516 $(INSTALL_DIR
) $(1)/usr
/lib
517 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
518 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext4.so
$(1)/usr
/lib
/
521 define Package
/libip6tc
/install
522 $(INSTALL_DIR
) $(1)/usr
/lib
523 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
524 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext6.so
$(1)/usr
/lib
/
527 define Package
/libxtables
/install
528 $(INSTALL_DIR
) $(1)/usr
/lib
529 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
530 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libiptext.so
$(1)/usr
/lib
/
534 define Package
/$(1)/install
535 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
536 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
537 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
538 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
544 $$(eval
$$(call BuildPackage
,$(1)))
547 $(eval
$(call BuildPackage
,iptables
))
548 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
549 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
550 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
)))
551 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
552 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
553 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
554 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
555 $(eval
$(call BuildPlugin
,iptables-mod-cluster
,$(IPT_CLUSTER-m
)))
556 $(eval
$(call BuildPlugin
,iptables-mod-clusterip
,$(IPT_CLUSTERIP-m
)))
557 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
558 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
559 $(eval
$(call BuildPlugin
,iptables-mod-rpfilter
,$(IPT_RPFILTER-m
)))
560 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
561 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
562 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
563 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
564 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
565 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
566 $(eval
$(call BuildPackage
,ip6tables
))
567 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
568 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))
569 $(eval
$(call BuildPackage
,libiptc
))
570 $(eval
$(call BuildPackage
,libip4tc
))
571 $(eval
$(call BuildPackage
,libip6tc
))
572 $(eval
$(call BuildPackage
,libxtables
))