commit:     01419bff7d75b1c283ec34ccd7238ad1aff5b577
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Thu Sep 18 23:53:56 2025 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Sat Sep 20 09:09:07 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01419bff

net-misc/zerotier: add 1.16.0

Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 net-misc/zerotier/Manifest                         |   3 +
 .../files/zerotier-1.16.0-miniupnpc-2.2.8.patch    |  59 ++++++++
 net-misc/zerotier/zerotier-1.16.0.ebuild           | 159 +++++++++++++++++++++
 3 files changed, 221 insertions(+)

diff --git a/net-misc/zerotier/Manifest b/net-misc/zerotier/Manifest
index c70ca8a8906a..07dfbe60a812 100644
--- a/net-misc/zerotier/Manifest
+++ b/net-misc/zerotier/Manifest
@@ -235,6 +235,7 @@ DIST rustversion-1.0.18.crate 17794 BLAKE2B 
fa35445404b836214bdbaa3de8e43312b6d8
 DIST ryu-1.0.18.crate 47713 BLAKE2B 
409cdf4b4e77685394018371e91ad6fdb175ac57e1df9f902871f13208515e5a2ab1daa226fc1e7291278e64448332845be4cc9409bce3b2f3daed409259e104
 SHA512 
a9b2beac778ec47e6be303148d7512ee681bd2361f6e4ac6db32c8b4baf86a8c5eb5b0d02eacd6131ae88c7b5105c57018c3050676e0b3dd1ed9c4d2fd650e84
 DIST schannel-0.1.26.crate 42791 BLAKE2B 
7066c414a30de1ffcf5badb24410371765ac3e6ab94f41892a0587495d8920c3b3809a2d7c4e0fb452f03b904062e114a3eb50b619f910a302aabc45af17db03
 SHA512 
6db6182cc076df820d44aa0bea24f96013e3f1a581bf9416d84e59e33dbd98a3a5d39a7aca9ae162cf109f1501a0edac683a3a95361bf9107780b2a280e82323
 DIST scopeguard-1.2.0.crate 11619 BLAKE2B 
8b7e9ed6cefef9ee55407fb9690d57a2a98bb93e5105aeebdb475a52485e9e185255249e1dce8f83cd80534e7402d485aac3efa7e8493b13135de27550cd4bc4
 SHA512 
6247719a15fe1e4e2d179127b9a934bd2f99367724f41175ed9522f58824b6bc69b35002eae66b35880375ff61d77ac43ddaa78cbde7160a35183a1da32d3fbb
+DIST sdk-core-4614dcb8f4ffd2cb244eb0a19d7485c896e3459e.gh.tar.gz 1001721 
BLAKE2B 
8d043df641f6dcea3d6f3e1840687fa671d2b6e8ab026aeb5a764926e53fd803292ad2464333f39efbded9188aec7b868816c2264ee0ec5363a6b566ab240f16
 SHA512 
f73294b4f32fd6ef055b2e19a6162dbc951904a14ab62d237699b79aabdb23bc0151b57cdd8a27e91503684a609a918a6e9ba7233aab5a165c9e1d4d6ce2acb7
 DIST sdk-core-730aadcc02767ae630e88f8f8c788a85d6bc81e6.gh.tar.gz 711143 
BLAKE2B 
e98be04bcee12cd1f3dd6e0d368508741238eaa8268b3610328cbffc6088c796c80f4761a69436fd2ad4f91995869f58fc61eb12fbcb7a11a6cc0e12125b94fa
 SHA512 
df1aa3f789abd2ed43edde810b9b1fbd2ea97a2d9ced7c658a1cf7b60e28e073ed16869dc723fdfcfa2ca2d87df64739ec00adc248e856b60757d8b5dda31771
 DIST sec1-0.7.3.crate 17979 BLAKE2B 
c30d4e617f9c0c21b80f14a7df88a164ad43f4c18fbedc1ec32af41193053e67ff6ea83db54f46c8cd6389d930984120c2a1688662fd8083e0c23bd4995d510b
 SHA512 
be646413d84b39a43a0af478854f47db3b167c2bf1bedf7a58392782c423aaaa38df3b3676f9807a98c6128152295c426edd16d67d62ae7048caa635bf39641e
 DIST security-framework-2.11.1.crate 80188 BLAKE2B 
844d36d2b2216cc7055687110d54ea783a7ed9bfe6375fd4dcbea267ec85531e666fe002648110315f42c3364ff5ff5aeba711cf8d1f5358ba65c8393e96f55c
 SHA512 
