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
:=a819199d5ec013b82da13a8ffbba857e
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.
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.
240 - physdev
(if ebtables is enabled
)
246 define Package
/iptables-mod-led
247 $(call Package
/iptables
/Module
, +kmod-ipt-led
)
248 TITLE
:=LED trigger iptables extension
251 define Package
/iptables-mod-led
/description
252 iptables extension for triggering a LED.
259 define Package
/iptables-mod-tproxy
260 $(call Package
/iptables
/Module
, +kmod-ipt-tproxy
)
261 TITLE
:=Transparent proxy iptables extensions
264 define Package
/iptables-mod-tproxy
/description
265 Transparent proxy iptables extensions.
275 define Package
/iptables-mod-tee
276 $(call Package
/iptables
/Module
, +kmod-ipt-tee
)
277 TITLE
:=TEE iptables extensions
280 define Package
/iptables-mod-tee
/description
281 TEE iptables extensions.
288 define Package
/iptables-mod-u32
289 $(call Package
/iptables
/Module
, +kmod-ipt-u32
)
290 TITLE
:=U32 iptables extensions
293 define Package
/iptables-mod-u32
/description
294 U32 iptables extensions.
301 define Package
/ip6tables
302 $(call Package
/iptables
/Default
)
303 DEPENDS
:=@IPV6
+kmod-ip6tables
+iptables
305 TITLE
:=IPv6 firewall administration tool
309 define Package
/libiptc
310 $(call Package
/iptables
/Default
)
313 DEPENDS
:=+libip4tc
+libip6tc
314 TITLE
:=IPv4
/IPv6 firewall
- shared libiptc library
(compatibility stub
)
317 define Package
/libip4tc
318 $(call Package
/iptables
/Default
)
321 TITLE
:=IPv4 firewall
- shared libiptc library
324 define Package
/libip6tc
325 $(call Package
/iptables
/Default
)
328 TITLE
:=IPv6 firewall
- shared libiptc library
331 define Package
/libxtables
332 $(call Package
/iptables
/Default
)
335 TITLE
:=IPv4
/IPv6 firewall
- shared xtables library
339 -I
$(PKG_BUILD_DIR
)/include \
340 -I
$(LINUX_DIR
)/user_headers
/include \
344 -I
$(PKG_BUILD_DIR
)/include \
345 -I
$(LINUX_DIR
)/user_headers
/include
350 --with-kernel
="$(LINUX_DIR)/user_headers" \
351 --with-xtlibdir
=/usr
/lib
/iptables \
355 $(TARGET_CONFIGURE_OPTS
) \
356 COPT_FLAGS
="$(TARGET_CFLAGS)" \
357 KERNEL_DIR
="$(LINUX_DIR)/user_headers/" PREFIX
=/usr \
358 KBUILD_OUTPUT
="$(LINUX_DIR)" \
359 BUILTIN_MODULES
="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
361 define Build
/InstallDev
362 $(INSTALL_DIR
) $(1)/usr
/include
363 $(INSTALL_DIR
) $(1)/usr
/include/iptables
364 $(INSTALL_DIR
) $(1)/usr
/include/net
/netfilter
366 # XXX: iptables header fixup, some headers are not installed by iptables anymore
367 $(CP
) $(PKG_BUILD_DIR
)/include/iptables
/*.h
$(1)/usr
/include/iptables
/
368 $(CP
) $(PKG_BUILD_DIR
)/include/iptables.h
$(1)/usr
/include/
369 $(CP
) $(PKG_BUILD_DIR
)/include/ip6tables.h
$(1)/usr
/include/
370 $(CP
) $(PKG_BUILD_DIR
)/include/libipulog
$(1)/usr
/include/
371 $(CP
) $(PKG_BUILD_DIR
)/include/libiptc
$(1)/usr
/include/
373 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
374 $(INSTALL_DIR
) $(1)/usr
/lib
375 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
376 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip
*tc.so
* $(1)/usr
/lib
/
377 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
378 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/xtables.
pc $(1)/usr
/lib
/pkgconfig
/
379 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libip
*tc.
pc $(1)/usr
/lib
/pkgconfig
/
382 define Package
/iptables
/install
383 $(INSTALL_DIR
) $(1)/usr
/sbin
384 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/xtables-multi
$(1)/usr
/sbin
/
385 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/iptables
{,-restore
,-save
} $(1)/usr
/sbin
/
386 $(INSTALL_DIR
) $(1)/usr
/lib
/iptables
389 define Package
/ip6tables
/install
390 $(INSTALL_DIR
) $(1)/usr
/sbin
391 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/ip6tables
{,-restore
,-save
} $(1)/usr
/sbin
/
394 define Package
/libiptc
/install
395 $(INSTALL_DIR
) $(1)/usr
/lib
396 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libiptc.so
* $(1)/usr
/lib
/
399 define Package
/libip4tc
/install
400 $(INSTALL_DIR
) $(1)/usr
/lib
401 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip4tc.so
* $(1)/usr
/lib
/
404 define Package
/libip6tc
/install
405 $(INSTALL_DIR
) $(1)/usr
/lib
406 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libip6tc.so
* $(1)/usr
/lib
/
409 define Package
/libxtables
/install
410 $(INSTALL_DIR
) $(1)/usr
/lib
411 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libxtables.so
* $(1)/usr
/lib
/
415 define Package
/$(1)/install
416 $(INSTALL_DIR
) $$(1)/usr
/lib
/iptables
417 for m in
$(patsubst xt_
%,ipt_
%,$(2)) $(patsubst ipt_
%,xt_
%,$(2)) $(patsubst xt_
%,ip6t_
%,$(2)) $(patsubst ip6t_
%,xt_
%,$(2)); do \
418 if
[ -f
$(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
]; then \
419 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/iptables
/lib
$$$$$$$${m}.so
$$(1)/usr
/lib
/iptables
/ ; \
425 $$(eval
$$(call BuildPackage
,$(1)))
429 $(INSTALL_DIR
) $$(1)/etc
/l7-protocols
; \
430 $(CP
) files
/l7
/*.pat
$$(1)/etc
/l7-protocols
/
433 $(eval
$(call BuildPackage
,iptables
))
434 $(eval
$(call BuildPlugin
,iptables-mod-conntrack-extra
,$(IPT_CONNTRACK_EXTRA-m
)))
435 $(eval
$(call BuildPlugin
,iptables-mod-extra
,$(IPT_EXTRA-m
)))
436 $(eval
$(call BuildPlugin
,iptables-mod-filter
,$(IPT_FILTER-m
),$(L7_INSTALL
)))
437 $(eval
$(call BuildPlugin
,iptables-mod-ipopt
,$(IPT_IPOPT-m
)))
438 $(eval
$(call BuildPlugin
,iptables-mod-ipsec
,$(IPT_IPSEC-m
)))
439 $(eval
$(call BuildPlugin
,iptables-mod-ipset
,ipt_set ipt_SET
))
440 $(eval
$(call BuildPlugin
,iptables-mod-nat-extra
,$(IPT_NAT_EXTRA-m
)))
441 $(eval
$(call BuildPlugin
,iptables-mod-iprange
,$(IPT_IPRANGE-m
)))
442 $(eval
$(call BuildPlugin
,iptables-mod-ulog
,$(IPT_ULOG-m
)))
443 $(eval
$(call BuildPlugin
,iptables-mod-hashlimit
,$(IPT_HASHLIMIT-m
)))
444 $(eval
$(call BuildPlugin
,iptables-mod-led
,$(IPT_LED-m
)))
445 $(eval
$(call BuildPlugin
,iptables-mod-tproxy
,$(IPT_TPROXY-m
)))
446 $(eval
$(call BuildPlugin
,iptables-mod-tee
,$(IPT_TEE-m
)))
447 $(eval
$(call BuildPlugin
,iptables-mod-u32
,$(IPT_U32-m
)))
448 $(eval
$(call BuildPackage
,ip6tables
))
449 $(eval
$(call BuildPackage
,libiptc
))
450 $(eval
$(call BuildPackage
,libip4tc
))
451 $(eval
$(call BuildPackage
,libip6tc
))
452 $(eval
$(call BuildPackage
,libxtables
))