Makefile 20 KB

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