02786d62fd9dded80bae3942896bc8fea2a90763427f582bf5d9f127ca5682097b59b5dbff2cde373198ba659316ab5906a68d3141ba00c7408b73ebe353fac1
@@ -362,3 +363,5 @@ DIST zerocopy-0.7.35.crate 152645 BLAKE2B 
8f13123c9d9257ac5a5c6954d38c3510fa6586
 DIST zerocopy-derive-0.7.35.crate 37829 BLAKE2B 
badeb7fa5e0bfe93a6788d93fd297604ed31de526b121549300ead3c49d450f49265f499e2e7ce606dcce2b59dd01f7fa817b8fbb3f237475185c5b42f5299c4
 SHA512 
dbe23573b62a6267d7bc8c744320b75b2fbda03b908c1d175211f7394374fe182bce58021e25485c10671d726b2007f250565dfe53134d51c89293bb607e9feb
 DIST zeroize-1.8.1.crate 20029 BLAKE2B 
092eba034cd35ec47290020e0c2b213177ff5dbe14ab9e7f0b4ef3cb1ecbc42fbec2b951414e26ab00bc65aaddc2c93eddd5a1963b27c6cd613ac71c65d5cc24
 SHA512 
dd40ebe98b98fd742608d4066b5ab66caba94b2e679428fcaff9fe547d8cd6ff2360dc85d671ee9183e32fb79cb554d00d6aef9eb8f3d8ad0ec92d0435aa4ebe
 DIST zerotier-1.14.2.tar.gz 12466274 BLAKE2B 
d361fed75765671dac987808003556f50d168c4c90715e4e70ee85086b8c372ce194eea1efc333e2f7492dab55e236c0ab5126583e79eece43de83efdd1367f9
 SHA512 
9d022afcf81543d6ee938219a3712da846fe895b0fd65cfd6ec8ed173f0e208516031b6d2303ab42fd21806d9ba5ff6fdb0d850a0cbb32b268d53accb093cdf5
+DIST zerotier-1.16.0-crates.tar.xz 31694172 BLAKE2B 
9b1070591c614177d09220674a9b7f13098829e3622dc952922ee55cb1b3a2eb731f886e5fde0502ec4ea4956978dba5ced383f2c65df76809dc7e0ee8dad011
 SHA512 
2c44f5f5dcd58b9db094dc23294448de5bbc77c9140d9063369b1631ddd6b88a91d761c9aef3f96252a424e996e9a096e1f15ebfa3b17e24027a313598f8a217
+DIST zerotier-1.16.0.tar.gz 12023748 BLAKE2B 
7408a7874ad9796d01978544945b1477f68ca3d76fe5102151d99ede6a8f84c37e64fed1efce13050201ba8aa7496d7e37a57da543837a98c1e6a6f298a9dd62
 SHA512 
158ab83059ea1dcdfab073429404d6e9ef812c40e4be6b718c48e4eb9f7a9ab45f71ffdd9cf9179e6b5864a302201cbf96ee1441659ebf8a8293de57dc13a2b7

