Makefile 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. #
  2. # Copyright (C) 2006-2016 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.8.8
  11. PKG_RELEASE:=1
  12. PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  14. PKG_HASH:=71c75889dc710676631553eb1511da0177bbaaf1b551265b912d236c3f51859f
  15. PKG_FIXUP:=autoreconf
  16. PKG_FLAGS:=nonshared
  17. PKG_INSTALL:=1
  18. PKG_BUILD_PARALLEL:=1
  19. PKG_LICENSE:=GPL-2.0
  20. PKG_CPE_ID:=cpe:/a:netfilter_core_team:iptables
  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 grep 'NETFILTER' $(LINUX_DIR)/.config | $(MKHASH) md5)
  26. endif
  27. define Package/iptables/Default
  28. SECTION:=net
  29. CATEGORY:=Network
  30. SUBMENU:=Firewall
  31. URL:=https://netfilter.org/
  32. endef
  33. define Package/iptables/Module
  34. $(call Package/iptables/Default)
  35. DEPENDS:=+libxtables $(1)
  36. endef
  37. define Package/xtables-legacy
  38. $(call Package/iptables/Default)
  39. TITLE:=IP firewall administration tool
  40. DEPENDS+= +kmod-ipt-core +libip4tc +IPV6:libip6tc +libiptext +IPV6:libiptext6 +libxtables
  41. endef
  42. define Package/iptables-zz-legacy
  43. $(call Package/iptables/Default)
  44. TITLE:=IP firewall administration tool
  45. DEPENDS+= +xtables-legacy
  46. PROVIDES:=iptables iptables-legacy
  47. ALTERNATIVES:=\
  48. 200:/usr/sbin/iptables:/usr/sbin/xtables-legacy-multi \
  49. 200:/usr/sbin/iptables-restore:/usr/sbin/xtables-legacy-multi \
  50. 200:/usr/sbin/iptables-save:/usr/sbin/xtables-legacy-multi
  51. endef
  52. define Package/iptables-zz-legacy/description
  53. IP firewall administration tool.
  54. Matches:
  55. - icmp
  56. - tcp
  57. - udp
  58. - comment
  59. - conntrack
  60. - limit
  61. - mac
  62. - mark
  63. - multiport
  64. - set
  65. - state
  66. - time
  67. Targets:
  68. - ACCEPT
  69. - CT
  70. - DNAT
  71. - DROP
  72. - REJECT
  73. - FLOWOFFLOAD
  74. - LOG
  75. - MARK
  76. - MASQUERADE
  77. - REDIRECT
  78. - SET
  79. - SNAT
  80. - TCPMSS
  81. Tables:
  82. - filter
  83. - mangle
  84. - nat
  85. - raw
  86. endef
  87. define Package/xtables-nft
  88. $(call Package/iptables/Default)
  89. TITLE:=IP firewall administration tool nft
  90. DEPENDS:=+libnftnl +libiptext +IPV6:libiptext6 +libiptext-nft +kmod-nft-compat
  91. endef
  92. define Package/arptables-nft
  93. $(call Package/iptables/Default)
  94. DEPENDS:=+kmod-nft-arp +xtables-nft +kmod-arptables
  95. TITLE:=ARP firewall administration tool nft
  96. PROVIDES:=arptables
  97. ALTERNATIVES:=\
  98. 300:/usr/sbin/arptables:/usr/sbin/xtables-nft-multi \
  99. 300:/usr/sbin/arptables-restore:/usr/sbin/xtables-nft-multi \
  100. 300:/usr/sbin/arptables-save:/usr/sbin/xtables-nft-multi
  101. endef
  102. define Package/ebtables-nft
  103. $(call Package/iptables/Default)
  104. DEPENDS:=+kmod-nft-bridge +xtables-nft +kmod-ebtables
  105. TITLE:=Bridge firewall administration tool nft
  106. PROVIDES:=ebtables
  107. ALTERNATIVES:=\
  108. 300:/usr/sbin/ebtables:/usr/sbin/xtables-nft-multi \
  109. 300:/usr/sbin/ebtables-restore:/usr/sbin/xtables-nft-multi \
  110. 300:/usr/sbin/ebtables-save:/usr/sbin/xtables-nft-multi
  111. endef
  112. define Package/iptables-nft
  113. $(call Package/iptables/Default)
  114. TITLE:=IP firewall administration tool nft
  115. DEPENDS:=+kmod-ipt-core +xtables-nft
  116. PROVIDES:=iptables
  117. ALTERNATIVES:=\
  118. 300:/usr/sbin/iptables:/usr/sbin/xtables-nft-multi \
  119. 300:/usr/sbin/iptables-restore:/usr/sbin/xtables-nft-multi \
  120. 300:/usr/sbin/iptables-save:/usr/sbin/xtables-nft-multi
  121. endef
  122. define Package/iptables-nft/description
  123. Extra iptables nftables nft binaries.
  124. iptables-nft
  125. iptables-nft-restore
  126. iptables-nft-save
  127. iptables-translate
  128. iptables-restore-translate
  129. endef
  130. define Package/iptables-mod-conntrack-extra
  131. $(call Package/iptables/Module, +kmod-ipt-conntrack-extra +kmod-ipt-raw)
  132. TITLE:=Extra connection tracking extensions
  133. endef
  134. define Package/iptables-mod-conntrack-extra/description
  135. Extra iptables extensions for connection tracking.
  136. Matches:
  137. - connbytes
  138. - connlimit
  139. - connmark
  140. - recent
  141. - helper
  142. Targets:
  143. - CONNMARK
  144. endef
  145. define Package/iptables-mod-conntrack-label
  146. $(call Package/iptables/Module, +kmod-ipt-conntrack-label @IPTABLES_CONNLABEL)
  147. TITLE:=Connection tracking labeling extension
  148. DEFAULT:=y if IPTABLES_CONNLABEL
  149. endef
  150. define Package/iptables-mod-conntrack-label/description
  151. Match and set label(s) on connection tracking entries
  152. Matches:
  153. - connlabel
  154. endef
  155. define Package/iptables-mod-filter
  156. $(call Package/iptables/Module, +kmod-ipt-filter)
  157. TITLE:=Content inspection extensions
  158. endef
  159. define Package/iptables-mod-filter/description
  160. iptables extensions for packet content inspection.
  161. Includes support for:
  162. Matches:
  163. - string
  164. - bpf
  165. endef
  166. define Package/iptables-mod-ipopt
  167. $(call Package/iptables/Module, +kmod-ipt-ipopt)
  168. TITLE:=IP/Packet option extensions
  169. endef
  170. define Package/iptables-mod-ipopt/description
  171. iptables extensions for matching/changing IP packet options.
  172. Matches:
  173. - dscp
  174. - ecn
  175. - length
  176. - statistic
  177. - tcpmss
  178. - unclean
  179. - hl
  180. Targets:
  181. - DSCP
  182. - CLASSIFY
  183. - ECN
  184. - HL
  185. endef
  186. define Package/iptables-mod-ipsec
  187. $(call Package/iptables/Module, +kmod-ipt-ipsec)
  188. TITLE:=IPsec extensions
  189. endef
  190. define Package/iptables-mod-ipsec/description
  191. iptables extensions for matching ipsec traffic.
  192. Matches:
  193. - ah
  194. - esp
  195. - policy
  196. endef
  197. define Package/iptables-mod-nat-extra
  198. $(call Package/iptables/Module, +kmod-ipt-nat-extra)
  199. TITLE:=Extra NAT extensions
  200. endef
  201. define Package/iptables-mod-nat-extra/description
  202. iptables extensions for extra NAT targets.
  203. Targets:
  204. - MIRROR
  205. - NETMAP
  206. endef
  207. define Package/iptables-mod-nflog
  208. $(call Package/iptables/Module, +kmod-nfnetlink-log +kmod-ipt-nflog)
  209. TITLE:=Netfilter NFLOG target
  210. endef
  211. define Package/iptables-mod-nflog/description
  212. iptables extension for user-space logging via NFNETLINK.
  213. Includes:
  214. - libxt_NFLOG
  215. endef
  216. define Package/iptables-mod-trace
  217. $(call Package/iptables/Module, +kmod-ipt-debug)
  218. TITLE:=Netfilter TRACE target
  219. endef
  220. define Package/iptables-mod-trace/description
  221. iptables extension for TRACE target
  222. Includes:
  223. - libxt_TRACE
  224. endef
  225. define Package/iptables-mod-nfqueue
  226. $(call Package/iptables/Module, +kmod-nfnetlink-queue +kmod-ipt-nfqueue)
  227. TITLE:=Netfilter NFQUEUE target
  228. endef
  229. define Package/iptables-mod-nfqueue/description
  230. iptables extension for user-space queuing via NFNETLINK.
  231. Includes:
  232. - libxt_NFQUEUE
  233. endef
  234. define Package/iptables-mod-hashlimit
  235. $(call Package/iptables/Module, +kmod-ipt-hashlimit)
  236. TITLE:=hashlimit matching
  237. endef
  238. define Package/iptables-mod-hashlimit/description
  239. iptables extensions for hashlimit matching
  240. Matches:
  241. - hashlimit
  242. endef
  243. define Package/iptables-mod-rpfilter
  244. $(call Package/iptables/Module, +kmod-ipt-rpfilter)
  245. TITLE:=rpfilter iptables extension
  246. endef
  247. define Package/iptables-mod-rpfilter/description
  248. iptables extensions for reverse path filter test on a packet
  249. Matches:
  250. - rpfilter
  251. endef
  252. define Package/iptables-mod-iprange
  253. $(call Package/iptables/Module, +kmod-ipt-iprange)
  254. TITLE:=IP range extension
  255. endef
  256. define Package/iptables-mod-iprange/description
  257. iptables extensions for matching ip ranges.
  258. Matches:
  259. - iprange
  260. endef
  261. define Package/iptables-mod-cluster
  262. $(call Package/iptables/Module, +kmod-ipt-cluster)
  263. TITLE:=Match cluster extension
  264. endef
  265. define Package/iptables-mod-cluster/description
  266. iptables extensions for matching cluster.
  267. Netfilter (IPv4/IPv6) module for matching cluster
  268. This option allows you to build work-load-sharing clusters of
  269. network servers/stateful firewalls without having a dedicated
  270. load-balancing router/server/switch. Basically, this match returns
  271. true when the packet must be handled by this cluster node. Thus,
  272. all nodes see all packets and this match decides which node handles
  273. what packets. The work-load sharing algorithm is based on source
  274. address hashing.
  275. This module is usable for ipv4 and ipv6.
  276. If you select it, it enables kmod-ipt-cluster.
  277. see `iptables -m cluster --help` for more information.
  278. endef
  279. define Package/iptables-mod-clusterip
  280. $(call Package/iptables/Module, +kmod-ipt-clusterip)
  281. TITLE:=Clusterip extension
  282. endef
  283. define Package/iptables-mod-clusterip/description
  284. iptables extensions for CLUSTERIP.
  285. The CLUSTERIP target allows you to build load-balancing clusters of
  286. network servers without having a dedicated load-balancing
  287. router/server/switch.
  288. If you select it, it enables kmod-ipt-clusterip.
  289. see `iptables -j CLUSTERIP --help` for more information.
  290. endef
  291. define Package/iptables-mod-extra
  292. $(call Package/iptables/Module, +kmod-ipt-extra)
  293. TITLE:=Other extra iptables extensions
  294. endef
  295. define Package/iptables-mod-extra/description
  296. Other extra iptables extensions.
  297. Matches:
  298. - addrtype
  299. - condition
  300. - owner
  301. - pkttype
  302. - quota
  303. endef
  304. define Package/iptables-mod-physdev
  305. $(call Package/iptables/Module, +kmod-ipt-physdev)
  306. TITLE:=physdev iptables extension
  307. endef
  308. define Package/iptables-mod-physdev/description
  309. The iptables physdev match.
  310. endef
  311. define Package/iptables-mod-led
  312. $(call Package/iptables/Module, +kmod-ipt-led)
  313. TITLE:=LED trigger iptables extension
  314. endef
  315. define Package/iptables-mod-led/description
  316. iptables extension for triggering a LED.
  317. Targets:
  318. - LED
  319. endef
  320. define Package/iptables-mod-socket
  321. $(call Package/iptables/Module, +kmod-ipt-socket)
  322. TITLE:=Socket match iptables extensions
  323. endef
  324. define Package/iptables-mod-socket/description
  325. Socket match iptables extensions.
  326. Matches:
  327. - socket
  328. endef
  329. define Package/iptables-mod-tproxy
  330. $(call Package/iptables/Module, +kmod-ipt-tproxy)
  331. TITLE:=Transparent proxy iptables extensions
  332. endef
  333. define Package/iptables-mod-tproxy/description
  334. Transparent proxy iptables extensions.
  335. Targets:
  336. - TPROXY
  337. endef
  338. define Package/iptables-mod-tee
  339. $(call Package/iptables/Module, +kmod-ipt-tee)
  340. TITLE:=TEE iptables extensions
  341. endef
  342. define Package/iptables-mod-tee/description
  343. TEE iptables extensions.
  344. Targets:
  345. - TEE
  346. endef
  347. define Package/iptables-mod-u32
  348. $(call Package/iptables/Module, +kmod-ipt-u32)
  349. TITLE:=U32 iptables extensions
  350. endef
  351. define Package/iptables-mod-u32/description
  352. U32 iptables extensions.
  353. Matches:
  354. - u32
  355. endef
  356. define Package/iptables-mod-checksum
  357. $(call Package/iptables/Module, +kmod-ipt-checksum)
  358. TITLE:=IP CHECKSUM target extension
  359. endef
  360. define Package/iptables-mod-checksum/description
  361. iptables extension for the CHECKSUM calculation target
  362. endef
  363. define Package/ip6tables-zz-legacy
  364. $(call Package/iptables/Default)
  365. DEPENDS:=@IPV6 +kmod-ip6tables +xtables-legacy
  366. CATEGORY:=Network
  367. TITLE:=IPv6 firewall administration tool
  368. PROVIDES:=ip6tables ip6tables-legacy
  369. ALTERNATIVES:=\
  370. 200:/usr/sbin/ip6tables:/usr/sbin/xtables-legacy-multi \
  371. 200:/usr/sbin/ip6tables-restore:/usr/sbin/xtables-legacy-multi \
  372. 200:/usr/sbin/ip6tables-save:/usr/sbin/xtables-legacy-multi
  373. endef
  374. define Package/ip6tables-nft
  375. $(call Package/iptables/Default)
  376. DEPENDS:=@IPV6 +kmod-ip6tables +xtables-nft
  377. TITLE:=IP firewall administration tool nft
  378. PROVIDES:=ip6tables
  379. ALTERNATIVES:=\
  380. 300:/usr/sbin/ip6tables:/usr/sbin/xtables-nft-multi \
  381. 300:/usr/sbin/ip6tables-restore:/usr/sbin/xtables-nft-multi \
  382. 300:/usr/sbin/ip6tables-save:/usr/sbin/xtables-nft-multi
  383. endef
  384. define Package/ip6tables-nft/description
  385. Extra ip6tables nftables nft binaries.
  386. ip6tables-nft
  387. ip6tables-nft-restore
  388. ip6tables-nft-save
  389. ip6tables-translate
  390. ip6tables-restore-translate
  391. endef
  392. define Package/ip6tables-extra
  393. $(call Package/iptables/Default)
  394. DEPENDS:=+libxtables +kmod-ip6tables-extra
  395. TITLE:=IPv6 header matching modules
  396. endef
  397. define Package/ip6tables-extra/description
  398. iptables header matching modules for IPv6
  399. endef
  400. define Package/ip6tables-mod-nat
  401. $(call Package/iptables/Default)
  402. DEPENDS:=+libxtables +kmod-ipt-nat6
  403. TITLE:=IPv6 NAT extensions
  404. endef
  405. define Package/ip6tables-mod-nat/description
  406. iptables extensions for IPv6-NAT targets.
  407. endef
  408. define Package/libip4tc
  409. $(call Package/iptables/Default)
  410. SECTION:=libs
  411. CATEGORY:=Libraries
  412. TITLE:=IPv4 firewall - shared libiptc library
  413. ABI_VERSION:=2
  414. endef
  415. define Package/libip6tc
  416. $(call Package/iptables/Default)
  417. SECTION:=libs
  418. CATEGORY:=Libraries
  419. TITLE:=IPv6 firewall - shared libiptc library
  420. ABI_VERSION:=2
  421. endef
  422. define Package/libiptext
  423. $(call Package/iptables/Default)
  424. SECTION:=libs
  425. CATEGORY:=Libraries
  426. TITLE:=IPv4 firewall - shared libiptext library
  427. ABI_VERSION:=0
  428. DEPENDS:=+libxtables
  429. endef
  430. define Package/libiptext6
  431. $(call Package/iptables/Default)
  432. SECTION:=libs
  433. CATEGORY:=Libraries
  434. TITLE:=IPv6 firewall - shared libiptext library
  435. ABI_VERSION:=0
  436. DEPENDS:=+libxtables
  437. endef
  438. define Package/libiptext-nft
  439. $(call Package/iptables/Default)
  440. SECTION:=libs
  441. CATEGORY:=Libraries
  442. TITLE:=IPv4/IPv6 firewall - shared libiptext nft library
  443. ABI_VERSION:=0
  444. DEPENDS:=+libxtables
  445. endef
  446. define Package/libxtables
  447. $(call Package/iptables/Default)
  448. SECTION:=libs
  449. CATEGORY:=Libraries
  450. TITLE:=IPv4/IPv6 firewall - shared xtables library
  451. MENU:=1
  452. ABI_VERSION:=12
  453. DEPENDS:=+IPTABLES_CONNLABEL:libnetfilter-conntrack
  454. endef
  455. define Package/libxtables/config
  456. config IPTABLES_CONNLABEL
  457. bool "Enable Connlabel support"
  458. default n
  459. help
  460. This enable connlabel support in iptables.
  461. endef
  462. TARGET_CPPFLAGS := \
  463. -I$(PKG_BUILD_DIR)/include \
  464. -I$(LINUX_DIR)/user_headers/include \
  465. $(TARGET_CPPFLAGS)
  466. TARGET_CFLAGS += \
  467. -I$(PKG_BUILD_DIR)/include \
  468. -I$(LINUX_DIR)/user_headers/include \
  469. -ffunction-sections -fdata-sections \
  470. -DNO_LEGACY
  471. TARGET_LDFLAGS += \
  472. -Wl,--gc-sections
  473. CONFIGURE_ARGS += \
  474. --enable-shared \
  475. --enable-static \
  476. --enable-devel \
  477. --with-kernel="$(LINUX_DIR)/user_headers" \
  478. --with-xtlibdir=/usr/lib/iptables \
  479. --with-xt-lock-name=/var/run/xtables.lock \
  480. $(if $(CONFIG_IPTABLES_CONNLABEL),,--disable-connlabel) \
  481. $(if $(CONFIG_IPV6),,--disable-ipv6)
  482. MAKE_FLAGS := \
  483. $(TARGET_CONFIGURE_OPTS) \
  484. COPT_FLAGS="$(TARGET_CFLAGS)" \
  485. KERNEL_DIR="$(LINUX_DIR)/user_headers/" PREFIX=/usr \
  486. KBUILD_OUTPUT="$(LINUX_DIR)" \
  487. BUILTIN_MODULES="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
  488. ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
  489. define Build/Configure/rebuild
  490. $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.\?o -or -name \*.a | $(XARGS) rm -f
  491. rm -f $(PKG_BUILD_DIR)/.config_*
  492. rm -f $(PKG_BUILD_DIR)/.configured_*
  493. touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
  494. endef
  495. endif
  496. define Build/Configure
  497. $(Build/Configure/rebuild)
  498. $(Build/Configure/Default)
  499. endef
  500. define Build/InstallDev
  501. $(INSTALL_DIR) $(1)/usr/include
  502. $(INSTALL_DIR) $(1)/usr/include/iptables
  503. $(INSTALL_DIR) $(1)/usr/include/net/netfilter
  504. # XXX: iptables header fixup, some headers are not installed by iptables anymore
  505. $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
  506. $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
  507. $(CP) $(PKG_BUILD_DIR)/include/ip6tables.h $(1)/usr/include/
  508. $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
  509. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  510. $(INSTALL_DIR) $(1)/usr/lib
  511. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
  512. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
  513. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  514. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
  515. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libip*tc.pc $(1)/usr/lib/pkgconfig/
  516. # XXX: needed by firewall3
  517. $(CP) $(PKG_BUILD_DIR)/extensions/libiptext*.so $(1)/usr/lib/
  518. endef
  519. define Package/xtables-legacy/install
  520. $(INSTALL_DIR) $(1)/usr/sbin
  521. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-legacy-multi $(1)/usr/sbin/
  522. endef
  523. define Package/iptables-zz-legacy/install
  524. $(INSTALL_DIR) $(1)/usr/sbin
  525. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-legacy{,-restore,-save} $(1)/usr/sbin/
  526. $(INSTALL_DIR) $(1)/usr/lib/iptables
  527. endef
  528. define Package/xtables-nft/install
  529. $(INSTALL_DIR) $(1)/usr/sbin
  530. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-nft-multi $(1)/usr/sbin/
  531. endef
  532. define Package/arptables-nft/install
  533. $(INSTALL_DIR) $(1)/usr/sbin
  534. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/arptables-nft{,-restore,-save} $(1)/usr/sbin/
  535. $(INSTALL_DIR) $(1)/usr/lib/iptables
  536. $(CP) $(PKG_BUILD_DIR)/extensions/libarpt_*.so $(1)/usr/lib/iptables/
  537. endef
  538. define Package/ebtables-nft/install
  539. $(INSTALL_DIR) $(1)/usr/sbin
  540. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ebtables-nft{,-restore,-save} $(1)/usr/sbin/
  541. $(INSTALL_DIR) $(1)/usr/lib/iptables
  542. $(CP) $(PKG_BUILD_DIR)/extensions/libebt_*.so $(1)/usr/lib/iptables/
  543. endef
  544. define Package/iptables-nft/install
  545. $(INSTALL_DIR) $(1)/usr/sbin
  546. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-nft{,-restore,-save} $(1)/usr/sbin/
  547. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore}-translate $(1)/usr/sbin/
  548. endef
  549. define Package/ip6tables-zz-legacy/install
  550. $(INSTALL_DIR) $(1)/usr/sbin
  551. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-legacy{,-restore,-save} $(1)/usr/sbin/
  552. endef
  553. define Package/ip6tables-nft/install
  554. $(INSTALL_DIR) $(1)/usr/sbin
  555. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-nft{,-restore,-save} $(1)/usr/sbin/
  556. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-restore}-translate $(1)/usr/sbin/
  557. endef
  558. define Package/libip4tc/install
  559. $(INSTALL_DIR) $(1)/usr/lib
  560. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so.* $(1)/usr/lib/
  561. endef
  562. define Package/libip6tc/install
  563. $(INSTALL_DIR) $(1)/usr/lib
  564. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libip6tc.so.* $(1)/usr/lib/
  565. endef
  566. define Package/libiptext/install
  567. $(INSTALL_DIR) $(1)/usr/lib
  568. $(CP) $(PKG_BUILD_DIR)/extensions/libiptext.so $(1)/usr/lib/
  569. $(CP) $(PKG_BUILD_DIR)/extensions/libiptext4.so $(1)/usr/lib/
  570. endef
  571. define Package/libiptext6/install
  572. $(INSTALL_DIR) $(1)/usr/lib
  573. $(CP) $(PKG_BUILD_DIR)/extensions/libiptext6.so $(1)/usr/lib/
  574. endef
  575. define Package/libiptext-nft/install
  576. $(INSTALL_DIR) $(1)/usr/lib
  577. $(CP) $(PKG_BUILD_DIR)/extensions/libiptext_*.so $(1)/usr/lib/
  578. endef
  579. define Package/libxtables/install
  580. $(INSTALL_DIR) $(1)/usr/lib
  581. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so.* $(1)/usr/lib/
  582. endef
  583. define BuildPlugin
  584. define Package/$(1)/install
  585. $(INSTALL_DIR) $$(1)/usr/lib/iptables
  586. for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)) $(patsubst xt_%,ip6t_%,$(2)) $(patsubst ip6t_%,xt_%,$(2)); do \
  587. if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
  588. $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
  589. fi; \
  590. done
  591. $(3)
  592. endef
  593. $$(eval $$(call BuildPackage,$(1)))
  594. endef
  595. $(eval $(call BuildPackage,libxtables))
  596. $(eval $(call BuildPackage,libip4tc))
  597. $(eval $(call BuildPackage,libip6tc))
  598. $(eval $(call BuildPackage,libiptext))
  599. $(eval $(call BuildPackage,libiptext6))
  600. $(eval $(call BuildPackage,libiptext-nft))
  601. $(eval $(call BuildPackage,xtables-legacy))
  602. $(eval $(call BuildPackage,xtables-nft))
  603. $(eval $(call BuildPackage,arptables-nft))
  604. $(eval $(call BuildPackage,ebtables-nft))
  605. $(eval $(call BuildPackage,iptables-nft))
  606. $(eval $(call BuildPackage,iptables-zz-legacy))
  607. $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
  608. $(eval $(call BuildPlugin,iptables-mod-conntrack-label,$(IPT_CONNTRACK_LABEL-m)))
  609. $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
  610. $(eval $(call BuildPlugin,iptables-mod-physdev,$(IPT_PHYSDEV-m)))
  611. $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m)))
  612. $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
  613. $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
  614. $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
  615. $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
  616. $(eval $(call BuildPlugin,iptables-mod-cluster,$(IPT_CLUSTER-m)))
  617. $(eval $(call BuildPlugin,iptables-mod-clusterip,$(IPT_CLUSTERIP-m)))
  618. $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
  619. $(eval $(call BuildPlugin,iptables-mod-rpfilter,$(IPT_RPFILTER-m)))
  620. $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
  621. $(eval $(call BuildPlugin,iptables-mod-socket,$(IPT_SOCKET-m)))
  622. $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
  623. $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
  624. $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
  625. $(eval $(call BuildPlugin,iptables-mod-nflog,$(IPT_NFLOG-m)))
  626. $(eval $(call BuildPlugin,iptables-mod-trace,$(IPT_DEBUG-m)))
  627. $(eval $(call BuildPlugin,iptables-mod-nfqueue,$(IPT_NFQUEUE-m)))
  628. $(eval $(call BuildPlugin,iptables-mod-checksum,$(IPT_CHECKSUM-m)))
  629. $(eval $(call BuildPackage,ip6tables-nft))
  630. $(eval $(call BuildPackage,ip6tables-zz-legacy))
  631. $(eval $(call BuildPlugin,ip6tables-extra,$(IPT_IPV6_EXTRA-m)))
  632. $(eval $(call BuildPlugin,ip6tables-mod-nat,$(IPT_NAT6-m)))