iptables: drop iptables-utils and ip6tables-utils, ship needed symlinks in iptables...
[openwrt/staging/wigyori.git] / package / iptables / Makefile
1 #
2 # Copyright (C) 2006-2011 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 PKG_VERSION:=1.4.10
13 PKG_RELEASE:=4
14
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/
21
22 PKG_FIXUP:=autoreconf
23 PKG_INSTALL:=1
24 PKG_BUILD_PARALLEL:=1
25
26 include $(INCLUDE_DIR)/package.mk
27 ifeq ($(DUMP),)
28 -include $(LINUX_DIR)/.config
29 include $(INCLUDE_DIR)/netfilter.mk
30 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
31 endif
32
33
34 define Package/iptables/Default
35 SECTION:=net
36 CATEGORY:=Network
37 SUBMENU:=Firewall
38 URL:=http://netfilter.org/
39 endef
40
41 define Package/iptables/Module
42 $(call Package/iptables/Default)
43 DEPENDS:=iptables $(1)
44 endef
45
46 define Package/iptables
47 $(call Package/iptables/Default)
48 TITLE:=IPv4 firewall administration tool
49 MENU:=1
50 DEPENDS+= +kmod-ipt-core +libip4tc +libxtables
51 endef
52
53 define Package/iptables/description
54 IPv4 firewall administration tool.
55
56 Matches:
57 - icmp
58 - tcp
59 - udp
60 - comment
61 - limit
62 - mac
63 - multiport
64
65 Targets:
66 - ACCEPT
67 - DROP
68 - REJECT
69 - LOG
70 - TCPMSS
71
72 Tables:
73 - filter
74 - mangle
75
76 endef
77
78 define Package/iptables-mod-conntrack
79 $(call Package/iptables/Module, +kmod-ipt-conntrack)
80 TITLE:=Basic connection tracking extensions
81 endef
82
83 define Package/iptables-mod-conntrack/description
84 Basic iptables extensions for connection tracking.
85
86 Matches:
87 - state
88 - conntrack
89
90 Targets:
91 - NOTRACK
92
93 Tables:
94 - raw
95
96 endef
97
98 define Package/iptables-mod-conntrack-extra
99 $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
100 TITLE:=Extra connection tracking extensions
101 endef
102
103 define Package/iptables-mod-conntrack-extra/description
104 Extra iptables extensions for connection tracking.
105
106 Matches:
107 - connbytes
108 - connmark
109 - recent
110 - helper
111
112 Targets:
113 - CONNMARK
114
115 endef
116
117 define Package/iptables-mod-filter
118 $(call Package/iptables/Module, +kmod-ipt-filter)
119 TITLE:=Content inspection extensions
120 endef
121
122 define Package/iptables-mod-filter/description
123 iptables extensions for packet content inspection.
124 Includes support for:
125
126 Matches:
127 - layer7
128 - string
129
130 endef
131
132 define Package/iptables-mod-ipopt
133 $(call Package/iptables/Module, +kmod-ipt-ipopt)
134 TITLE:=IP/Packet option extensions
135 endef
136
137 define Package/iptables-mod-ipopt/description
138 iptables extensions for matching/changing IP packet options.
139
140 Matches:
141 - dscp
142 - hashlimit
143 - ecn
144 - length
145 - mark
146 - statistic
147 - tcpmss
148 - time
149 - unclean
150 - hl
151
152 Targets:
153 - DSCP
154 - CLASSIFY
155 - ECN
156 - MARK
157 - HL
158
159 endef
160
161 define Package/iptables-mod-ipsec
162 $(call Package/iptables/Module, +kmod-ipt-ipsec)
163 TITLE:=IPsec extensions
164 endef
165
166 define Package/iptables-mod-ipsec/description
167 iptables extensions for matching ipsec traffic.
168
169 Matches:
170 - ah
171 - esp
172 - policy
173
174 endef
175
176 define Package/iptables-mod-ipset
177 $(call Package/iptables/Module,)
178 TITLE:=IPset iptables extensions
179 endef
180
181 define Package/iptables-mod-ipset/description
182 IPset iptables extensions.
183
184 Matches:
185 - set
186
187 Targets:
188 - SET
189
190 endef
191
192 define Package/iptables-mod-nat
193 $(call Package/iptables/Module, +kmod-ipt-nat)
194 TITLE:=Basic NAT extensions
195 endef
196
197 define Package/iptables-mod-nat/description
198 iptables extensions for basic NAT targets.
199
200 Targets:
201 - SNAT
202 - DNAT
203 - MASQUERADE
204
205 Tables:
206 - nat
207
208 endef
209
210 define Package/iptables-mod-nat-extra
211 $(call Package/iptables/Module, +kmod-ipt-nat-extra)
212 TITLE:=Extra NAT extensions
213 endef
214
215 define Package/iptables-mod-nat-extra/description
216 iptables extensions for extra NAT targets.
217
218 Targets:
219 - MIRROR
220 - NETMAP
221 - REDIRECT
222 endef
223
224 define Package/iptables-mod-ulog
225 $(call Package/iptables/Module, +kmod-ipt-ulog)
226 TITLE:=user-space packet logging
227 endef
228
229 define Package/iptables-mod-ulog/description
230 iptables extensions for user-space packet logging.
231
232 Targets:
233 - ULOG
234
235 endef
236
237 define Package/iptables-mod-hashlimit
238 $(call Package/iptables/Module, +kmod-ipt-hashlimit)
239 TITLE:=hashlimit matching
240 endef
241
242 define Package/iptables-mod-hashlimit/description
243 iptables extensions for hashlimit matching
244
245 Matches:
246 - hashlimit
247
248 endef
249
250 define Package/iptables-mod-iprange
251 $(call Package/iptables/Module, +kmod-ipt-iprange)
252 TITLE:=IP range extension
253 endef
254
255 define Package/iptables-mod-iprange/description
256 iptables extensions for matching ip ranges.
257
258 Matches:
259 - iprange
260
261 endef
262
263 define Package/iptables-mod-extra
264 $(call Package/iptables/Module, +kmod-ipt-extra)
265 TITLE:=Other extra iptables extensions
266 endef
267
268 define Package/iptables-mod-extra/description
269 Other extra iptables extensions.
270
271 Matches:
272 - condition
273 - owner
274 - physdev (if ebtables is enabled)
275 - pkttype
276 - quota
277
278 endef
279
280 define Package/iptables-mod-led
281 $(call Package/iptables/Module, +kmod-ipt-led)
282 TITLE:=LED trigger iptables extension
283 endef
284
285 define Package/iptables-mod-led/description
286 iptables extension for triggering a LED.
287
288 Targets:
289 - LED
290
291 endef
292
293 define Package/iptables-mod-tproxy
294 $(call Package/iptables/Module, +kmod-ipt-tproxy)
295 TITLE:=Transparent proxy iptables extensions
296 endef
297
298 define Package/iptables-mod-tproxy/description
299 Transparent proxy iptables extensions.
300
301 Matches:
302 - socket
303
304 Targets:
305 - TPROXY
306
307 endef
308
309 define Package/iptables-mod-tee
310 $(call Package/iptables/Module, +kmod-ipt-tee)
311 TITLE:=TEE iptables extensions
312 endef
313
314 define Package/iptables-mod-tee/description
315 TEE iptables extensions.
316
317 Targets:
318 - TEE
319
320 endef
321
322 define Package/iptables-mod-u32
323 $(call Package/iptables/Module, +kmod-ipt-u32)
324 TITLE:=U32 iptables extensions
325 endef
326
327 define Package/iptables-mod-u32/description
328 U32 iptables extensions.
329
330 Matches:
331 - u32
332
333 endef
334
335 define Package/ip6tables
336 $(call Package/iptables/Default)
337 DEPENDS:=+kmod-ip6tables +libip6tc +libxtables
338 CATEGORY:=IPv6
339 TITLE:=IPv6 firewall administration tool
340 MENU:=1
341 endef
342
343 define Package/libiptc
344 $(call Package/iptables/Default)
345 SECTION:=libs
346 CATEGORY:=Libraries
347 DEPENDS:=+libip4tc +libip6tc
348 TITLE:=IPv4/IPv6 firewall - shared libiptc library (compatibility stub)
349 endef
350
351 define Package/libip4tc
352 $(call Package/iptables/Default)
353 SECTION:=libs
354 CATEGORY:=Libraries
355 TITLE:=IPv4 firewall - shared libiptc library
356 endef
357
358 define Package/libip6tc
359 $(call Package/iptables/Default)
360 SECTION:=libs
361 CATEGORY:=Libraries
362 TITLE:=IPv6 firewall - shared libiptc library
363 endef
364
365 define Package/libxtables
366 $(call Package/iptables/Default)
367 SECTION:=libs
368 CATEGORY:=Libraries
369 TITLE:=IPv4/IPv6 firewall - shared xtables library
370 endef
371
372 define Package/libipq
373 $(call Package/iptables/Default)
374 SECTION:=libs
375 CATEGORY:=Libraries
376 TITLE:=IPv4/IPv6 firewall - shared libipq library
377 endef
378
379 TARGET_CPPFLAGS := \
380 -I$(PKG_BUILD_DIR)/include \
381 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include \
382 $(TARGET_CPPFLAGS)
383
384 TARGET_CFLAGS += \
385 -I$(PKG_BUILD_DIR)/include \
386 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include
387
388 CONFIGURE_ARGS += \
389 --enable-shared \
390 --enable-devel \
391 --enable-ipv6 \
392 --enable-libipq \
393 --with-kernel="$(LINUX_DIR)" \
394 --with-xtlibdir=/usr/lib/iptables
395
396 MAKE_FLAGS := \
397 $(TARGET_CONFIGURE_OPTS) \
398 COPT_FLAGS="$(TARGET_CFLAGS)" \
399 LDFLAGS="-rdynamic" \
400 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
401 KBUILD_OUTPUT="$(LINUX_DIR)" \
402
403 define Build/InstallDev
404 $(INSTALL_DIR) $(1)/usr/include
405 $(INSTALL_DIR) $(1)/usr/include/iptables
406 $(INSTALL_DIR) $(1)/usr/include/net/netfilter
407
408 # XXX: iptables header fixup, some headers are not installed by iptables anymore
409 $(CP) $(PKG_BUILD_DIR)/include/net/netfilter/*.h $(1)/usr/include/net/netfilter/
410 $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
411 $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
412 $(CP) $(PKG_BUILD_DIR)/include/libipq/libipq.h $(1)/usr/include/
413 $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
414 $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
415
416 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
417 $(INSTALL_DIR) $(1)/usr/lib
418 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
419 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
420 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
421 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
422 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
423 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libiptc.pc $(1)/usr/lib/pkgconfig/
424 endef
425
426 define Package/iptables/install
427 $(INSTALL_DIR) $(1)/usr/sbin
428 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
429 $(LN) iptables $(1)/usr/sbin/iptables-save
430 $(LN) iptables $(1)/usr/sbin/iptables-restore
431 $(INSTALL_DIR) $(1)/usr/lib/iptables
432 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
433 for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
434 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
435 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
436 fi; \
437 done \
438 )
439 endef
440
441 define Package/ip6tables/install
442 $(INSTALL_DIR) $(1)/usr/sbin
443 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
444 $(LN) ip6tables $(1)/usr/sbin/ip6tables-save
445 $(LN) ip6tables $(1)/usr/sbin/ip6tables-restore
446 $(INSTALL_DIR) $(1)/usr/lib/iptables
447 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
448 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
449 )
450 endef
451
452 define Package/libiptc/install
453 $(INSTALL_DIR) $(1)/usr/lib
454 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so* $(1)/usr/lib/
455 endef
456
457 define Package/libip4tc/install
458 $(INSTALL_DIR) $(1)/usr/lib
459 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so* $(1)/usr/lib/
460 endef
461
462 define Package/libip6tc/install
463 $(INSTALL_DIR) $(1)/usr/lib
464 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip6tc.so* $(1)/usr/lib/
465 endef
466
467 define Package/libxtables/install
468 $(INSTALL_DIR) $(1)/usr/lib
469 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
470 endef
471
472 define Package/libipq/install
473 $(INSTALL_DIR) $(1)/usr/lib
474 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
475 endef
476
477 define BuildPlugin
478 define Package/$(1)/install
479 $(INSTALL_DIR) $$(1)/usr/lib/iptables
480 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
481 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
482 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
483 fi; \
484 done
485 $(3)
486 endef
487
488 $$(eval $$(call BuildPackage,$(1)))
489 endef
490
491 L7_INSTALL:=\
492 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
493 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
494
495
496 $(eval $(call BuildPackage,iptables))
497 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
498 $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
499 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
500 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
501 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
502 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
503 $(eval $(call BuildPlugin,iptables-mod-ipset,ipt_set ipt_SET))
504 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
505 $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
506 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
507 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
508 $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
509 $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
510 $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
511 $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
512 $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
513 $(eval $(call BuildPackage,ip6tables))
514 $(eval $(call BuildPackage,libiptc))
515 $(eval $(call BuildPackage,libip4tc))
516 $(eval $(call BuildPackage,libip6tc))
517 $(eval $(call BuildPackage,libxtables))
518 $(eval $(call BuildPackage,libipq))