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
23 PKG_LICENSE_FILES
:=COPYING
30 ifneq ($(CONFIG_EXTERNAL_KERNEL_TREE
),"")
34 include $(INCLUDE_DIR
)/package.mk
36 -include $(LINUX_DIR
)/.config
37 include $(INCLUDE_DIR
)/netfilter.mk
38 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell $(SH_FUNC
) grep
'NETFILTER' $(LINUX_DIR
)/.config | md5s
)
42 define Package
/iptables
/Default
46 URL
:=http
://netfilter.org
/
49 define Package
/iptables
/Module
50 $(call Package
/iptables
/Default
)
51 DEPENDS
:=iptables
$(1)
54 define Package
/iptables
55 $(call Package
/iptables
/Default
)
56 TITLE
:=IP firewall administration tool
58 DEPENDS
+= +kmod-ipt-core
+libip4tc
+IPV6
:libip6tc
+libxtables
61 define Package
/iptables
/description
62 IP firewall administration tool.
100 define Package
/iptables-mod-conntrack-extra
101 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
102 TITLE
:=Extra connection tracking extensions
105 define Package
/iptables-mod-conntrack-extra
/description
106 Extra iptables extensions for connection tracking.
120 define Package
/iptables-mod-filter
121 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
122 TITLE
:=Content inspection extensions
125 define Package
/iptables-mod-filter
/description
126 iptables extensions for packet content inspection.
127 Includes support for
:
135 define Package
/iptables-mod-ipopt
136 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
137 TITLE
:=IP
/Packet option extensions
140 define Package
/iptables-mod-ipopt
/description
141 iptables extensions for matching
/changing IP packet options.
160 define Package
/iptables-mod-ipsec
161 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
162 TITLE
:=IPsec extensions
165 define Package
/iptables-mod-ipsec
/description
166 iptables extensions for matching ipsec traffic.
175 define Package
/iptables-mod-nat-extra
176 $(call Package
/iptables
/Module
, +kmod-ipt-nat-extra
)
177 TITLE
:=Extra NAT extensions
180 define Package
/iptables-mod-nat-extra
/description
181 iptables extensions for extra NAT targets.
188 define Package
/iptables-mod-ulog
189 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
190 TITLE
:=user-space packet logging
193 define Package
/iptables-mod-ulog
/description
194 iptables extensions for user-space packet logging.
201 define Package
/iptables-mod-nflog
202 $(call Package
/iptables
/Module
, +kmod-nfnetlink-log
+kmod-ipt-nflog
)
203 TITLE
:=Netfilter NFLOG target
206 define Package
/iptables-mod-nflog
/description
207 iptables extension for user-space logging via NFNETLINK.
214 define Package
/iptables-mod-nfqueue
215 $(call Package
/iptables
/Module
, +kmod-nfnetlink-queue
+kmod-ipt-nfqueue
)
216 TITLE
:=Netfilter NFQUEUE target
219 define Package
/iptables-mod-nfqueue
/description
220 iptables extension for user-space queuing via NFNETLINK.
227 define Package
/iptables-mod-hashlimit
228 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
229 TITLE
:=hashlimit matching
232 define Package
/iptables-mod-hashlimit
/description
233 iptables extensions for hashlimit matching
240 define Package
/iptables-mod-iprange
241 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
242 TITLE
:=IP range extension
245 define Package
/iptables-mod-iprange
/description
246 iptables extensions for matching ip ranges.
253 define Package
/iptables-mod-extra
254 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
255 TITLE
:=Other extra iptables extensions
258 define Package
/iptables-mod-extra
/description
259 Other extra iptables extensions.
265 - physdev
(if ebtables is enabled
)
271 define Package
/iptables-mod-led
272 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
273 TITLE
:=LED trigger iptables extension
276 define Package
/iptables-mod-led
/description
277 iptables extension for triggering a LED.
284 define Package
/iptables-mod-tproxy
285 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
286 TITLE
:=Transparent proxy iptables extensions
289 define Package
/iptables-mod-tproxy
/description
290 Transparent proxy iptables extensions.
300 define Package
/iptables-mod-tee
301 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
302 TITLE
:=TEE iptables extensions
305 define Package
/iptables-mod-tee
/description
306 TEE iptables extensions.
313 define Package
/iptables-mod-u32
314 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
315 TITLE
:=U32 iptables extensions
318 define Package
/iptables-mod-u32
/description
319 U32 iptables extensions.
326 define Package
/ip6tables
327 $(call Package
/iptables
/Default
)
328 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
330 TITLE
:=IPv6 firewall administration tool
335 define Package
/ip6tables-extra
336 $(call Package
/iptables
/Default
)
337 DEPENDS
:=ip6tables
+kmod-ip6tables-extra
338 TITLE
:=IPv6 header matching modules
341 define Package
/ip6tables-mod-extra
/description
342 iptables header matching modules for IPv6
345 define Package
/ip6tables-mod-nat
346 $(call Package
/iptables
/Default
)
347 DEPENDS
:=ip6tables
+kmod-ipt-nat6
348 TITLE
:=IPv6 NAT extensions
351 define Package
/ip6tables-mod-nat
/description
352 iptables extensions for IPv6-NAT targets.
355 define Package
/libiptc
356 $(call Package
/iptables
/Default
)
359 DEPENDS
:=+libip4tc
+IPV6
:libip6tc
360 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
363 define Package
/libip4tc
364 $(call Package
/iptables
/Default
)
367 TITLE
:=IPv4 firewall
- shared libiptc library
370 define Package
/libip6tc
371 $(call Package
/iptables
/Default
)
374 TITLE
:=IPv6 firewall
- shared libiptc library
377 define Package
/libxtables
378 $(call Package
/iptables
/Default
)
381 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
385 -I
$(PKG_BUILD_DIR
)/include \
386 -I
$(LINUX_DIR
)/user_headers
/include \
390 -I
$(PKG_BUILD_DIR
)/include \
391 -I
$(LINUX_DIR
)/user_headers
/include \
392 -ffunction-sections
-fdata-sections
400 --with-kernel
="$(LINUX_DIR)/user_headers" \
401 --with-xtlibdir
=/usr
/lib
/iptables \
403 $(if
$(CONFIG_IPV6
),,--disable-ipv6
)
406 $(TARGET_CONFIGURE_OPTS
) \
407 COPT_FLAGS
="$(TARGET_CFLAGS)" \
408 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
409 KBUILD_OUTPUT
="$(LINUX_DIR)" \
410 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
412 define Build
/InstallDev
413 $(INSTALL_DIR
) $(1)/usr
/include
414 $(INSTALL_DIR
) $(1)/usr
/include/iptables
415 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
417 # XXX: iptables header fixup, some headers are not installed by iptables anymore
418 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
419 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
420 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
421 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
422 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
424 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
425 $(INSTALL_DIR
) $(1)/usr
/lib
426 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
427 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
428 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
429 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
430 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
432 # XXX: needed by firewall3
433 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
434 $(CP
) $(PKG_BUILD_DIR
)/extensions
/libext
*.a
$(1)/usr
/lib
/iptables
/
437 define Package
/iptables
/install
438 $(INSTALL_DIR
) $(1)/usr
/sbin
439 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
440 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
441 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
444 define Package
/ip6tables
/install
445 $(INSTALL_DIR
) $(1)/usr
/sbin
446 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
449 define Package
/libiptc
/install
450 $(INSTALL_DIR
) $(1)/usr
/lib
451 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
454 define Package
/libip4tc
/install
455 $(INSTALL_DIR
) $(1)/usr
/lib
456 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
459 define Package
/libip6tc
/install
460 $(INSTALL_DIR
) $(1)/usr
/lib
461 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
464 define Package
/libxtables
/install
465 $(INSTALL_DIR
) $(1)/usr
/lib
466 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
470 define Package
/$(1)/install
471 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
472 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
473 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
474 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
480 $$(eval
$$(call BuildPackage
,$(1)))
484 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
485 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
488 $(eval
$(call BuildPackage
,iptables
))
489 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
490 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
491 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
492 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
493 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
494 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
495 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
496 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
497 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
498 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
499 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
500 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
501 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
502 $(eval
$(call BuildPlugin
,iptables-mod-nflog
,$(IPT_NFLOG-m
)))
503 $(eval
$(call BuildPlugin
,iptables-mod-nfqueue
,$(IPT_NFQUEUE-m
)))
504 $(eval
$(call BuildPackage
,ip6tables
))
505 $(eval
$(call BuildPlugin
,ip6tables-extra
,$(IPT_IPV6_EXTRA-m
)))
506 $(eval
$(call BuildPlugin
,ip6tables-mod-nat
,$(IPT_NAT6-m
)))
507 $(eval
$(call BuildPackage
,libiptc
))
508 $(eval
$(call BuildPackage
,libip4tc
))
509 $(eval
$(call BuildPackage
,libip6tc
))
510 $(eval
$(call BuildPackage
,libxtables
))