2 # Copyright (C) 2006-2012 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_MD5SUM
:=f382fe693f0b59d87bd47bea65eca198
16 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
17 PKG_SOURCE_URL
:=http
://www.netfilter.org
/projects
/iptables
/files \
18 ftp
://ftp.be.netfilter.org
/pub
/netfilter
/iptables
/ \
19 ftp
://ftp.de.netfilter.org
/pub
/netfilter
/iptables
/ \
20 ftp
://ftp.no.netfilter.org
/pub
/netfilter
/iptables
/
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
:=IPv4 firewall administration tool
54 DEPENDS
+= +kmod-ipt-core
+libip4tc
+libxtables
57 define Package
/iptables
/description
58 IPv4 firewall administration tool.
82 define Package
/iptables-mod-conntrack-extra
83 $(call Package
/iptables
/Module
, +kmod-ipt-conntrack-extra
)
84 TITLE
:=Extra connection tracking extensions
87 define Package
/iptables-mod-conntrack-extra
/description
88 Extra iptables extensions for connection tracking.
101 define Package
/iptables-mod-filter
102 $(call Package
/iptables
/Module
, +kmod-ipt-filter
)
103 TITLE
:=Content inspection extensions
106 define Package
/iptables-mod-filter
/description
107 iptables extensions for packet content inspection.
108 Includes support for
:
116 define Package
/iptables-mod-ipopt
117 $(call Package
/iptables
/Module
, +kmod-ipt-ipopt
)
118 TITLE
:=IP
/Packet option extensions
121 define Package
/iptables-mod-ipopt
/description
122 iptables extensions for matching
/changing IP packet options.
144 define Package
/iptables-mod-ipsec
145 $(call Package
/iptables
/Module
, +kmod-ipt-ipsec
)
146 TITLE
:=IPsec extensions
149 define Package
/iptables-mod-ipsec
/description
150 iptables extensions for matching ipsec traffic.
159 define Package
/iptables-mod-ipset
160 $(call Package
/iptables
/Module
,)
161 TITLE
:=IPset iptables extensions
164 define Package
/iptables-mod-ipset
/description
165 IPset iptables extensions.
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.
189 define Package
/iptables-mod-ulog
190 $(call Package
/iptables
/Module
, +kmod-ipt-ulog
)
191 TITLE
:=user-space packet logging
194 define Package
/iptables-mod-ulog
/description
195 iptables extensions for user-space packet logging.
202 define Package
/iptables-mod-hashlimit
203 $(call Package
/iptables
/Module
, +kmod-ipt-hashlimit
)
204 TITLE
:=hashlimit matching
207 define Package
/iptables-mod-hashlimit
/description
208 iptables extensions for hashlimit matching
215 define Package
/iptables-mod-iprange
216 $(call Package
/iptables
/Module
, +kmod-ipt-iprange
)
217 TITLE
:=IP range extension
220 define Package
/iptables-mod-iprange
/description
221 iptables extensions for matching ip ranges.
228 define Package
/iptables-mod-extra
229 $(call Package
/iptables
/Module
, +kmod-ipt-extra
)
230 TITLE
:=Other extra iptables extensions
233 define Package
/iptables-mod-extra
/description
234 Other extra iptables extensions.
239 - physdev
(if ebtables is enabled
)
245 define Package
/iptables-mod-led
246 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
247 TITLE
:=LED trigger iptables extension
250 define Package
/iptables-mod-led
/description
251 iptables extension for triggering a LED.
258 define Package
/iptables-mod-tproxy
259 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
260 TITLE
:=Transparent proxy iptables extensions
263 define Package
/iptables-mod-tproxy
/description
264 Transparent proxy iptables extensions.
274 define Package
/iptables-mod-tee
275 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
276 TITLE
:=TEE iptables extensions
279 define Package
/iptables-mod-tee
/description
280 TEE iptables extensions.
287 define Package
/iptables-mod-u32
288 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
289 TITLE
:=U32 iptables extensions
292 define Package
/iptables-mod-u32
/description
293 U32 iptables extensions.
300 define Package
/ip6tables
301 $(call Package
/iptables
/Default
)
302 DEPENDS
:=+kmod-ip6tables
+libip6tc
+libxtables
304 TITLE
:=IPv6 firewall administration tool
308 define Package
/libiptc
309 $(call Package
/iptables
/Default
)
312 DEPENDS
:=+libip4tc
+libip6tc
313 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
316 define Package
/libip4tc
317 $(call Package
/iptables
/Default
)
320 TITLE
:=IPv4 firewall
- shared libiptc library
323 define Package
/libip6tc
324 $(call Package
/iptables
/Default
)
327 TITLE
:=IPv6 firewall
- shared libiptc library
330 define Package
/libxtables
331 $(call Package
/iptables
/Default
)
334 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
337 define Package
/libipq
338 $(call Package
/iptables
/Default
)
341 TITLE
:=IPv4
/IPv6 firewall
- shared libipq library
345 -I
$(PKG_BUILD_DIR
)/include \
346 -I
$(LINUX_DIR
)/arch
/$(LINUX_KARCH
)/include \
350 -I
$(PKG_BUILD_DIR
)/include \
351 -I
$(LINUX_DIR
)/arch
/$(LINUX_KARCH
)/include
356 $(if
$(CONFIG_IPV6
),--enable-ipv6
,--disable-ipv6
) \
358 --with-kernel
="$(LINUX_DIR)" \
359 --with-xtlibdir
=/usr
/lib
/iptables \
363 $(TARGET_CONFIGURE_OPTS
) \
364 COPT_FLAGS
="$(TARGET_CFLAGS)" \
365 KERNEL_DIR
="$(LINUX_DIR)" PREFIX
=/usr \
366 KBUILD_OUTPUT
="$(LINUX_DIR)" \
367 BUILTIN_MODULES
="$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m)))"
369 define Build
/InstallDev
370 $(INSTALL_DIR
) $(1)/usr
/include
371 $(INSTALL_DIR
) $(1)/usr
/include/iptables
372 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
374 # XXX: iptables header fixup, some headers are not installed by iptables anymore
375 $(CP
) $(PKG_BUILD_DIR
)/include/net
/netfilter
/*.h
$(1)/usr
/include/net
/netfilter
/
376 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
377 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
378 $(CP
) $(PKG_BUILD_DIR
)/include/libipq
/libipq.h
$(1)/usr
/include/
379 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
380 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
382 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
383 $(INSTALL_DIR
) $(1)/usr
/lib
384 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
385 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
386 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libipq.so
* $(1)/usr
/lib
/
387 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
388 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
389 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libiptc.
pc $(1)/usr
/lib
/pkgconfig
/
392 define Package
/iptables
/install
393 $(INSTALL_DIR
) $(1)/usr
/sbin
394 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
$(1)/usr
/sbin
/
395 $(LN
) iptables
$(1)/usr
/sbin
/iptables-save
396 $(LN
) iptables
$(1)/usr
/sbin
/iptables-restore
397 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
400 define Package
/ip6tables
/install
401 $(INSTALL_DIR
) $(1)/usr
/sbin
402 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
$(1)/usr
/sbin
/
403 $(LN
) ip6tables
$(1)/usr
/sbin
/ip6tables-save
404 $(LN
) ip6tables
$(1)/usr
/sbin
/ip6tables-restore
405 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
406 (cd
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
; \
407 $(CP
) libip6t_
*.so
$(1)/usr
/lib
/iptables
/ \
411 define Package
/libiptc
/install
412 $(INSTALL_DIR
) $(1)/usr
/lib
413 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
416 define Package
/libip4tc
/install
417 $(INSTALL_DIR
) $(1)/usr
/lib
418 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
421 define Package
/libip6tc
/install
422 $(INSTALL_DIR
) $(1)/usr
/lib
423 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
426 define Package
/libxtables
/install
427 $(INSTALL_DIR
) $(1)/usr
/lib
428 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
431 define Package
/libipq
/install
432 $(INSTALL_DIR
) $(1)/usr
/lib
433 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libipq.so
* $(1)/usr
/lib
/
437 define Package
/$(1)/install
438 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
439 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)); do \
440 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
441 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
447 $$(eval
$$(call BuildPackage
,$(1)))
451 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
452 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
455 $(eval
$(call BuildPackage
,iptables
))
456 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
457 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
458 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
459 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
460 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
461 $(eval
$(call BuildPlugin
,iptables-mod-ipset
,ipt_set ipt_SET
))
462 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
463 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
464 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
465 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
466 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
467 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
468 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
469 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
470 $(eval
$(call BuildPackage
,ip6tables
))
471 $(eval
$(call BuildPackage
,libiptc
))
472 $(eval
$(call BuildPackage
,libip4tc
))
473 $(eval
$(call BuildPackage
,libip6tc
))
474 $(eval
$(call BuildPackage
,libxtables
))
475 $(eval
$(call BuildPackage
,libipq
))