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