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