Makefile 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. #
  2. # Copyright (C) 2006-2009 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/kernel.mk
  9. PKG_NAME:=iptables
  10. PKG_VERSION:=1.4.6
  11. PKG_RELEASE:=1
  12. PKG_MD5SUM:=c67cf30e281a924def6426be0973df56
  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_FIXUP = libtool
  19. include $(INCLUDE_DIR)/package.mk
  20. ifeq ($(DUMP),)
  21. -include $(LINUX_DIR)/.config
  22. include $(INCLUDE_DIR)/netfilter.mk
  23. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
  24. endif
  25. define Package/iptables/Default
  26. SECTION:=net
  27. CATEGORY:=Network
  28. URL:=http://netfilter.org/
  29. endef
  30. define Package/iptables/Module
  31. $(call Package/iptables/Default)
  32. DEPENDS:=iptables $(1)
  33. endef
  34. define Package/iptables
  35. $(call Package/iptables/Default)
  36. TITLE:=IPv4 firewall administration tool
  37. MENU:=1
  38. DEPENDS+= +kmod-ipt-core +libiptc +libxtables
  39. endef
  40. define Package/iptables/description
  41. IPv4 firewall administration tool.
  42. Includes support for:
  43. - comment
  44. - limit
  45. - LOG
  46. - mac
  47. - multiport
  48. - REJECT
  49. - TCPMSS
  50. endef
  51. define Package/iptables-mod-conntrack
  52. $(call Package/iptables/Module, +kmod-ipt-conntrack)
  53. TITLE:=Basic connection tracking extensions
  54. endef
  55. define Package/iptables-mod-conntrack/description
  56. Basic iptables extensions for connection tracking.
  57. Includes:
  58. - state
  59. endef
  60. define Package/iptables-mod-conntrack-extra
  61. $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
  62. TITLE:=Extra connection tracking extensions
  63. endef
  64. define Package/iptables-mod-conntrack-extra/description
  65. Extra iptables extensions for connection tracking.
  66. Includes:
  67. - libipt_conntrack
  68. - libipt_helper
  69. - libipt_connmark/CONNMARK
  70. endef
  71. define Package/iptables-mod-filter
  72. $(call Package/iptables/Module, +kmod-ipt-filter)
  73. TITLE:=Content inspection extensions
  74. endef
  75. define Package/iptables-mod-filter/description
  76. iptables extensions for packet content inspection.
  77. Includes:
  78. - libipt_string
  79. - libipt_layer7
  80. endef
  81. define Package/iptables-mod-imq
  82. $(call Package/iptables/Module, +kmod-ipt-imq)
  83. TITLE:=IMQ support
  84. endef
  85. define Package/iptables-mod-imq/description
  86. iptables extension for IMQ support.
  87. Includes:
  88. - libipt_IMQ
  89. endef
  90. define Package/iptables-mod-ipopt
  91. $(call Package/iptables/Module, +kmod-ipt-ipopt)
  92. TITLE:=IP/Packet option extensions
  93. endef
  94. define Package/iptables-mod-ipopt/description
  95. iptables extensions for matching/changing IP packet options.
  96. Includes:
  97. - libipt_CLASSIFY
  98. - libipt_dscp/DSCP
  99. - libipt_ecn/ECN
  100. - libipt_length
  101. - libipt_mac
  102. - libipt_mark/MARK
  103. - libipt_statistic
  104. - libipt_tcpmms
  105. - libipt_tos/TOS
  106. - libipt_ttl/TTL
  107. - libipt_unclean
  108. endef
  109. define Package/iptables-mod-ipsec
  110. $(call Package/iptables/Module, +kmod-ipt-ipsec)
  111. TITLE:=IPsec extensions
  112. endef
  113. define Package/iptables-mod-ipsec/description
  114. iptables extensions for matching ipsec traffic.
  115. Includes:
  116. - libipt_ah
  117. - libipt_esp
  118. - libipt_policy
  119. endef
  120. define Package/iptables-mod-ipset
  121. $(call Package/iptables/Module, @LINUX_2_6)
  122. TITLE:=IPset iptables extensions
  123. endef
  124. define Package/iptables-mod-ipset/description
  125. IPset iptables extensions.
  126. Includes:
  127. - libipt_set
  128. - libipt_SET
  129. endef
  130. define Package/iptables-mod-nat
  131. $(call Package/iptables/Module, +kmod-ipt-nat)
  132. TITLE:=Basic NAT extensions
  133. endef
  134. define Package/iptables-mod-nat/description
  135. iptables extensions for basic NAT targets.
  136. Includes:
  137. - MASQUERADE
  138. - SNAT
  139. - DNAT
  140. endef
  141. define Package/iptables-mod-nat-extra
  142. $(call Package/iptables/Module, +kmod-ipt-nat-extra)
  143. TITLE:=Extra NAT extensions
  144. endef
  145. define Package/iptables-mod-nat-extra/description
  146. iptables extensions for extra NAT targets.
  147. Includes:
  148. - REDIRECT
  149. endef
  150. define Package/iptables-mod-ulog
  151. $(call Package/iptables/Module, +kmod-ipt-ulog)
  152. TITLE:=user-space packet logging
  153. endef
  154. define Package/iptables-mod-ulog/description
  155. iptables extensions for user-space packet logging.
  156. Includes:
  157. - libipt_ULOG
  158. endef
  159. define Package/iptables-mod-iprange
  160. $(call Package/iptables/Module, +kmod-ipt-iprange)
  161. TITLE:=IP range extension
  162. endef
  163. define Package/iptables-mod-iprange/description
  164. iptables extensions for matching ip ranges.
  165. Includes:
  166. - libipt_iprange
  167. endef
  168. define Package/iptables-mod-extra
  169. $(call Package/iptables/Module, +kmod-ipt-extra)
  170. TITLE:=Other extra iptables extensions
  171. endef
  172. define Package/iptables-mod-extra/description
  173. other extra iptables extensions.
  174. Includes:
  175. - libipt_owner
  176. - libipt_physdev
  177. - libipt_pkttype
  178. - libipt_recent
  179. - iptable_raw
  180. - libipt_NOTRACK
  181. endef
  182. define Package/iptables-utils
  183. $(call Package/iptables/Module, )
  184. TITLE:=iptables save and restore utilities
  185. endef
  186. define Package/ip6tables
  187. $(call Package/iptables/Default)
  188. DEPENDS:=+kmod-ip6tables
  189. CATEGORY:=IPv6
  190. TITLE:=IPv6 firewall administration tool
  191. MENU:=1
  192. endef
  193. define Package/ip6tables-utils
  194. $(call Package/iptables/Default)
  195. DEPENDS:=ip6tables
  196. CATEGORY:=IPv6
  197. TITLE:=ip6tables save and restore utilities
  198. endef
  199. define Package/libiptc
  200. $(call Package/iptables/Default)
  201. SECTION:=libs
  202. CATEGORY:=Libraries
  203. TITLE:=IPv4/IPv6 firewall - shared libiptc library
  204. endef
  205. define Package/libxtables
  206. $(call Package/iptables/Default)
  207. SECTION:=libs
  208. CATEGORY:=Libraries
  209. TITLE:=IPv4/IPv6 firewall - shared xtables library
  210. endef
  211. TARGET_CPPFLAGS := \
  212. -I$(PKG_BUILD_DIR)/include \
  213. -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include \
  214. $(TARGET_CPPFLAGS)
  215. CONFIGURE_ARGS += \
  216. --enable-shared \
  217. --enable-devel \
  218. --enable-ipv6 \
  219. --with-kernel="$(LINUX_DIR)" \
  220. --with-xtlibdir=/usr/lib/iptables
  221. IPTABLES_MAKEOPTS = \
  222. $(TARGET_CONFIGURE_OPTS) \
  223. COPT_FLAGS="$(TARGET_CFLAGS)" \
  224. LDFLAGS="-rdynamic -static-libgcc" \
  225. KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
  226. KBUILD_OUTPUT="$(LINUX_DIR)" \
  227. DESTDIR="$(PKG_INSTALL_DIR)" \
  228. all install $(MAKE_TARGETS)
  229. define Build/Compile
  230. mkdir -p $(PKG_INSTALL_DIR)
  231. $(MAKE) -C $(PKG_BUILD_DIR) $(IPTABLES_MAKEOPTS)
  232. $(MAKE) -C $(PKG_BUILD_DIR)/libipq $(IPTABLES_MAKEOPTS)
  233. endef
  234. define Build/InstallDev
  235. mkdir -p $(1)/usr/include
  236. mkdir -p $(1)/usr/include/iptables
  237. mkdir -p $(1)/usr/include/net/netfilter
  238. # XXX: iptables header fixup, some headers are not installed by iptables anymore
  239. $(CP) $(PKG_BUILD_DIR)/include/net/netfilter/*.h $(1)/usr/include/net/netfilter/
  240. $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
  241. $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
  242. $(CP) $(PKG_BUILD_DIR)/include/libipq/libipq.h $(1)/usr/include/
  243. $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
  244. $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
  245. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  246. mkdir -p $(1)/usr/lib
  247. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.{a,so*} $(1)/usr/lib/
  248. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.{a,so*} $(1)/usr/lib/
  249. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.a $(1)/usr/lib/
  250. mkdir -p $(1)/usr/lib/pkgconfig
  251. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
  252. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libiptc.pc $(1)/usr/lib/pkgconfig/
  253. endef
  254. define Package/iptables/install
  255. $(INSTALL_DIR) $(1)/usr/sbin
  256. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
  257. $(INSTALL_DIR) $(1)/usr/lib/iptables
  258. (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
  259. for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
  260. if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
  261. $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
  262. fi; \
  263. done \
  264. )
  265. endef
  266. define Package/iptables-utils/install
  267. $(INSTALL_DIR) $(1)/usr/sbin
  268. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
  269. endef
  270. define Package/ip6tables/install
  271. $(INSTALL_DIR) $(1)/usr/sbin
  272. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
  273. $(INSTALL_DIR) $(1)/usr/lib/iptables
  274. (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
  275. $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
  276. )
  277. endef
  278. define Package/ip6tables-utils/install
  279. $(INSTALL_DIR) $(1)/usr/sbin
  280. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-{save,restore} $(1)/usr/sbin/
  281. endef
  282. define Package/libiptc/install
  283. $(INSTALL_DIR) $(1)/usr/lib
  284. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
  285. endef
  286. define Package/libxtables/install
  287. $(INSTALL_DIR) $(1)/usr/lib
  288. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
  289. endef
  290. define BuildPlugin
  291. define Package/$(1)/install
  292. $(INSTALL_DIR) $$(1)/usr/lib/iptables
  293. for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
  294. if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
  295. $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
  296. fi; \
  297. done
  298. $(3)
  299. endef
  300. $$(eval $$(call BuildPackage,$(1)))
  301. endef
  302. L7_INSTALL:=\
  303. $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
  304. $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
  305. $(eval $(call BuildPackage,iptables))
  306. $(eval $(call BuildPackage,iptables-utils))
  307. $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
  308. $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
  309. $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
  310. $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
  311. $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
  312. $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
  313. $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
  314. $(eval $(call BuildPlugin,iptables-mod-ipset,ipt_set ipt_SET))
  315. $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
  316. $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
  317. $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
  318. $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
  319. $(eval $(call BuildPackage,ip6tables))
  320. $(eval $(call BuildPackage,ip6tables-utils))
  321. $(eval $(call BuildPackage,libiptc))
  322. $(eval $(call BuildPackage,libxtables))