1286062ce73855f79199b8de2e5caef6102743a2
[openwrt.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:=3
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/iptables-utils
336 $(call Package/iptables/Module, )
337 TITLE:=iptables save and restore utilities
338 endef
339
340 define Package/ip6tables
341 $(call Package/iptables/Default)
342 DEPENDS:=+kmod-ip6tables +libip6tc +libxtables
343 CATEGORY:=IPv6
344 TITLE:=IPv6 firewall administration tool
345 MENU:=1
346 endef
347
348 define Package/ip6tables-utils
349 $(call Package/iptables/Default)
350 DEPENDS:=ip6tables
351 CATEGORY:=IPv6
352 TITLE:=ip6tables save and restore utilities
353 endef
354
355 define Package/libiptc
356 $(call Package/iptables/Default)
357 SECTION:=libs
358 CATEGORY:=Libraries
359 DEPENDS:=+libip4tc +libip6tc
360 TITLE:=IPv4/IPv6 firewall - shared libiptc library (compatibility stub)
361 endef
362
363 define Package/libip4tc
364 $(call Package/iptables/Default)
365 SECTION:=libs
366 CATEGORY:=Libraries
367 TITLE:=IPv4 firewall - shared libiptc library
368 endef
369
370 define Package/libip6tc
371 $(call Package/iptables/Default)
372 SECTION:=libs
373 CATEGORY:=Libraries
374 TITLE:=IPv6 firewall - shared libiptc library
375 endef
376
377 define Package/libxtables
378 $(call Package/iptables/Default)
379 SECTION:=libs
380 CATEGORY:=Libraries
381 TITLE:=IPv4/IPv6 firewall - shared xtables library
382 endef
383
384 define Package/libipq
385 $(call Package/iptables/Default)
386 SECTION:=libs
387 CATEGORY:=Libraries
388 TITLE:=IPv4/IPv6 firewall - shared libipq library
389 endef
390
391 TARGET_CPPFLAGS := \
392 -I$(PKG_BUILD_DIR)/include \
393 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include \
394 $(TARGET_CPPFLAGS)
395
396 TARGET_CFLAGS += \
397 -I$(PKG_BUILD_DIR)/include \
398 -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include
399
400 CONFIGURE_ARGS += \
401 --enable-shared \
402 --enable-devel \
403 --enable-ipv6 \
404 --enable-libipq \
405 --with-kernel="$(LINUX_DIR)" \
406 --with-xtlibdir=/usr/lib/iptables
407
408 MAKE_FLAGS := \
409 $(TARGET_CONFIGURE_OPTS) \
410 COPT_FLAGS="$(TARGET_CFLAGS)" \
411 LDFLAGS="-rdynamic" \
412 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
413 KBUILD_OUTPUT="$(LINUX_DIR)" \
414
415 define Build/InstallDev
416 $(INSTALL_DIR) $(1)/usr/include
417 $(INSTALL_DIR) $(1)/usr/include/iptables
418 $(INSTALL_DIR) $(1)/usr/include/net/netfilter
419
420 # XXX: iptables header fixup, some headers are not installed by iptables anymore
421 $(CP) $(PKG_BUILD_DIR)/include/net/netfilter/*.h $(1)/usr/include/net/netfilter/
422 $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
423 $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
424 $(CP) $(PKG_BUILD_DIR)/include/libipq/libipq.h $(1)/usr/include/
425 $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
426 $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
427
428 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
429 $(INSTALL_DIR) $(1)/usr/lib
430 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
431 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
432 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
433 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
434 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
435 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libiptc.pc $(1)/usr/lib/pkgconfig/
436 endef
437
438 define Package/iptables/install
439 $(INSTALL_DIR) $(1)/usr/sbin
440 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
441 $(INSTALL_DIR) $(1)/usr/lib/iptables
442 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
443 for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
444 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
445 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
446 fi; \
447 done \
448 )
449 endef
450
451 define Package/iptables-utils/install
452 $(INSTALL_DIR) $(1)/usr/sbin
453 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables-multi $(1)/usr/sbin/
454 $(LN) iptables-multi $(1)/usr/sbin/iptables-save
455 $(LN) iptables-multi $(1)/usr/sbin/iptables-restore
456 endef
457
458 define Package/ip6tables/install
459 $(INSTALL_DIR) $(1)/usr/sbin
460 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
461 $(INSTALL_DIR) $(1)/usr/lib/iptables
462 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
463 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
464 )
465 endef
466
467 define Package/ip6tables-utils/install
468 $(INSTALL_DIR) $(1)/usr/sbin
469 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-multi $(1)/usr/sbin/
470 $(LN) ip6tables-multi $(1)/usr/sbin/ip6tables-save
471 $(LN) ip6tables-multi $(1)/usr/sbin/ip6tables-restore
472 endef
473
474 define Package/libiptc/install
475 $(INSTALL_DIR) $(1)/usr/lib
476 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so* $(1)/usr/lib/
477 endef
478
479 define Package/libip4tc/install
480 $(INSTALL_DIR) $(1)/usr/lib
481 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so* $(1)/usr/lib/
482 endef
483
484 define Package/libip6tc/install
485 $(INSTALL_DIR) $(1)/usr/lib
486 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip6tc.so* $(1)/usr/lib/
487 endef
488
489 define Package/libxtables/install
490 $(INSTALL_DIR) $(1)/usr/lib
491 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
492 endef
493
494 define Package/libipq/install
495 $(INSTALL_DIR) $(1)/usr/lib
496 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.so* $(1)/usr/lib/
497 endef
498
499 define BuildPlugin
500 define Package/$(1)/install
501 $(INSTALL_DIR) $$(1)/usr/lib/iptables
502 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
503 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
504 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
505 fi; \
506 done
507 $(3)
508 endef
509
510 $$(eval $$(call BuildPackage,$(1)))
511 endef
512
513 L7_INSTALL:=\
514 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
515 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
516
517
518 $(eval $(call BuildPackage,iptables))
519 $(eval $(call BuildPackage,iptables-utils))
520 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
521 $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
522 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
523 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
524 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
525 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
526 $(eval $(call BuildPlugin,iptables-mod-ipset,ipt_set ipt_SET))
527 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
528 $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
529 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
530 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
531 $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
532 $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
533 $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
534 $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
535 $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
536 $(eval $(call BuildPackage,ip6tables))
537 $(eval $(call BuildPackage,ip6tables-utils))
538 $(eval $(call BuildPackage,libiptc))
539 $(eval $(call BuildPackage,libip4tc))
540 $(eval $(call BuildPackage,libip6tc))
541 $(eval $(call BuildPackage,libxtables))
542 $(eval $(call BuildPackage,libipq))
This page took 0.077901 seconds and 3 git commands to generate.