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.

200 lines
6.0 KiB

  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2009-2013 OpenWrt.org
  4. #
  5. include $(TOPDIR)/rules.mk
  6. include $(INCLUDE_DIR)/kernel.mk
  7. PKG_NAME:=xtables-addons
  8. PKG_VERSION:=3.21
  9. PKG_RELEASE:=$(AUTORELEASE)
  10. PKG_HASH:=2e09ac129a14f5e9c23b115ebcdfff4aa84e2aeba1268dbdf39b2d752bd71e19
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=https://inai.de/files/xtables-addons/
  13. PKG_BUILD_DEPENDS:=iptables
  14. PKG_INSTALL:=1
  15. PKG_BUILD_PARALLEL:=1
  16. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  17. PKG_LICENSE:=GPL-2.0
  18. PKG_LICENSE_FILES:=COPYING
  19. PKG_FIXUP:=autoreconf
  20. PKG_ASLR_PIE:=0
  21. include $(INCLUDE_DIR)/package.mk
  22. define Package/xtables-addons
  23. SECTION:=net
  24. CATEGORY:=Network
  25. SUBMENU:=Firewall
  26. TITLE:=Extensions not distributed in the main Xtables
  27. URL:=https://inai.de/projects/xtables-addons/
  28. endef
  29. # uses GNU configure
  30. CONFIGURE_ARGS+= \
  31. --with-kbuild="$(LINUX_DIR)" \
  32. --with-xtlibdir="/usr/lib/iptables"
  33. ifdef CONFIG_EXTERNAL_TOOLCHAIN
  34. MAKE_FLAGS:= \
  35. $(patsubst ARCH=%,ARCH=$(LINUX_KARCH),$(MAKE_FLAGS)) \
  36. DEPMOD="/bin/true"
  37. MAKE_INSTALL_FLAGS:= \
  38. $(patsubst ARCH=%,ARCH=$(LINUX_KARCH),$(MAKE_FLAGS)) \
  39. DEPMOD="/bin/true"
  40. else
  41. define Build/Compile
  42. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  43. $(KERNEL_MAKE_FLAGS) \
  44. DESTDIR="$(PKG_INSTALL_DIR)" \
  45. DEPMOD="/bin/true" \
  46. all
  47. endef
  48. define Build/Install
  49. $(MAKE) -C $(PKG_BUILD_DIR) \
  50. $(KERNEL_MAKE_FLAGS) \
  51. DESTDIR="$(PKG_INSTALL_DIR)" \
  52. DEPMOD="/bin/true" \
  53. install
  54. endef
  55. endif
  56. # 1: extension/module suffix used in package name
  57. # 2: extension/module display name used in package title/description
  58. # 3: list of extensions to package
  59. # 4: list of modules to package
  60. # 5: module load priority
  61. # 6: module depends
  62. define BuildTemplate
  63. ifneq ($(3),)
  64. define Package/iptables-mod-$(1)
  65. $$(call Package/xtables-addons)
  66. CATEGORY:=Network
  67. TITLE:=$(2) iptables extension
  68. DEPENDS:=iptables $(if $(4),+kmod-ipt-$(1))
  69. endef
  70. define Package/iptables-mod-$(1)/install
  71. $(INSTALL_DIR) $$(1)/usr/lib/iptables
  72. for m in $(3); do \
  73. $(CP) \
  74. $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so \
  75. $$(1)/usr/lib/iptables/ ; \
  76. done
  77. endef
  78. $$(eval $$(call BuildPackage,iptables-mod-$(1)))
  79. endif
  80. ifneq ($(4),)
  81. define KernelPackage/ipt-$(1)
  82. SUBMENU:=Netfilter Extensions
  83. TITLE:=$(2) netfilter module
  84. DEPENDS:=+kmod-ipt-core $(5)
  85. FILES:=$(foreach mod,$(4),$(PKG_BUILD_DIR)/extensions/$(mod).$(LINUX_KMOD_SUFFIX))
  86. AUTOLOAD:=$(call AutoProbe,$(notdir $(4)))
  87. endef
  88. $$(eval $$(call KernelPackage,ipt-$(1)))
  89. endif
  90. endef
  91. define Package/iptaccount
  92. $(call Package/xtables-addons)
  93. CATEGORY:=Network
  94. TITLE:=iptables-mod-account control utility
  95. DEPENDS:=iptables +iptables-mod-account
  96. endef
  97. define Package/iptaccount/install
  98. $(INSTALL_DIR) $(1)/usr/lib
  99. $(INSTALL_DIR) $(1)/usr/sbin
  100. $(CP) \
  101. $(PKG_INSTALL_DIR)/usr/lib/libxt_ACCOUNT_cl.so* \
  102. $(1)/usr/lib/
  103. $(CP) \
  104. $(PKG_INSTALL_DIR)/usr/sbin/iptaccount \
  105. $(1)/usr/sbin/
  106. endef
  107. define Package/iptgeoip
  108. $(call Package/xtables-addons)
  109. CATEGORY:=Network
  110. TITLE:=iptables-mod-geoip support scripts for MaxMind GeoIP databases
  111. DEPENDS:=iptables +iptables-mod-geoip \
  112. +perl +perlbase-getopt +perlbase-io +perl-text-csv_xs \
  113. +perl-net-cidr-lite \
  114. +wget-ssl +!BUSYBOX_CONFIG_ZCAT:gzip
  115. endef
  116. define Package/iptgeoip/config
  117. menu "Select iptgeoip options"
  118. config IPTGEOIP_PRESERVE
  119. bool "Preserve across sysupgrades"
  120. default n
  121. help
  122. Backup and restore during sysupgrade (requires >7MB)
  123. endmenu
  124. endef
  125. ifeq ($(CONFIG_IPTGEOIP_PRESERVE),y)
  126. define Package/iptgeoip/conffiles
  127. /usr/share/xt_geoip/
  128. endef
  129. endif
  130. define Package/iptgeoip/install
  131. $(INSTALL_DIR) $(1)/usr/lib/xtables-addons
  132. $(CP) \
  133. $(PKG_INSTALL_DIR)/usr/lib/xtables-addons/xt_geoip_{build,dl} \
  134. $(1)/usr/lib/xtables-addons/
  135. $(INSTALL_DIR) $(1)/usr/bin
  136. $(CP) \
  137. $(PKG_INSTALL_DIR)/usr/bin/xt_geoip_query \
  138. $(1)/usr/bin/
  139. $(INSTALL_DIR) $(1)/usr/share/xt_geoip
  140. touch $(1)/usr/share/xt_geoip/.keep
  141. endef
  142. #$(eval $(call BuildTemplate,SUFFIX,DESCRIPTION,EXTENSION,MODULE,PRIORITY,DEPENDS))
  143. $(eval $(call BuildTemplate,compat-xtables,API compatibilty layer,,compat_xtables,+IPV6:kmod-ip6tables))
  144. $(eval $(call BuildTemplate,nathelper-rtsp,RTSP Conntrack and NAT,,rtsp/nf_conntrack_rtsp rtsp/nf_nat_rtsp,+kmod-ipt-conntrack-extra +kmod-ipt-nat))
  145. $(eval $(call BuildTemplate,account,ACCOUNT,xt_ACCOUNT,ACCOUNT/xt_ACCOUNT,+kmod-ipt-compat-xtables))
  146. $(eval $(call BuildTemplate,chaos,CHAOS,xt_CHAOS,xt_CHAOS,+kmod-ipt-compat-xtables +kmod-ipt-delude +kmod-ipt-tarpit))
  147. $(eval $(call BuildTemplate,condition,Condition,xt_condition,xt_condition,))
  148. $(eval $(call BuildTemplate,delude,DELUDE,xt_DELUDE,xt_DELUDE,+kmod-ipt-compat-xtables))
  149. $(eval $(call BuildTemplate,dhcpmac,DHCPMAC,xt_DHCPMAC,xt_DHCPMAC,+kmod-ipt-compat-xtables))
  150. $(eval $(call BuildTemplate,dnetmap,DNETMAP,xt_DNETMAP,xt_DNETMAP,+kmod-ipt-compat-xtables +kmod-ipt-nat))
  151. $(eval $(call BuildTemplate,fuzzy,fuzzy,xt_fuzzy,xt_fuzzy,))
  152. $(eval $(call BuildTemplate,geoip,geoip,xt_geoip,xt_geoip,))
  153. $(eval $(call BuildTemplate,iface,iface,xt_iface,xt_iface,))
  154. $(eval $(call BuildTemplate,ipmark,IPMARK,xt_IPMARK,xt_IPMARK,+kmod-ipt-compat-xtables))
  155. $(eval $(call BuildTemplate,ipp2p,IPP2P,xt_ipp2p,xt_ipp2p,+kmod-ipt-compat-xtables))
  156. $(eval $(call BuildTemplate,ipv4options,ipv4options,xt_ipv4options,xt_ipv4options,))
  157. $(eval $(call BuildTemplate,length2,length2,xt_length2,xt_length2,+kmod-ipt-compat-xtables))
  158. $(eval $(call BuildTemplate,logmark,LOGMARK,xt_LOGMARK,xt_LOGMARK,+kmod-ipt-compat-xtables))
  159. $(eval $(call BuildTemplate,lscan,lscan,xt_lscan,xt_lscan,))
  160. $(eval $(call BuildTemplate,lua,Lua PacketScript,xt_LUA,LUA/xt_LUA,+kmod-ipt-conntrack-extra))
  161. $(eval $(call BuildTemplate,proto,PROTO,xt_PROTO,xt_PROTO,))
  162. $(eval $(call BuildTemplate,psd,psd,xt_psd,xt_psd,))
  163. $(eval $(call BuildTemplate,quota2,quota2,xt_quota2,xt_quota2,))
  164. $(eval $(call BuildTemplate,sysrq,SYSRQ,xt_SYSRQ,xt_SYSRQ,+kmod-ipt-compat-xtables +kmod-crypto-hash))
  165. $(eval $(call BuildTemplate,tarpit,TARPIT,xt_TARPIT,xt_TARPIT,+kmod-ipt-compat-xtables))
  166. $(eval $(call BuildPackage,iptaccount))
  167. $(eval $(call BuildPackage,iptgeoip))