remove unneeded RSTRIP calls.
[openwrt.git] / package / iptables / Makefile
1
2 # Copyright (C) 2006 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 PKG_VERSION:=1.3.5
14 PKG_RELEASE:=1
15
16 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
18 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
19         ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
20         ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
21         ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
22 PKG_MD5SUM:=00fb916fa8040ca992a5ace56d905ea5
23 PKG_CAT:=bzcat
24
25 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
26
27 PKG_MENU:=IPv4 / IPv6 firewall administration
28
29 include $(INCLUDE_DIR)/package.mk
30 ifeq ($(DUMP),)
31 -include $(LINUX_DIR)/.config
32 include $(INCLUDE_DIR)/netfilter.mk
33 endif
34
35 define Package/iptables
36 SECTION:=net
37 CATEGORY:=Base system
38 MENU:=1
39 DEFAULT:=y
40 TITLE:=IPv4 firewall administration tool
41 URL:=http://netfilter.org/
42 endef
43
44 define Package/iptables/conffiles
45 /etc/config/firewall
46 /etc/firewall.user
47 endef
48
49 define Package/iptables-mod-conntrack
50 SECTION:=net
51 CATEGORY:=Base system
52 DEPENDS:=iptables
53 TITLE:=connection tracking modules
54 DESCRIPTION:=iptables extensions for connection tracking \\\
55 Includes: \\\
56         * libipt_conntrack \\\
57         * libipt_helper \\\
58         * libipt_connmark/CONNMARK
59 endef
60
61 define Package/iptables-mod-filter
62 SECTION:=net
63 CATEGORY:=Base system
64 DEPENDS:=iptables
65 TITLE:=filter modules
66 DESCRIPTION:=iptables extensions for packet content inspection\\\
67 Includes: \\\
68         * libipt_ipp2p \\\
69         * libipt_layer7 
70 endef
71
72 define Package/iptables-mod-imq
73 SECTION:=net
74 CATEGORY:=Base system
75 DEPENDS:=iptables
76 TITLE:=IMQ support
77 DESCRIPTION:=iptables extension for IMQ support\\\
78 Includes: \\\
79         * libipt_IMQ
80 endef
81
82 define Package/iptables-mod-ipopt
83 SECTION:=net
84 CATEGORY:=Base system
85 DEPENDS:=iptables
86 TITLE:=IP/Packet option modules
87 DESCRIPTION:=iptables extensions for matching/changing IP packet options\\\
88 Includes: \\\
89         * libipt_dscp/DSCP \\\
90         * libipt_ecn/ECN \\\
91         * libipt_length \\\
92         * libipt_mac \\\
93         * libipt_tos/TOS \\\
94         * libipt_tcpmms \\\
95         * libipt_ttl/TTL \\\
96         * libipt_unclean 
97 endef
98
99 define Package/iptables-mod-ipsec
100 SECTION:=net
101 CATEGORY:=Base system
102 DEPENDS:=iptables
103 TITLE:=IPSec extensions
104 DESCRIPTION:=iptables extensions for matching ipsec traffic\\\
105 Includes: \\\
106         * libipt_ah \\\
107         * libipt_esp
108 endef
109
110 define Package/iptables-mod-nat
111 SECTION:=net
112 CATEGORY:=Base system
113 DEPENDS:=iptables
114 TITLE:=extra NAT targets
115 DESCRIPTION:=iptables extensions for different NAT targets\\\
116 Includes: \\\
117         * libipt_REDIRECT
118 endef
119
120 define Package/iptables-mod-ulog
121 SECTION:=net
122 CATEGORY:=Base system
123 DEPENDS:=iptables
124 TITLE:=user-space packet logging
125 DESCRIPTION:=iptables extensions for user-space packet logging\\\
126 Includes: \\\
127         * libipt_ULOG
128 endef
129
130 define Package/iptables-mod-extra
131 SECTION:=net
132 CATEGORY:=Base system
133 DEPENDS:=iptables
134 TITLE:=other extra iptables extensions
135 DESCRIPTION:=other extra iptables extensions\\\
136 Includes: \\\
137         * libipt_limit \\\
138         * libipt_owner \\\
139         * libipt_physdev \\\
140         * libipt_pkttype \\\
141         * libipt_recent
142 endef
143
144 define Package/iptables-utils
145 SECTION:=net
146 CATEGORY:=Base system
147 DEPENDS:=iptables
148 TITLE:=iptables save and restore utilities
149 endef
150
151 define Package/ip6tables
152 SECTION:=net
153 CATEGORY:=Base system
154 TITLE:=IPv6 firewall administration tool
155 endef
156
157
158 define Build/Configure
159 endef
160
161 define Build/Compile
162         chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
163         mkdir -p $(PKG_INSTALL_DIR)
164         $(MAKE) -C $(PKG_BUILD_DIR) \
165                 $(TARGET_CONFIGURE_OPTS) \
166                 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
167                 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
168                 DESTDIR="$(PKG_INSTALL_DIR)" \
169                 all install install-devel
170 endef
171
172
173 define Build/InstallDev
174         $(MAKE) -C $(PKG_BUILD_DIR) \
175                 $(TARGET_CONFIGURE_OPTS) \
176                 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
177                 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
178                 DESTDIR="$(STAGING_DIR)" \
179                 install install-devel
180 endef
181
182 define Build/UninstallDev
183         rm -rf $(STAGING_DIR)/usr/include/libipq.h
184         rm -rf $(STAGING_DIR)/usr/lib/libipq.a
185 endef
186
187                 
188 define Package/iptables/install
189         install -d -m0755 $(1)/etc/config
190         install -m0644 ./files/firewall.config $(1)/etc/config/firewall
191         install -d -m0755 $(1)/etc/init.d
192         install -m0755 ./files/firewall.init $(1)/etc/init.d/S45firewall
193         install -m0755 ./files/firewall.user $(1)/etc/
194         install -d -m0755 $(1)/usr/lib
195         install -m0644 ./files/firewall.awk $(1)/usr/lib
196         install -d -m0755 $(1)/usr/sbin
197         $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
198         install -d -m0755 $(1)/usr/lib/iptables
199         (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
200                 $(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(1)/usr/lib/iptables/ \
201         )
202 endef
203
204 define Package/iptables-utils/install
205         install -d -m0755 $(1)/usr/sbin
206         $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
207 endef
208
209 define Package/ip6tables/install
210         install -d -m0755 $(1)/usr/sbin
211         $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
212         install -d -m0755 $(1)/usr/lib/iptables
213         (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
214                 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
215         )
216 endef
217
218 define BuildPlugin
219 define Package/$(1)/install
220         install -m0755 -d $$(1)/usr/lib/iptables
221         for m in $$(patsubst xt_%,ipt_%,$(2)); do \
222                 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
223         done
224         $(3)
225 endef
226
227 $$(eval $$(call BuildPackage,$(1)))
228 endef
229
230 L7_INSTALL:=mkdir -p $$(1)/etc/l7-protocols; \
231         $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
232
233 $(eval $(call BuildPackage,iptables))
234 $(eval $(call BuildPackage,iptables-utils))
235 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
236 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
237 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
238 $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
239 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
240 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
241 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
242 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
243 $(eval $(call BuildPackage,ip6tables))