Makefile 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. #
  2. # Copyright (C) 2006-2008 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. ifeq ($(CONFIG_LINUX_2_4),y)
  12. PKG_VERSION:=1.3.8
  13. PKG_RELEASE:=4
  14. PKG_MD5SUM:=0a9209f928002e5eee9cdff8fef4d4b3
  15. MAKE_TARGETS:=experimental install-experimental install-devel
  16. endif
  17. ifeq ($(CONFIG_LINUX_2_6),y)
  18. PKG_VERSION:=1.4.1.1
  19. PKG_RELEASE:=1
  20. PKG_MD5SUM:=723fa88d8a0915e184f99e03e9bf06cb
  21. endif
  22. PKG_VERSION?=<IPTABLES_VERSION>
  23. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  24. PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
  25. ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
  26. ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
  27. ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
  28. PATCH_DIR:=./patches/$(PKG_VERSION)
  29. include $(INCLUDE_DIR)/package.mk
  30. ifeq ($(DUMP),)
  31. -include $(LINUX_DIR)/.config
  32. include $(INCLUDE_DIR)/netfilter.mk
  33. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
  34. endif
  35. define Package/iptables/Default
  36. SECTION:=net
  37. CATEGORY:=Base system
  38. URL:=http://netfilter.org/
  39. endef
  40. define Package/iptables/Module
  41. $(call Package/iptables/Default)
  42. DEPENDS:=iptables $(1)
  43. endef
  44. define Package/iptables
  45. $(call Package/iptables/Default)
  46. TITLE:=IPv4 firewall administration tool
  47. MENU:=1
  48. DEPENDS+= +kmod-ipt-core
  49. endef
  50. define Package/iptables/description
  51. IPv4 firewall administration tool.
  52. Includes support for:
  53. - limit
  54. - LOG
  55. - mac
  56. - multiport
  57. - REJECT
  58. - TCPMSS
  59. endef
  60. define Package/iptables-mod-conntrack
  61. $(call Package/iptables/Module, +kmod-ipt-conntrack)
  62. TITLE:=Basic connection tracking extensions
  63. endef
  64. define Package/iptables-mod-conntrack/description
  65. Basic iptables extensions for connection tracking.
  66. Includes:
  67. - state
  68. endef
  69. define Package/iptables-mod-conntrack-extra
  70. $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
  71. TITLE:=Extra connection tracking extensions
  72. endef
  73. define Package/iptables-mod-conntrack-extra/description
  74. Extra iptables extensions for connection tracking.
  75. Includes:
  76. - libipt_conntrack
  77. - libipt_helper
  78. - libipt_connmark/CONNMARK
  79. endef
  80. define Package/iptables-mod-filter
  81. $(call Package/iptables/Module, +kmod-ipt-filter)
  82. TITLE:=Content inspection extensions
  83. endef
  84. define Package/iptables-mod-filter/description
  85. iptables extensions for packet content inspection.
  86. Includes:
  87. - libipt_ipp2p
  88. - libipt_layer7
  89. endef
  90. define Package/iptables-mod-imq
  91. $(call Package/iptables/Module, +kmod-ipt-imq @!LINUX_2_6_27)
  92. TITLE:=IMQ support
  93. endef
  94. define Package/iptables-mod-imq/description
  95. iptables extension for IMQ support.
  96. Includes:
  97. - libipt_IMQ
  98. endef
  99. define Package/iptables-mod-ipopt
  100. $(call Package/iptables/Module, +kmod-ipt-ipopt)
  101. TITLE:=IP/Packet option extensions
  102. endef
  103. define Package/iptables-mod-ipopt/description
  104. iptables extensions for matching/changing IP packet options.
  105. Includes:
  106. - libipt_CLASSIFY
  107. - libipt_dscp/DSCP
  108. - libipt_ecn/ECN
  109. - libipt_length
  110. - libipt_mac
  111. - libipt_mark/MARK
  112. - libipt_statistic
  113. - libipt_tcpmms
  114. - libipt_tos/TOS
  115. - libipt_ttl/TTL
  116. - libipt_unclean
  117. endef
  118. define Package/iptables-mod-ipsec
  119. $(call Package/iptables/Module, +kmod-ipt-ipsec)
  120. TITLE:=IPsec extensions
  121. endef
  122. define Package/iptables-mod-ipsec/description
  123. iptables extensions for matching ipsec traffic.
  124. Includes:
  125. - libipt_ah
  126. - libipt_esp
  127. - libipt_policy
  128. endef
  129. define Package/iptables-mod-nat
  130. $(call Package/iptables/Module, +kmod-ipt-nat)
  131. TITLE:=Basic NAT extensions
  132. endef
  133. define Package/iptables-mod-nat/description
  134. iptables extensions for basic NAT targets.
  135. Includes:
  136. - MASQUERADE
  137. - SNAT
  138. - DNAT
  139. endef
  140. define Package/iptables-mod-nat-extra
  141. $(call Package/iptables/Module, +kmod-ipt-nat-extra)
  142. TITLE:=Extra NAT extensions
  143. endef
  144. define Package/iptables-mod-nat-extra/description
  145. iptables extensions for extra NAT targets.
  146. Includes:
  147. - REDIRECT
  148. endef
  149. define Package/iptables-mod-ulog
  150. $(call Package/iptables/Module, +kmod-ipt-ulog)
  151. TITLE:=user-space packet logging
  152. endef
  153. define Package/iptables-mod-ulog/description
  154. iptables extensions for user-space packet logging.
  155. Includes:
  156. - libipt_ULOG
  157. endef
  158. define Package/iptables-mod-iprange
  159. $(call Package/iptables/Module, +kmod-ipt-iprange)
  160. TITLE:=IP range extension
  161. endef
  162. define Package/iptables-mod-iprange/description
  163. iptables extensions for matching ip ranges.
  164. Includes:
  165. - libipt_iprange
  166. endef
  167. define Package/iptables-mod-extra
  168. $(call Package/iptables/Module, +kmod-ipt-extra)
  169. TITLE:=Other extra iptables extensions
  170. endef
  171. define Package/iptables-mod-extra/description
  172. other extra iptables extensions.
  173. Includes:
  174. - libipt_owner
  175. - libipt_physdev
  176. - libipt_pkttype
  177. - libipt_recent
  178. - iptable_raw
  179. - libipt_NOTRACK
  180. - libipt_TARPIT
  181. - libipt_DELUDE
  182. - libipt_CHAOS
  183. endef
  184. define Package/iptables-mod-ipset
  185. $(call Package/iptables/Module, +kmod-ipt-ipset)
  186. TITLE:=IPset extension
  187. endef
  188. define Package/iptables-utils
  189. $(call Package/iptables/Module, )
  190. TITLE:=iptables save and restore utilities
  191. endef
  192. define Package/ip6tables
  193. $(call Package/iptables/Default)
  194. DEPENDS:=+kmod-ip6tables
  195. CATEGORY:=IPv6
  196. TITLE:=IPv6 firewall administration tool
  197. MENU:=1
  198. endef
  199. define Package/ip6tables-utils
  200. $(call Package/iptables/Default)
  201. DEPENDS:=ip6tables
  202. CATEGORY:=IPv6
  203. TITLE:=ip6tables save and restore utilities
  204. endef
  205. define Build/Prepare
  206. $(call Build/Prepare/Default)
  207. endef
  208. ifeq ($(KERNEL),2.4)
  209. define Build/Configure
  210. chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
  211. rm -f $(PKG_BUILD_DIR)/.configured*
  212. $(MAKE) -C $(PKG_BUILD_DIR) \
  213. clean
  214. endef
  215. endif
  216. TARGET_CFLAGS += $(FPIC)
  217. CONFIGURE_ARGS += --enable-devel --with-xtlibdir=/usr/lib/iptables
  218. define Build/Compile
  219. mkdir -p $(PKG_INSTALL_DIR)
  220. $(MAKE) -C $(PKG_BUILD_DIR) \
  221. $(TARGET_CONFIGURE_OPTS) \
  222. COPT_FLAGS="$(TARGET_CFLAGS)" \
  223. LDFLAGS="-rdynamic -static-libgcc" \
  224. KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
  225. KBUILD_OUTPUT="$(LINUX_DIR)" \
  226. DESTDIR="$(PKG_INSTALL_DIR)" \
  227. all install $(MAKE_TARGETS)
  228. endef
  229. define Build/InstallDev
  230. $(INSTALL_DIR) $(1)/usr/lib
  231. $(CP) $(PKG_BUILD_DIR)/include $(1)/usr
  232. $(CP) $(PKG_BUILD_DIR)/libiptc/libiptc.a $(1)/usr/lib
  233. endef
  234. define Package/iptables/install
  235. $(INSTALL_DIR) $(1)/usr/sbin
  236. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
  237. $(INSTALL_DIR) $(1)/usr/lib/iptables
  238. (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
  239. for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
  240. if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
  241. $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
  242. fi; \
  243. done \
  244. )
  245. endef
  246. define Package/iptables-utils/install
  247. $(INSTALL_DIR) $(1)/usr/sbin
  248. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
  249. endef
  250. define Package/ip6tables/install
  251. $(INSTALL_DIR) $(1)/usr/sbin
  252. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
  253. $(INSTALL_DIR) $(1)/usr/lib/iptables
  254. (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
  255. $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
  256. )
  257. endef
  258. define Package/ip6tables-utils/install
  259. $(INSTALL_DIR) $(1)/usr/sbin
  260. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-{save,restore} $(1)/usr/sbin/
  261. endef
  262. define BuildPlugin
  263. define Package/$(1)/install
  264. $(INSTALL_DIR) $$(1)/usr/lib/iptables
  265. for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
  266. if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
  267. $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
  268. fi; \
  269. done
  270. $(3)
  271. endef
  272. $$(eval $$(call BuildPackage,$(1)))
  273. endef
  274. L7_INSTALL:=\
  275. $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
  276. $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
  277. $(eval $(call BuildPackage,iptables))
  278. $(eval $(call BuildPackage,iptables-utils))
  279. $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
  280. $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
  281. $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
  282. $(eval $(call BuildPlugin,iptables-mod-ipset,$(IPT_IPSET-m)))
  283. $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
  284. $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
  285. $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
  286. $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
  287. $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
  288. $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
  289. $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
  290. $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
  291. $(eval $(call BuildPackage,ip6tables))
  292. $(eval $(call BuildPackage,ip6tables-utils))