5b43dfefb7cf85e1969deee3a7afd9dc68333877
[openwrt/svn-archive/archive.git] / package / iptables / Makefile
1 #
2 # Copyright (C) 2006-2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=iptables
13
14 ifeq ($(CONFIG_LINUX_2_4),y)
15 PKG_VERSION:=1.3.8
16 PKG_RELEASE:=3
17 PKG_MD5SUM:=0a9209f928002e5eee9cdff8fef4d4b3
18 MAKE_TARGETS:=experimental install-experimental
19 endif
20
21 ifeq ($(CONFIG_LINUX_2_6),y)
22 PKG_VERSION:=1.4.0
23 PKG_RELEASE:=1
24 PKG_MD5SUM:=90cfa8a554a29b0b859a625e701af2a7
25 endif
26
27 PKG_VERSION?=<IPTABLES_VERSION>
28
29 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
30 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
31 ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
32 ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
33 ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
34
35 PATCH_DIR:=./patches/$(PKG_VERSION)
36
37 include $(INCLUDE_DIR)/package.mk
38 ifeq ($(DUMP),)
39 -include $(LINUX_DIR)/.config
40 include $(INCLUDE_DIR)/netfilter.mk
41 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
42 endif
43
44 define Package/iptables/Default
45 SECTION:=net
46 CATEGORY:=Base system
47 URL:=http://netfilter.org/
48 endef
49
50 define Package/iptables/Module
51 $(call Package/iptables/Default)
52 DEPENDS:=iptables $(1)
53 endef
54
55 define Package/iptables
56 $(call Package/iptables/Default)
57 TITLE:=IPv4 firewall administration tool
58 MENU:=1
59 endef
60
61 define Package/iptables-mod-conntrack
62 $(call Package/iptables/Module, +kmod-ipt-conntrack)
63 TITLE:=connection tracking modules
64 endef
65
66 define Package/iptables-mod-conntrack/description
67 iptables extensions for connection tracking.
68 Includes:
69 - libipt_conntrack
70 - libipt_helper
71 - libipt_connmark/CONNMARK
72 endef
73
74 define Package/iptables-mod-filter
75 $(call Package/iptables/Module, +kmod-ipt-filter)
76 TITLE:=filter modules
77 endef
78
79 define Package/iptables-mod-filter/description
80 iptables extensions for packet content inspection.
81 Includes:
82 - libipt_ipp2p
83 - libipt_layer7
84 endef
85
86 define Package/iptables-mod-imq
87 $(call Package/iptables/Module, +kmod-ipt-imq)
88 TITLE:=IMQ support
89 endef
90
91 define Package/iptables-mod-imq/description
92 iptables extension for IMQ support.
93 Includes:
94 - libipt_IMQ
95 endef
96
97 define Package/iptables-mod-ipopt
98 $(call Package/iptables/Module, +kmod-ipt-ipopt)
99 TITLE:=IP/Packet option modules
100 endef
101
102 define Package/iptables-mod-ipopt/description
103 iptables extensions for matching/changing IP packet options.\\\
104 Includes:
105 - libipt_CLASSIFY
106 - libipt_dscp/DSCP
107 - libipt_ecn/ECN
108 - libipt_length
109 - libipt_mac
110 - libipt_mark/MARK
111 - libipt_statistic
112 - libipt_tcpmms
113 - libipt_tos/TOS
114 - libipt_ttl/TTL
115 - libipt_unclean
116 endef
117
118 define Package/iptables-mod-ipsec
119 $(call Package/iptables/Module, +kmod-ipt-ipsec)
120 TITLE:=IPSec extensions
121 endef
122
123 define Package/iptables-mod-ipsec/description
124 iptables extensions for matching ipsec traffic.
125 Includes:
126 - libipt_ah
127 - libipt_esp
128 - libipt_policy
129 endef
130
131 define Package/iptables-mod-nat
132 $(call Package/iptables/Module, +kmod-ipt-nat)
133 TITLE:=extra NAT targets
134 endef
135
136 define Package/iptables-mod-nat/description
137 iptables extensions for different NAT targets.
138 Includes:
139 - libipt_REDIRECT
140 endef
141
142 define Package/iptables-mod-ulog
143 $(call Package/iptables/Module, +kmod-ipt-ulog)
144 TITLE:=user-space packet logging
145 endef
146
147 define Package/iptables-mod-ulog/description
148 iptables extensions for user-space packet logging.
149 Includes:
150 - libipt_ULOG
151 endef
152
153 define Package/iptables-mod-iprange
154 $(call Package/iptables/Module, +kmod-ipt-iprange)
155 TITLE:=ip range module
156 endef
157
158 define Package/iptables-mod-iprange/description
159 iptables extensions for matching ip ranges.
160 Includes:
161 - libipt_iprange
162 endef
163
164 define Package/iptables-mod-extra
165 $(call Package/iptables/Module, +kmod-ipt-extra)
166 TITLE:=other extra iptables extensions
167 endef
168
169 define Package/iptables-mod-extra/description
170 other extra iptables extensions.
171 Includes:
172 - libipt_limit
173 - libipt_owner
174 - libipt_physdev
175 - libipt_pkttype
176 - libipt_recent
177 - iptable_raw
178 - libipt_NOTRACK
179 - libipt_TARPIT
180 - libipt_DELUDE
181 - libipt_CHAOS
182 endef
183
184 define Package/iptables-mod-ipset
185 $(call Package/iptables/Module, +kmod-ipt-ipset)
186 TITLE:=ipset iptables extension
187 endef
188
189 define Package/iptables-utils
190 $(call Package/iptables/Module, )
191 TITLE:=iptables save and restore utilities
192 endef
193
194 define Package/ip6tables
195 $(call Package/iptables/Default)
196 DEPENDS:=+kmod-ip6tables
197 CATEGORY:=IPv6
198 TITLE:=IPv6 firewall administration tool
199 MENU:=1
200 endef
201
202 define Package/ip6tables-utils
203 $(call Package/iptables/Default)
204 DEPENDS:=ip6tables
205 CATEGORY:=IPv6
206 TITLE:=ip6tables save and restore utilities
207 endef
208
209 define Build/Prepare
210 $(call Build/Prepare/Default)
211 endef
212
213 define Build/Configure
214 chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
215 rm -f $(PKG_BUILD_DIR)/.configured*
216 $(MAKE) -C $(PKG_BUILD_DIR) \
217 clean
218 endef
219
220 define Build/Compile
221 mkdir -p $(PKG_INSTALL_DIR)
222 $(MAKE) -C $(PKG_BUILD_DIR) \
223 $(TARGET_CONFIGURE_OPTS) \
224 COPT_FLAGS="$(TARGET_CFLAGS)" \
225 LDFLAGS="-rdynamic -static-libgcc" \
226 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
227 KBUILD_OUTPUT="$(LINUX_DIR)" \
228 DESTDIR="$(PKG_INSTALL_DIR)" \
229 all install $(MAKE_TARGETS)
230 endef
231
232 define Build/InstallDev
233 $(MAKE) -C $(PKG_BUILD_DIR) \
234 $(TARGET_CONFIGURE_OPTS) \
235 COPT_FLAGS="$(TARGET_CFLAGS)" \
236 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
237 KBUILD_OUTPUT="$(LINUX_DIR)" \
238 DESTDIR="$(1)" \
239 install-devel
240 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr
241 $(CP) $(PKG_BUILD_DIR)/libiptc/libiptc.a $(1)/usr/lib
242 endef
243
244 define Package/iptables/install
245 $(INSTALL_DIR) $(1)/usr/sbin
246 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
247 $(INSTALL_DIR) $(1)/usr/lib/iptables
248 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
249 for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
250 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
251 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
252 fi; \
253 done \
254 )
255 endef
256
257 define Package/iptables-utils/install
258 $(INSTALL_DIR) $(1)/usr/sbin
259 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
260 endef
261
262 define Package/ip6tables/install
263 $(INSTALL_DIR) $(1)/usr/sbin
264 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
265 $(INSTALL_DIR) $(1)/usr/lib/iptables
266 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
267 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
268 )
269 endef
270
271 define Package/ip6tables-utils/install
272 $(INSTALL_DIR) $(1)/usr/sbin
273 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-{save,restore} $(1)/usr/sbin/
274 endef
275
276 define BuildPlugin
277 define Package/$(1)/install
278 $(INSTALL_DIR) $$(1)/usr/lib/iptables
279 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
280 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
281 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
282 fi; \
283 done
284 $(3)
285 endef
286
287 $$(eval $$(call BuildPackage,$(1)))
288 endef
289
290 L7_INSTALL:=\
291 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
292 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
293
294 $(eval $(call BuildPackage,iptables))
295 $(eval $(call BuildPackage,iptables-utils))
296 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
297 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
298 $(eval $(call BuildPlugin,iptables-mod-ipset,$(IPT_IPSET-m)))
299 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
300 $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
301 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
302 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
303 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
304 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
305 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
306 $(eval $(call BuildPackage,ip6tables))
307 $(eval $(call BuildPackage,ip6tables-utils))