2 # Copyright (C) 2006-2013 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_MD5SUM
:=536d048c8e8eeebcd9757d0863ebb0c0
26 ifneq ($(CONFIG_EXTERNAL_KERNEL_TREE
),"")
30 include $(INCLUDE_DIR
)/package.mk
32 -include $(LINUX_DIR
)/.config
33 include $(INCLUDE_DIR
)/netfilter.mk
34 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell $(SH_FUNC
) grep
'NETFILTER' $(LINUX_DIR
)/.config | md5s
)
38 define Package
/iptables
/Default
42 URL
:=http
://netfilter.org
/
45 define Package
/iptables
/Module
46 $(call Package
/iptables
/Default
)
47 DEPENDS
:=iptables
$(1)
50 define Package
/iptables
51 $(call Package
/iptables
/Default
)
52 TITLE
:=IP firewall administration tool
54 DEPENDS
+= +kmod-ipt-core
+libip4tc
+IPV6
:libip6tc
+libxtables
57 define Package
/iptables
/description
58 IP firewall administration tool.
96 define Package
/iptables-mod-conntrack-extra
97 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
98 TITLE
:=Extra connection tracking extensions
101 define Package
/iptables-mod-conntrack-extra
/description
102 Extra iptables extensions for connection tracking.
116 define Package
/iptables-mod-filter
117 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
118 TITLE
:=Content inspection extensions
121 define Package
/iptables-mod-filter
/description
122 iptables extensions for packet content inspection.
123 Includes support for
:
131 define Package
/iptables-mod-ipopt
132 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
133 TITLE
:=IP
/Packet option extensions
136 define Package
/iptables-mod-ipopt
/description
137 iptables extensions for matching
/changing IP packet options.
156 define Package
/iptables-mod-ipsec
157 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
158 TITLE
:=IPsec extensions
161 define Package
/iptables-mod-ipsec
/description
162 iptables extensions for matching ipsec traffic.
171 define Package
/iptables-mod-nat-extra
172 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
173 TITLE
:=Extra NAT extensions
176 define Package
/iptables-mod-nat-extra
/description
177 iptables extensions for extra NAT targets.
184 define Package
/iptables-mod-ulog
185 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
186 TITLE
:=user-space packet logging
189 define Package
/iptables-mod-ulog
/description
190 iptables extensions for user-space packet logging.
197 define Package
/iptables-mod-nflog
198 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
199 TITLE
:=Netfilter NFLOG target
202 define Package
/iptables-mod-nflog
/description
203 iptables extension for user-space logging via NFNETLINK.
210 define Package
/iptables-mod-nfqueue
211 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
212 TITLE
:=Netfilter NFQUEUE target
215 define Package
/iptables-mod-nfqueue
/description
216 iptables extension for user-space queuing via NFNETLINK.
223 define Package
/iptables-mod-hashlimit
224 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
225 TITLE
:=hashlimit matching
228 define Package
/iptables-mod-hashlimit
/description
229 iptables extensions for hashlimit matching
236 define Package
/iptables-mod-iprange
237 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
238 TITLE
:=IP range extension
241 define Package
/iptables-mod-iprange
/description
242 iptables extensions for matching ip ranges.
249 define Package
/iptables-mod-extra
250 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
251 TITLE
:=Other extra iptables extensions
254 define Package
/iptables-mod-extra
/description
255 Other extra iptables extensions.
261 - physdev
(if ebtables is enabled
)
267 define Package
/iptables-mod-led
268 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
269 TITLE
:=LED trigger iptables extension
272 define Package
/iptables-mod-led
/description
273 iptables extension for triggering a LED.
280 define Package
/iptables-mod-tproxy
281 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
282 TITLE
:=Transparent proxy iptables extensions
285 define Package
/iptables-mod-tproxy
/description
286 Transparent proxy iptables extensions.
296 define Package
/iptables-mod-tee
297 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
298 TITLE
:=TEE iptables extensions
301 define Package
/iptables-mod-tee
/description
302 TEE iptables extensions.
309 define Package
/iptables-mod-u32
310 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
311 TITLE
:=U32 iptables extensions
314 define Package
/iptables-mod-u32
/description
315 U32 iptables extensions.
322 define Package
/ip6tables
323 $(call Package
/iptables
/Default
)
324 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
326 TITLE
:=IPv6 firewall administration tool
331 define Package
/ip6tables-extra
332 $(call Package
/iptables
/Default
)
333 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
334 TITLE
:=IPv6 header matching modules
337 define Package
/ip6tables-mod-extra
/description
338 iptables header matching modules for IPv6
341 define Package
/ip6tables-mod-nat
342 $(call Package
/iptables
/Default
)
343 DEPENDS
:=ip6tables
+kmod-ipt-nat6
344 TITLE
:=IPv6 NAT extensions
347 define Package
/ip6tables-mod-nat
/description
348 iptables extensions for IPv6-NAT targets.
351 define Package
/libiptc
352 $(call Package
/iptables
/Default
)
355 DEPENDS
:=+libip4tc
+IPV6
:libip6tc
356 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
359 define Package
/libip4tc
360 $(call Package
/iptables
/Default
)
363 TITLE
:=IPv4 firewall
- shared libiptc library
366 define Package
/libip6tc
367 $(call Package
/iptables
/Default
)
370 TITLE
:=IPv6 firewall
- shared libiptc library
373 define Package
/libxtables
374 $(call Package
/iptables
/Default
)
377 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
381 -I
$(PKG_BUILD_DIR
)/include \
382 -I
$(LINUX_DIR
)/user_headers
/include \
386 -I
$(PKG_BUILD_DIR
)/include \
387 -I
$(LINUX_DIR
)/user_headers
/include \
388 -ffunction-sections
-fdata-sections
396 --with-kernel
="$(LINUX_DIR)/user_headers" \
397 --with-xtlibdir
=/usr
/lib
/iptables \
399 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
402 $(TARGET_CONFIGURE_OPTS
) \
403 COPT_FLAGS
="$(TARGET_CFLAGS)" \
404 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
405 KBUILD_OUTPUT
="$(LINUX_DIR)" \
406 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
408 define Build
/InstallDev
409 $(INSTALL_DIR
) $(1)/usr
/include
410 $(INSTALL_DIR
) $(1)/usr
/include/iptables
411 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
413 # XXX: iptables header fixup, some headers are not installed by iptables anymore
414 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
415 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
416 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
417 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
418 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
420 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
421 $(INSTALL_DIR
) $(1)/usr
/lib
422 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
423 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
424 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
425 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
426 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
428 # XXX: needed by firewall3
429 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
430 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libext
*.a
$(1)/usr
/lib
/iptables
/
433 define Package
/iptables
/install
434 $(INSTALL_DIR
) $(1)/usr
/sbin
435 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
436 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
437 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
440 define Package
/ip6tables
/install
441 $(INSTALL_DIR
) $(1)/usr
/sbin
442 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
445 define Package
/libiptc
/install
446 $(INSTALL_DIR
) $(1)/usr
/lib
447 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
450 define Package
/libip4tc
/install
451 $(INSTALL_DIR
) $(1)/usr
/lib
452 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
455 define Package
/libip6tc
/install
456 $(INSTALL_DIR
) $(1)/usr
/lib
457 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
460 define Package
/libxtables
/install
461 $(INSTALL_DIR
) $(1)/usr
/lib
462 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
466 define Package
/$(1)/install
467 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
468 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
469 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
470 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
476 $$(eval
$$(call BuildPackage
,$(1)))
480 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
481 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
484 $(eval
$(call BuildPackage
,iptables
))
485 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
486 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
487 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
488 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
489 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
490 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
491 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
492 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
493 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
494 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
495 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
496 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
497 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
498 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
499 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
500 $(eval
$(call BuildPackage
,ip6tables
))
501 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
502 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))
503 $(eval
$(call BuildPackage
,libiptc
))
504 $(eval
$(call BuildPackage
,libip4tc
))
505 $(eval
$(call BuildPackage
,libip6tc
))
506 $(eval
$(call BuildPackage
,libxtables
))