Makefile 6.7 KB

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