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