Makefile 11 KB

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