You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
5.6 KiB

  1. #
  2. # Copyright (C) 2009-2013 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:=xtables-addons
  10. PKG_VERSION:=2.14
  11. PKG_RELEASE:=8
  12. PKG_HASH:=d215a9a8b8e66aae04b982fa2e1228e8a71e7dfe42320df99e34e5000cbdf152
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  14. PKG_SOURCE_URL:=@SF/xtables-addons
  15. PKG_BUILD_DEPENDS:=iptables
  16. PKG_INSTALL:=1
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_CHECK_FORMAT_SECURITY:=0
  19. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  20. PKG_LICENSE:=GPL-2.0
  21. PKG_FIXUP:=autoreconf
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/xtables-addons
  24. SECTION:=net
  25. CATEGORY:=Network
  26. SUBMENU:=Firewall
  27. TITLE:=Extensions not distributed in the main Xtables
  28. URL:=http://xtables-addons.sourceforge.net/
  29. endef
  30. # uses GNU configure
  31. CONFIGURE_ARGS+= \
  32. --with-kbuild="$(LINUX_DIR)" \
  33. --with-xtlibdir="/usr/lib/iptables"
  34. ifdef CONFIG_EXTERNAL_TOOLCHAIN
  35. MAKE_FLAGS:= \
  36. $(patsubst ARCH=%,ARCH=$(LINUX_KARCH),$(MAKE_FLAGS)) \
  37. DEPMOD="/bin/true"
  38. MAKE_INSTALL_FLAGS:= \
  39. $(patsubst ARCH=%,ARCH=$(LINUX_KARCH),$(MAKE_FLAGS)) \
  40. DEPMOD="/bin/true"
  41. else
  42. define Build/Compile
  43. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  44. $(KERNEL_MAKE_FLAGS) \
  45. DESTDIR="$(PKG_INSTALL_DIR)" \
  46. DEPMOD="/bin/true" \
  47. all
  48. endef
  49. define Build/Install
  50. $(MAKE) -C $(PKG_BUILD_DIR) \
  51. $(KERNEL_MAKE_FLAGS) \
  52. DESTDIR="$(PKG_INSTALL_DIR)" \
  53. DEPMOD="/bin/true" \
  54. install
  55. endef
  56. endif
  57. # 1: extension/module suffix used in package name
  58. # 2: extension/module display name used in package title/description
  59. # 3: list of extensions to package
  60. # 4: list of modules to package
  61. # 5: module load priority
  62. # 6: module depends
  63. define BuildTemplate
  64. ifneq ($(3),)
  65. define Package/iptables-mod-$(1)
  66. $$(call Package/xtables-addons)
  67. CATEGORY:=Network
  68. TITLE:=$(2) iptables extension
  69. DEPENDS:=iptables $(if $(4),+kmod-ipt-$(1))
  70. endef
  71. define Package/iptables-mod-$(1)/install
  72. $(INSTALL_DIR) $$(1)/usr/lib/iptables
  73. for m in $(3); do \
  74. $(CP) \
  75. $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so \
  76. $$(1)/usr/lib/iptables/ ; \
  77. done
  78. endef
  79. $$(eval $$(call BuildPackage,iptables-mod-$(1)))
  80. endif
  81. ifneq ($(4),)
  82. define KernelPackage/ipt-$(1)
  83. SUBMENU:=Netfilter Extensions
  84. TITLE:=$(2) netfilter module
  85. DEPENDS:=+kmod-ipt-core $(5)
  86. FILES:=$(foreach mod,$(4),$(PKG_BUILD_DIR)/extensions/$(mod).$(LINUX_KMOD_SUFFIX))
  87. AUTOLOAD:=$(call AutoProbe,$(notdir $(4)))
  88. endef
  89. $$(eval $$(call KernelPackage,ipt-$(1)))
  90. endif
  91. endef
  92. define Package/iptaccount
  93. $(call Package/xtables-addons)
  94. CATEGORY:=Network
  95. TITLE:=iptables-mod-account control utility
  96. DEPENDS:=iptables +iptables-mod-account
  97. endef
  98. define Package/iptaccount/install
  99. $(INSTALL_DIR) $(1)/usr/lib
  100. $(INSTALL_DIR) $(1)/usr/sbin
  101. $(CP) \
  102. $(PKG_INSTALL_DIR)/usr/lib/libxt_ACCOUNT_cl.so* \
  103. $(1)/usr/lib/
  104. $(CP) \
  105. $(PKG_INSTALL_DIR)/usr/sbin/iptaccount \
  106. $(1)/usr/sbin/
  107. endef
  108. define Package/iptgeoip
  109. $(call Package/xtables-addons)
  110. CATEGORY:=Network
  111. TITLE:=iptables-mod-geoip support scripts for MaxMind GeoIP databases
  112. # we could also use wget-nossl but that's more complicated than our
  113. # syntax of dependencies permits...
  114. DEPENDS:=iptables +iptables-mod-geoip \
  115. +perl +perlbase-getopt +perlbase-io +perl-text-csv_xs \
  116. +!BUSYBOX_CONFIG_WGET:wget +!BUSYBOX_CONFIG_GZIP:gzip +!BUSYBOX_CONFIG_UNZIP:unzip
  117. endef
  118. define Package/iptgeoip/install
  119. $(INSTALL_DIR) $(1)/usr/lib/xtables-addons
  120. $(CP) \
  121. $(PKG_INSTALL_DIR)/usr/lib/xtables-addons/xt_geoip_{build,dl} \
  122. $(1)/usr/lib/xtables-addons/
  123. $(INSTALL_DIR) $(1)/usr/share/xt_geoip
  124. endef
  125. #$(eval $(call BuildTemplate,SUFFIX,DESCRIPTION,EXTENSION,MODULE,PRIORITY,DEPENDS))
  126. $(eval $(call BuildTemplate,compat-xtables,API compatibilty layer,,compat_xtables,+IPV6:kmod-ip6tables))
  127. $(eval $(call BuildTemplate,nathelper-rtsp,RTSP Conntrack and NAT,,rtsp/nf_conntrack_rtsp rtsp/nf_nat_rtsp,+kmod-ipt-conntrack-extra +kmod-ipt-nat))
  128. $(eval $(call BuildTemplate,account,ACCOUNT,xt_ACCOUNT,ACCOUNT/xt_ACCOUNT,+kmod-ipt-compat-xtables))
  129. $(eval $(call BuildTemplate,chaos,CHAOS,xt_CHAOS,xt_CHAOS,+kmod-ipt-compat-xtables +kmod-ipt-delude +kmod-ipt-tarpit))
  130. $(eval $(call BuildTemplate,condition,Condition,xt_condition,xt_condition,))
  131. $(eval $(call BuildTemplate,delude,DELUDE,xt_DELUDE,xt_DELUDE,+kmod-ipt-compat-xtables))
  132. $(eval $(call BuildTemplate,dhcpmac,DHCPMAC,xt_DHCPMAC,xt_DHCPMAC,+kmod-ipt-compat-xtables))
  133. $(eval $(call BuildTemplate,dnetmap,DNETMAP,xt_DNETMAP,xt_DNETMAP,+kmod-ipt-compat-xtables +kmod-ipt-nat))
  134. $(eval $(call BuildTemplate,fuzzy,fuzzy,xt_fuzzy,xt_fuzzy,))
  135. $(eval $(call BuildTemplate,geoip,geoip,xt_geoip,xt_geoip,))
  136. $(eval $(call BuildTemplate,iface,iface,xt_iface,xt_iface,))
  137. $(eval $(call BuildTemplate,ipmark,IPMARK,xt_IPMARK,xt_IPMARK,+kmod-ipt-compat-xtables))
  138. $(eval $(call BuildTemplate,ipp2p,IPP2P,xt_ipp2p,xt_ipp2p,+kmod-ipt-compat-xtables))
  139. $(eval $(call BuildTemplate,ipv4options,ipv4options,xt_ipv4options,xt_ipv4options,))
  140. $(eval $(call BuildTemplate,length2,length2,xt_length2,xt_length2,+kmod-ipt-compat-xtables))
  141. $(eval $(call BuildTemplate,logmark,LOGMARK,xt_LOGMARK,xt_LOGMARK,+kmod-ipt-compat-xtables))
  142. $(eval $(call BuildTemplate,lscan,lscan,xt_lscan,xt_lscan,))
  143. $(eval $(call BuildTemplate,lua,Lua PacketScript,xt_LUA,LUA/xt_LUA,+kmod-ipt-conntrack-extra))
  144. $(eval $(call BuildTemplate,psd,psd,xt_psd,xt_psd,))
  145. $(eval $(call BuildTemplate,quota2,quota2,xt_quota2,xt_quota2,))
  146. $(eval $(call BuildTemplate,sysrq,SYSRQ,xt_SYSRQ,xt_SYSRQ,+kmod-ipt-compat-xtables +kmod-crypto-hash))
  147. $(eval $(call BuildTemplate,tarpit,TARPIT,xt_TARPIT,xt_TARPIT,+kmod-ipt-compat-xtables))
  148. $(eval $(call BuildPackage,iptaccount))
  149. $(eval $(call BuildPackage,iptgeoip))