diff --git a/net-misc/zerotier/files/zerotier-1.16.0-miniupnpc-2.2.8.patch 
b/net-misc/zerotier/files/zerotier-1.16.0-miniupnpc-2.2.8.patch
new file mode 100644
index 000000000000..7ebc326aa597
--- /dev/null
+++ b/net-misc/zerotier/files/zerotier-1.16.0-miniupnpc-2.2.8.patch
@@ -0,0 +1,59 @@
+https://github.com/zerotier/ZeroTierOne/issues/2332
+https://gitlab.archlinux.org/archlinux/packaging/packages/zerotier-one/-/blob/d718c510d849ff9a8124761d51971a668591bd1e/0001-miniupnpc.patch
+
+From bc83c2df2d2063a94cda78ed9b454abe032f4ed9 Mon Sep 17 00:00:00 2001
+From: Christian Hesse <[email protected]>
+Date: Wed, 10 Sep 2025 16:28:05 +0200
+Subject: [PATCH 1/2] shrink variable size
+
+This is what upstream miniupnpc uses...
+--- a/osdep/PortMapper.cpp
++++ b/osdep/PortMapper.cpp
+@@ -195,7 +195,7 @@ class PortMapperImpl {
+                       // UPnP mode
+                       // 
---------------------------------------------------------------------
+                       if (mode == 1) {
+-                              char lanaddr[4096];
++                              char lanaddr[64];
+                               char externalip[4096];   // no range checking? 
so make these buffers larger than any UDP packet a uPnP server could send us as 
a precaution :P
+                               char inport[16];
+                               char outport[16];
+
+From 2bad879a04caec036e4ee35879f2353f2dac71bf Mon Sep 17 00:00:00 2001
+From: Christian Hesse <[email protected]>
+Date: Wed, 10 Sep 2025 16:30:21 +0200
+Subject: [PATCH 2/2] add missing function parameter
+
+This changed with miniupnpc 2.2.8:
+
+https://github.com/miniupnp/miniupnp/commit/c0a50ce33e3b99ce8a96fd43049bb5b53ffac62f
+
+Warning: This is not a proper patch suitable for upstream! It assumes the
+parameter is always there, which is not true for older versions.
+So handle with care!
+--- a/osdep/PortMapper.cpp
++++ b/osdep/PortMapper.cpp
+@@ -196,6 +196,7 @@ class PortMapperImpl {
+                       // 
---------------------------------------------------------------------
+                       if (mode == 1) {
+                               char lanaddr[64];
++                              char wanaddr[64];
+                               char externalip[4096];   // no range checking? 
so make these buffers larger than any UDP packet a uPnP server could send us as 
a precaution :P
+                               char inport[16];
+                               char outport[16];
+@@ -216,13 +217,14 @@ class PortMapperImpl {
+ #endif
+ 
+                                       memset(lanaddr, 0, sizeof(lanaddr));
++                                      memset(wanaddr, 0, sizeof(wanaddr));
+                                       memset(externalip, 0, 
sizeof(externalip));
+                                       memset(&urls, 0, sizeof(urls));
+                                       memset(&data, 0, sizeof(data));
+                                       OSUtils::ztsnprintf(inport, 
sizeof(inport), "%d", localPort);
+ 
+                                       int foundValidIGD = 0;
+-                                      if ((foundValidIGD = 
UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr))) && 
(lanaddr[0])) {
++                                      if ((foundValidIGD = 
UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), wanaddr, 
sizeof(wanaddr))) && (lanaddr[0])) {
+ #ifdef ZT_PORTMAPPER_TRACE
+                                               PM_TRACE("PortMapper: UPnP: my 
LAN IP address: %s" ZT_EOL_S, lanaddr);
+ #endif

diff --git a/net-misc/zerotier/zerotier-1.16.0.ebuild 
b/net-misc/zerotier/zerotier-1.16.0.ebuild
new file mode 100644
index 000000000000..865c125ed434
--- /dev/null
+++ b/net-misc/zerotier/zerotier-1.16.0.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CRATES="
+"
+
+declare -A GIT_CRATES=(
+       
[jwt]='https://github.com/glimberg/rust-jwt;61a9291fdeec747c6edf14f4fa0caf235136c168;rust-jwt-%commit%'
+       
[rustfsm]='https://github.com/temporalio/sdk-core;4614dcb8f4ffd2cb244eb0a19d7485c896e3459e;sdk-core-%commit%/fsm'
+       
[rustfsm_procmacro]='https://github.com/temporalio/sdk-core;4614dcb8f4ffd2cb244eb0a19d7485c896e3459e;sdk-core-%commit%/fsm/rustfsm_procmacro'
+       
[rustfsm_trait]='https://github.com/temporalio/sdk-core;4614dcb8f4ffd2cb244eb0a19d7485c896e3459e;sdk-core-%commit%/fsm/rustfsm_trait'
+       
[temporal-client]='https://github.com/temporalio/sdk-core;4614dcb8f4ffd2cb244eb0a19d7485c896e3459e;sdk-core-%commit%/client'
+       
[temporal-sdk-core-api]='https://github.com/temporalio/sdk-core;4614dcb8f4ffd2cb244eb0a19d7485c896e3459e;sdk-core-%commit%/core-api'
+       
[temporal-sdk-core-protos]='https://github.com/temporalio/sdk-core;4614dcb8f4ffd2cb244eb0a19d7485c896e3459e;sdk-core-%commit%/sdk-core-protos'
+       
[temporal-sdk-core]='https://github.com/temporalio/sdk-core;4614dcb8f4ffd2cb244eb0a19d7485c896e3459e;sdk-core-%commit%/core'
+       
[temporal-sdk]='https://github.com/temporalio/sdk-core;4614dcb8f4ffd2cb244eb0a19d7485c896e3459e;sdk-core-%commit%/sdk'
+)
+
+CARGO_OPTIONAL=1
+RUST_MIN_VER="1.88"
+RUST_OPTIONAL=1
+
+inherit cargo systemd toolchain-funcs
+
+DESCRIPTION="A software-based managed Ethernet switch for planet Earth"
+HOMEPAGE="https://www.zerotier.com/";
+SRC_URI="
+       https://github.com/zerotier/ZeroTierOne/archive/refs/tags/${PV}.tar.gz 
-> ${P}.tar.gz
+       sso? ( ${CARGO_CRATE_URIS} )
+"
+if [[ ${PKGBUMPING} != ${PVR} ]]; then
+       SRC_URI+="
+               sso? (
+                       
https://gitlab.com/api/v4/projects/32909921/packages/generic/${PN}/${PV}/${P}-crates.tar.xz
+               )
+       "
+fi
+S="${WORKDIR}"/ZeroTierOne-${PV}
+
+LICENSE="MPL-2.0"
+# Dependent crate licenses
+LICENSE+=" sso? ( 0BSD Apache-2.0 BSD ISC MIT MPL-2.0 Unicode-3.0 ZLIB )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
+IUSE="cpu_flags_arm_neon debug sso"
+
+# https://github.com/zerotier/ZeroTierOne/pull/2453
+# >=miniupnpnc-2.2.8: 
https://gitlab.archlinux.org/archlinux/packaging/packages/zerotier-one/-/commit/1d040aee9a4cfecdcc747cb42f92a1420a42a3f4
+RDEPEND="
+       dev-libs/openssl:=
+       net-libs/libnatpmp
+       >=net-libs/miniupnpc-2.2.8:=
+"
+DEPEND="
+       ${RDEPEND}
+       dev-cpp/nlohmann_json
+"
+BDEPEND="
+       virtual/pkgconfig
+       sso? ( ${RUST_DEPEND} )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.10.1-add-armv7a-support.patch
+       "${FILESDIR}"/${PN}-1.16.0-miniupnpc-2.2.8.patch
+)
+
+DOCS=( README.md )
+
+pkg_setup() {
+       if use sso ; then
+               rust_pkg_setup
+       fi
+}
+
+src_unpack() {
+       if use sso ; then
+               cargo_src_unpack
+       else
+               default
+       fi
+}
+
+src_prepare() {
+       default
+
+       # Remove vendored code to avoid mixing vendored and system headers,
+       # otherwise it will hide api breaks at build time such as:
+       # https://github.com/zerotier/ZeroTierOne/issues/2332
+       rm -r ext/{miniupnpc,libnatpmp,nlohmann} || die
+       rm -r ext/hiredis-* || die
+       # keep opentelemetry-cpp-api-only to avoid dependency for now
+       rm -r ext/opentelemetry-cpp-1.21.0 || die
+       rm -r ext/redis-plus-plus-* || die
+       rm -r ext/libpqxx-* || die
+       # header only dependency that could be packaged
+       #rm -r ext/inja || die
+       # 
https://github.com/zerotier/ZeroTierOne/issues/355#issuecomment-232086084
+       #rm -r ext/http-parser || die
+       # Messy and needs proper patches
+       #rm -r ext/cpp-httplib || die
+
+       # Remove man page compression and install, we'll handle it with ebuild 
functions
+       sed -e '/install:/,/^$/ { /man[0-9]/d }' \
+               -i make-linux.mk || die
+}
+
+src_configure() {
+       tc-export CXX CC
+
+       myemakeargs=(
+               CC="${CC}"
+               CXX="${CXX}"
+               STRIP=:
+
+               ZT_DISABLE_NEON="$(usex !cpu_flags_arm_neon 1 0)"
+
+               # Debug doesnt do more than add preprocessor arguments normally,
+               # but when rust is used it sets the correct rust directory to 
link against.
+               # It would be added by cargo eclass eitherway, so instead of 
adding REQUIRED_USE
+               # and patching the makefile its just easier to have it.
+               ZT_DEBUG="$(usex debug 1 0)"
+               ZT_SSO_SUPPORTED="$(usex sso 1 0)"
+
+               # TODO:
+               # commercial source-available license
+               # Needs more work to build properly against system packages
+               ZT_CONTROLLER=0
+               ZT_OTEL=0
+       )
+
+       if use sso ; then
+               cargo_src_configure
+       fi
+}
+
+src_compile() {
+       if use sso ; then
+               cargo_env emake "${myemakeargs[@]}" one
+       else
+               emake "${myemakeargs[@]}" one
+       fi
+}
+
+src_test() {
+       emake "${myemakeargs[@]}" selftest
+       ./zerotier-selftest || die
+}
+
+src_install() {
+       default
+
+       newinitd "${FILESDIR}/${PN}".init-r1 "${PN}"
+       systemd_dounit "${FILESDIR}/${PN}".service
+
+       doman doc/zerotier-{cli.1,idtool.1,one.8}
+}

Reply via email to