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.

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