From 378e4ea34ef950188565182e63db40763da49699 Mon Sep 17 00:00:00 2001 From: visuve Date: Wed, 10 Aug 2022 17:08:51 +0300 Subject: [PATCH 01/31] Fix service installation MAX_PATH bug on Windows - On newer Windows, a path might hold up to 32,767 characters - https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation - The previous installation did not also check for ERROR_INSUFFICIENT_BUFFER which could lead to an ill formatted path --- windows/ZeroTierOne/ServiceInstaller.cpp | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/windows/ZeroTierOne/ServiceInstaller.cpp b/windows/ZeroTierOne/ServiceInstaller.cpp index 05a78002e..39a0519f8 100644 --- a/windows/ZeroTierOne/ServiceInstaller.cpp +++ b/windows/ZeroTierOne/ServiceInstaller.cpp @@ -49,28 +49,34 @@ std::string InstallService(PSTR pszServiceName, PSTR pszAccount, PSTR pszPassword) { - std::string ret; - char szPathTmp[MAX_PATH],szPath[MAX_PATH]; + std::string ret; + std::string path(0x7FFF, '\0'); + SC_HANDLE schSCManager = NULL; SC_HANDLE schService = NULL; SERVICE_DESCRIPTION sd; LPTSTR szDesc = TEXT("ZeroTier network virtualization service."); - if (GetModuleFileName(NULL, szPathTmp, ARRAYSIZE(szPath)) == 0) + DWORD dwCharacters = GetModuleFileName(NULL, path.data(), path.size()); + + if (dwCharacters == 0) { - ret = "GetModuleFileName failed, unable to get path to self"; + ret = "GetModuleFileName failed, unable to get path to self"; goto Cleanup; } - // Quote path in case it contains spaces - _snprintf_s(szPath,sizeof(szPath),"\"%s\"",szPathTmp); + // Trim excess nulls which the returned size does not include + path.resize(dwCharacters); + + // Quote path in case it contains spaces + path = '"' + path + '"'; // Open the local default service control manager database schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE); if (schSCManager == NULL) { - ret = "OpenSCManager failed"; + ret = "OpenSCManager failed"; goto Cleanup; } @@ -83,7 +89,7 @@ std::string InstallService(PSTR pszServiceName, SERVICE_WIN32_OWN_PROCESS, // Service type dwStartType, // Service start type SERVICE_ERROR_NORMAL, // Error control type - szPath, // Service's binary + path.c_str(), // Service's binary NULL, // No load ordering group NULL, // No tag identifier pszDependencies, // Dependencies @@ -92,7 +98,7 @@ std::string InstallService(PSTR pszServiceName, ); if (schService == NULL) { - ret = "CreateService failed"; + ret = "CreateService failed"; goto Cleanup; } @@ -112,7 +118,7 @@ Cleanup: schService = NULL; } - return ret; + return ret; } From 12392b519035222a4eb1bf3532e16337683421ec Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Sun, 2 Oct 2022 09:58:23 +0200 Subject: [PATCH 02/31] adding amzn2022 to rpm spec (#1761) --- zerotier-one.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zerotier-one.spec b/zerotier-one.spec index 0aaa258cd..022fa039c 100644 --- a/zerotier-one.spec +++ b/zerotier-one.spec @@ -59,6 +59,12 @@ Requires: systemd openssl Requires(pre): /usr/sbin/useradd, /usr/bin/getent %endif +%if "%{?dist}" == ".amzn2022" +BuildRequires: systemd openssl-devel +Requires: systemd openssl +Requires(pre): /usr/sbin/useradd, /usr/bin/getent +%endif + %description ZeroTier is a software defined networking layer for Earth. From 9826c20d1aed826ed82efa30f28ba76b161c82b3 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 6 Oct 2022 08:59:27 -0700 Subject: [PATCH 03/31] set zeroidc.running = false on token exchange error --- zeroidc/src/lib.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/zeroidc/src/lib.rs b/zeroidc/src/lib.rs index cb92ef6e8..11efb932b 100644 --- a/zeroidc/src/lib.rs +++ b/zeroidc/src/lib.rs @@ -498,7 +498,8 @@ impl ZeroIDC { let n = match i.nonce.clone() { Some(n) => n, None => { - println!("no noce"); + println!("no nonce"); + i.running = false; return None; } }; @@ -507,6 +508,7 @@ impl ZeroIDC { Some(t) => t, None => { println!("no id token"); + i.running = false; return None; } }; @@ -515,6 +517,7 @@ impl ZeroIDC { Ok(c) => c, Err(_e) => { println!("no claims"); + i.running = false; return None; } }; @@ -523,6 +526,7 @@ impl ZeroIDC { Ok(s) => s, Err(_) => { println!("no signing algorithm"); + i.running = false; return None; } }; @@ -535,12 +539,14 @@ impl ZeroIDC { Ok(h) => h, Err(e) => { println!("Error hashing access token: {}", e); + i.running = false; return None; } }; if actual_hash != *expected_hash { println!("token hash error"); + i.running = false; return None; } } @@ -549,7 +555,7 @@ impl ZeroIDC { Err(e) => { println!("token response error: {:?}", e.to_string()); println!("\t {:?}", e.source()); - + i.running = false; None } } @@ -634,10 +640,12 @@ impl ZeroIDC { Ok(bytes) } else if res.status() == 402 { - Err(SSOExchangeError::new( - "additional license seats required. Please contact your network administrator.".to_string(), - )) + i.running = false; + Err(SSOExchangeError::new( + "additional license seats required. Please contact your network administrator.".to_string(), + )) } else { + i.running = false; Err(SSOExchangeError::new( "error from central endpoint".to_string(), )) @@ -649,20 +657,24 @@ impl ZeroIDC { println!("Status: {}", res.status().unwrap()); println!("Post error: {}", res); i.exp_time = 0; + i.running = false; Err(SSOExchangeError::new( "error from central endpoint".to_string(), )) } } } else { + i.running = false; Err(SSOExchangeError::new( "error splitting state token".to_string(), )) } } else { + i.running = false; Err(SSOExchangeError::new("invalid token response".to_string())) } } else { + i.running = false; Err(SSOExchangeError::new("invalid pkce verifier".to_string())) } }); From 7516fd03a38625d788f2d2e5ac4f02bb09a04f05 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 6 Oct 2022 09:00:21 -0700 Subject: [PATCH 04/31] central controller docker image updates --- ext/central-controller-docker/Dockerfile.builder | 4 +++- ext/central-controller-docker/Dockerfile.run_base | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ext/central-controller-docker/Dockerfile.builder b/ext/central-controller-docker/Dockerfile.builder index a2592bb78..edbcc228f 100644 --- a/ext/central-controller-docker/Dockerfile.builder +++ b/ext/central-controller-docker/Dockerfile.builder @@ -18,6 +18,8 @@ RUN apt -y install \ libssl-dev \ postgresql-client \ postgresql-client-common \ - curl + curl \ + google-perftools \ + libgoogle-perftools-dev RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y diff --git a/ext/central-controller-docker/Dockerfile.run_base b/ext/central-controller-docker/Dockerfile.run_base index e09d214e3..c0a18ca66 100644 --- a/ext/central-controller-docker/Dockerfile.run_base +++ b/ext/central-controller-docker/Dockerfile.run_base @@ -1,8 +1,14 @@ FROM ubuntu:jammy + RUN apt update && apt upgrade -y + RUN apt -y install \ postgresql-client \ postgresql-client-common \ libjemalloc2 \ libpq5 \ - curl + curl \ + binutils \ + linux-tools-gke \ + perf-tools-unstable \ + google-perftools From 86a436e9bffe3caefe1a1f6d2d59422b6eef7441 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 6 Oct 2022 16:53:35 -0400 Subject: [PATCH 05/31] Small string fix. --- node/DNS.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/node/DNS.hpp b/node/DNS.hpp index b36d960d4..a954a6406 100644 --- a/node/DNS.hpp +++ b/node/DNS.hpp @@ -44,6 +44,7 @@ public: char *d = (char*)b.data()+p; memset(dns, 0, sizeof(ZT_VirtualNetworkDNS)); memcpy(dns->domain, d, 128); + dns->domain[127] = 0; p += 128; for (unsigned int j = 0; j < ZT_MAX_DNS_SERVERS; ++j) { p += reinterpret_cast(&(dns->server_addr[j]))->deserialize(b, p); From e1f60e3f838a760f06008c0373b01279421b75c4 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Sun, 9 Oct 2022 23:07:16 -0700 Subject: [PATCH 06/31] Behavioral changes to multipath balance modes (See: #1745 and #1753) --- include/ZeroTierOne.h | 6 +- node/Bond.cpp | 639 +++++++++++++++++++++------------------- node/Bond.hpp | 218 ++++++-------- node/Constants.hpp | 2 +- node/IncomingPacket.cpp | 2 +- node/Node.cpp | 2 +- node/Path.hpp | 12 +- node/Peer.cpp | 46 +-- one.cpp | 6 +- service/OneService.cpp | 36 +-- 10 files changed, 480 insertions(+), 489 deletions(-) diff --git a/include/ZeroTierOne.h b/include/ZeroTierOne.h index a9c28badd..b8b23825f 100644 --- a/include/ZeroTierOne.h +++ b/include/ZeroTierOne.h @@ -1328,9 +1328,9 @@ typedef struct uint8_t scope; /** - * Percentage of traffic allocated to this path (0-255) + * Relative quality value */ - uint8_t allocation; + float relativeQuality; /** * Name of physical interface this path resides on @@ -1355,7 +1355,7 @@ typedef struct uint8_t eligible; /** - * The speed of this link (as given to bonding layer) + * The capacity of this link (as given to bonding layer) */ uint32_t linkSpeed; diff --git a/node/Bond.cpp b/node/Bond.cpp index e7c9e164d..5ab164bb5 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -140,12 +140,13 @@ SharedPtr Bond::createBond(const RuntimeEnvironment* renv, const SharedPtr if (it->second->isUserSpecified() && it->second->userHasSpecifiedFailoverInstructions()) { bond->_userHasSpecifiedFailoverInstructions = true; } - if (it->second->isUserSpecified() && (it->second->speed() > 0)) { - bond->_userHasSpecifiedLinkSpeeds = true; + if (it->second->isUserSpecified() && (it->second->capacity() > 0)) { + bond->_userHasSpecifiedLinkCapacities = true; } ++it; } } + bond->startBond(); return bond; } return SharedPtr(); @@ -154,9 +155,25 @@ SharedPtr Bond::createBond(const RuntimeEnvironment* renv, const SharedPtr void Bond::destroyBond(uint64_t peerId) { Mutex::Lock _l(_bonds_m); + auto iter = _bonds.find(peerId); + if (iter != _bonds.end()) { + iter->second->stopBond(); + } _bonds.erase(peerId); } +void Bond::stopBond() +{ + debug("stopping bond"); + _run = false; +} + +void Bond::startBond() +{ + debug("starting bond"); + _run = true; +} + SharedPtr Bond::getLinkBySocket(const std::string& policyAlias, uint64_t localSocket, bool createIfNeeded = false) { Mutex::Lock _l(_links_m); @@ -239,7 +256,7 @@ void Bond::nominatePathToBond(const SharedPtr& path, int64_t now) * Ensure the link is allowed and the path is not already present */ if (! RR->bc->linkAllowed(_policyAlias, getLinkBySocket(_policyAlias, path->localSocket(), true))) { - debug("link %s is not permitted according to user-specified rules", pathToStr(path).c_str()); + debug("link %s is not allowed according to user-specified rules", pathToStr(path).c_str()); return; } bool alreadyPresent = false; @@ -299,7 +316,7 @@ void Bond::nominatePathToBond(const SharedPtr& path, int64_t now) void Bond::addPathToBond(int nominatedIdx, int bondedIdx) { // Map bonded set to nominated set - _bondIdxMap[bondedIdx] = nominatedIdx; + _realIdxMap[bondedIdx] = nominatedIdx; // Tell the bonding layer that we can now use this path for traffic _paths[nominatedIdx].bonded = true; } @@ -328,62 +345,57 @@ SharedPtr Bond::getAppropriatePath(int64_t now, int32_t flowId) * balance-rr */ if (_policy == ZT_BOND_POLICY_BALANCE_RR) { - if (! _allowFlowHashing) { - if (_packetsPerLink == 0) { - // Randomly select a path - return _paths[_bondIdxMap[_freeRandomByte % _numBondedPaths]].p; - } - if (_rrPacketsSentOnCurrLink < _packetsPerLink) { - // Continue to use this link - ++_rrPacketsSentOnCurrLink; - return _paths[_bondIdxMap[_rrIdx]].p; - } - // Reset striping counter - _rrPacketsSentOnCurrLink = 0; - if (_numBondedPaths == 1 || _rrIdx >= (ZT_MAX_PEER_NETWORK_PATHS - 1)) { - _rrIdx = 0; - } - else { - int _tempIdx = _rrIdx; - for (int searchCount = 0; searchCount < (_numBondedPaths - 1); searchCount++) { - _tempIdx = (_tempIdx == (_numBondedPaths - 1)) ? 0 : _tempIdx + 1; - if (_bondIdxMap[_tempIdx] != ZT_MAX_PEER_NETWORK_PATHS) { - if (_paths[_bondIdxMap[_tempIdx]].p && _paths[_bondIdxMap[_tempIdx]].eligible) { - _rrIdx = _tempIdx; - break; - } + if (_packetsPerLink == 0) { + // Randomly select a path + return _paths[_realIdxMap[_freeRandomByte % _numBondedPaths]].p; + } + if (_rrPacketsSentOnCurrLink < _packetsPerLink) { + // Continue to use this link + ++_rrPacketsSentOnCurrLink; + return _paths[_realIdxMap[_rrIdx]].p; + } + // Reset striping counter + _rrPacketsSentOnCurrLink = 0; + if (_numBondedPaths == 1 || _rrIdx >= (ZT_MAX_PEER_NETWORK_PATHS - 1)) { + _rrIdx = 0; + } + else { + int _tempIdx = _rrIdx; + for (int searchCount = 0; searchCount < (_numBondedPaths - 1); searchCount++) { + _tempIdx = (_tempIdx == (_numBondedPaths - 1)) ? 0 : _tempIdx + 1; + if (_realIdxMap[_tempIdx] != ZT_MAX_PEER_NETWORK_PATHS) { + if (_paths[_realIdxMap[_tempIdx]].p && _paths[_realIdxMap[_tempIdx]].eligible) { + _rrIdx = _tempIdx; + break; } } } - if (_paths[_bondIdxMap[_rrIdx]].p) { - return _paths[_bondIdxMap[_rrIdx]].p; - } + } + if (_paths[_realIdxMap[_rrIdx]].p) { + return _paths[_realIdxMap[_rrIdx]].p; } } /** - * balance-xor + * balance-xor/aware */ if (_policy == ZT_BOND_POLICY_BALANCE_XOR || _policy == ZT_BOND_POLICY_BALANCE_AWARE) { - if (! _allowFlowHashing || flowId == -1) { + if (flowId == -1) { // No specific path required for unclassified traffic, send on anything - int m_idx = _bondIdxMap[_freeRandomByte % _numBondedPaths]; + int m_idx = _realIdxMap[_freeRandomByte % _numBondedPaths]; return _paths[m_idx].p; } - else if (_allowFlowHashing) { - Mutex::Lock _l(_flows_m); - SharedPtr flow; - if (_flows.count(flowId)) { - flow = _flows[flowId]; - flow->lastActivity = now; - } - else { - unsigned char entropy; - Utils::getSecureRandom(&entropy, 1); - flow = createFlow(ZT_MAX_PEER_NETWORK_PATHS, flowId, entropy, now); - } - if (flow) { - return _paths[flow->assignedPath].p; - } + Mutex::Lock _l(_flows_m); + std::map >::iterator it = _flows.find(flowId); + if (likely(it != _flows.end())) { + it->second->lastActivity = now; + return _paths[it->second->assignedPath].p; + } + else { + unsigned char entropy; + Utils::getSecureRandom(&entropy, 1); + SharedPtr flow = createFlow(ZT_MAX_PEER_NETWORK_PATHS, flowId, entropy, now); + _flows[flowId] = flow; + return _paths[flow->assignedPath].p; } } return SharedPtr(); @@ -423,7 +435,7 @@ void Bond::recordOutgoingPacket(const SharedPtr& path, uint64_t packetId, } } } - if (_allowFlowHashing && (flowId != ZT_QOS_NO_FLOW)) { + if (flowId != ZT_QOS_NO_FLOW) { Mutex::Lock _l(_flows_m); if (_flows.count(flowId)) { _flows[flowId]->bytesOut += payloadLength; @@ -458,7 +470,7 @@ void Bond::recordIncomingPacket(const SharedPtr& path, uint64_t packetId, //_paths[pathIdx].packetValiditySamples.push(true); } else { - debug("QoS buffer full, will not record information"); + // debug("QoS buffer full, will not record information"); } /* if (_paths[pathIdx].ackStatsIn.size() < ZT_ACK_MAX_PENDING_RECORDS) { @@ -502,13 +514,16 @@ void Bond::receivedQoS(const SharedPtr& path, int64_t now, int count, uint return; } _paths[pathIdx].lastQoSReceived = now; - debug("received QoS packet (sampling %d frames) via %s", count, pathToStr(path).c_str()); - // Look up egress times and compute latency values for each record + // debug("received QoS packet (sampling %d frames) via %s", count, pathToStr(path).c_str()); + // Look up egress times and compute latency values for each record std::map::iterator it; for (int j = 0; j < count; j++) { it = _paths[pathIdx].qosStatsOut.find(rx_id[j]); if (it != _paths[pathIdx].qosStatsOut.end()) { _paths[pathIdx].latencySamples.push(((uint16_t)(now - it->second) - rx_ts[j]) / 2); + // if (_paths[pathIdx].shouldAvoid) { + // debug("RX sample on avoided path %d", pathIdx); + // } _paths[pathIdx].qosStatsOut.erase(it); } } @@ -531,7 +546,7 @@ int32_t Bond::generateQoSPacket(int pathIdx, int64_t now, char* qosBuffer) std::map::iterator it = _paths[pathIdx].qosStatsIn.begin(); int i = 0; int numRecords = std::min(_paths[pathIdx].packetsReceivedSinceLastQoS, ZT_QOS_TABLE_SIZE); - debug("numRecords=%3d, packetsReceivedSinceLastQoS=%3d, _paths[pathIdx].qosStatsIn.size()=%3lu", numRecords, _paths[pathIdx].packetsReceivedSinceLastQoS, _paths[pathIdx].qosStatsIn.size()); + // debug("numRecords=%3d, packetsReceivedSinceLastQoS=%3d, _paths[pathIdx].qosStatsIn.size()=%3lu", numRecords, _paths[pathIdx].packetsReceivedSinceLastQoS, _paths[pathIdx].qosStatsIn.size()); while (i < numRecords && it != _paths[pathIdx].qosStatsIn.end()) { uint64_t id = it->first; memcpy(qosBuffer, &id, sizeof(uint64_t)); @@ -546,72 +561,93 @@ int32_t Bond::generateQoSPacket(int pathIdx, int64_t now, char* qosBuffer) return len; } -bool Bond::assignFlowToBondedPath(SharedPtr& flow, int64_t now) +bool Bond::assignFlowToBondedPath(SharedPtr& flow, int64_t now, bool reassign = false) { if (! _numBondedPaths) { - debug("unable to assign flow %x (bond has no links)\n", flow->id); + debug("unable to assign flow %x (bond has no links)", flow->id); return false; } - unsigned int idx = ZT_MAX_PEER_NETWORK_PATHS; + unsigned int bondedIdx = ZT_MAX_PEER_NETWORK_PATHS; if (_policy == ZT_BOND_POLICY_BALANCE_XOR) { - idx = abs((int)(flow->id % (_numBondedPaths))); - flow->assignPath(_bondIdxMap[idx], now); - ++(_paths[_bondIdxMap[idx]].assignedFlowCount); + bondedIdx = abs((int)(flow->id % _numBondedPaths)); + flow->assignPath(_realIdxMap[bondedIdx], now); + ++(_paths[_realIdxMap[bondedIdx]].assignedFlowCount); } if (_policy == ZT_BOND_POLICY_BALANCE_AWARE) { - unsigned char entropy; - Utils::getSecureRandom(&entropy, 1); - if (_totalBondUnderload) { - entropy %= _totalBondUnderload; - } - /* Since there may be scenarios where a path is removed before we can re-estimate - relative qualities (and thus allocations) we need to down-modulate the entropy - value that we use to randomly assign among the surviving paths, otherwise we risk - not being able to find a path to assign this flow to. */ - int totalIncompleteAllocation = 0; - for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { - if (_paths[i].p && _paths[i].bonded) { - totalIncompleteAllocation += _paths[i].allocation; - } - } - entropy %= totalIncompleteAllocation; - for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { - if (_paths[i].p && _paths[i].bonded) { - uint8_t probabilitySegment = (_totalBondUnderload > 0) ? _paths[i].affinity : _paths[i].allocation; - if (entropy <= probabilitySegment) { - idx = i; - break; - } - entropy -= probabilitySegment; - } - } - if (idx < ZT_MAX_PEER_NETWORK_PATHS) { - flow->assignPath(idx, now); - ++(_paths[idx].assignedFlowCount); + /** balance-aware generally works like balance-xor except that it will try to + * take into account user preferences (or default sane limits) that will discourage + * allocating traffic to links with a lesser perceived "quality" */ + int offset = 0; + float bestQuality = 0.0; + int nextBestQualIdx = ZT_MAX_PEER_NETWORK_PATHS; + + if (reassign) { + log("attempting to re-assign out-flow %04x previously on idx %d (%u / %lu flows)", flow->id, flow->assignedPath, _paths[_realIdxMap[flow->assignedPath]].assignedFlowCount, _flows.size()); } else { - debug("unable to assign out-flow %x (unknown reason)", flow->id); - return false; + debug("attempting to assign flow for the first time"); + } + + unsigned char entropy; + Utils::getSecureRandom(&entropy, 1); + float randomLinkCapacity = ((float)entropy / 255.0); // Used to random but proportional choices + + while (offset < _numBondedPaths) { + unsigned char entropy; + Utils::getSecureRandom(&entropy, 1); + + if (reassign) { + bondedIdx = (flow->assignedPath + offset) % (_numBondedPaths); + } + else { + bondedIdx = abs((int)((entropy + offset) % (_numBondedPaths))); + } + // debug("idx=%d, offset=%d, randomCap=%f, actualCap=%f", bondedIdx, offset, randomLinkCapacity, _paths[_realIdxMap[bondedIdx]].relativeLinkCapacity); + if (! _paths[_realIdxMap[bondedIdx]].p) { + continue; + } + if (! _paths[_realIdxMap[bondedIdx]].shouldAvoid && randomLinkCapacity <= _paths[_realIdxMap[bondedIdx]].relativeLinkCapacity) { + // debug(" assign out-flow %04x to link %s (%u / %lu flows)", flow->id, pathToStr(_paths[_realIdxMap[bondedIdx]].p).c_str(), _paths[_realIdxMap[bondedIdx]].assignedFlowCount, _flows.size()); + break; // Acceptable -- No violation of quality spec + } + if (_paths[_realIdxMap[bondedIdx]].relativeQuality > bestQuality) { + bestQuality = _paths[_realIdxMap[bondedIdx]].relativeQuality; + nextBestQualIdx = bondedIdx; + // debug(" recording next-best link %f idx %d", _paths[_realIdxMap[bondedIdx]].relativeQuality, bondedIdx); + } + ++offset; + } + if (offset < _numBondedPaths) { + // We were (able) to find a path that didn't violate any of the user's quality requirements + flow->assignPath(_realIdxMap[bondedIdx], now); + ++(_paths[_realIdxMap[bondedIdx]].assignedFlowCount); + // debug(" ABLE to find optimal link %f idx %d", _paths[_realIdxMap[bondedIdx]].relativeQuality, bondedIdx); + } + else { + // We were (unable) to find a path that didn't violate at least one quality requirement, will choose next best option + flow->assignPath(_realIdxMap[nextBestQualIdx], now); + ++(_paths[_realIdxMap[nextBestQualIdx]].assignedFlowCount); + // debug(" UNABLE to find, will use link %f idx %d", _paths[_realIdxMap[nextBestQualIdx]].relativeQuality, nextBestQualIdx); } } if (_policy == ZT_BOND_POLICY_ACTIVE_BACKUP) { if (_abPathIdx == ZT_MAX_PEER_NETWORK_PATHS) { - debug("unable to assign out-flow %x (no active backup link)", flow->id); + log("unable to assign out-flow %x (no active backup link)", flow->id); } flow->assignPath(_abPathIdx, now); } - debug("assign out-flow %04x to link %s (%u / %lu flows)", flow->id, pathToStr(_paths[flow->assignedPath].p).c_str(), _paths[flow->assignedPath].assignedFlowCount, _flows.size()); + log("assign out-flow %04x to link %s (%u / %lu flows)", flow->id, pathToStr(_paths[flow->assignedPath].p).c_str(), _paths[flow->assignedPath].assignedFlowCount, _flows.size()); return true; } SharedPtr Bond::createFlow(int pathIdx, int32_t flowId, unsigned char entropy, int64_t now) { if (! _numBondedPaths) { - debug("unable to assign flow %x (bond has no links)\n", flowId); + debug("unable to assign flow %04x (bond has no links)", flowId); return SharedPtr(); } if (_flows.size() >= ZT_FLOW_MAX_COUNT) { - debug("forget oldest flow (max flows reached: %d)\n", ZT_FLOW_MAX_COUNT); + debug("forget oldest flow (max flows reached: %d)", ZT_FLOW_MAX_COUNT); forgetFlowsWhenNecessary(0, true, now); } SharedPtr flow = new Flow(flowId, now); @@ -624,7 +660,7 @@ SharedPtr Bond::createFlow(int pathIdx, int32_t flowId, unsigned cha if (pathIdx != ZT_MAX_PEER_NETWORK_PATHS) { flow->assignPath(pathIdx, now); _paths[pathIdx].assignedFlowCount++; - debug("assign in-flow %x to link %s (%u / %lu)", flow->id, pathToStr(_paths[pathIdx].p).c_str(), _paths[pathIdx].assignedFlowCount, _flows.size()); + debug("assign in-flow %04x to link %s (%u / %lu)", flow->id, pathToStr(_paths[pathIdx].p).c_str(), _paths[pathIdx].assignedFlowCount, _flows.size()); } /** * Add a flow when no path was provided. This means that it is an outgoing packet @@ -638,13 +674,13 @@ SharedPtr Bond::createFlow(int pathIdx, int32_t flowId, unsigned cha void Bond::forgetFlowsWhenNecessary(uint64_t age, bool oldest, int64_t now) { - std::map >::iterator it = _flows.begin(); - std::map >::iterator oldestFlow = _flows.end(); + std::map >::iterator it = _flows.begin(); + std::map >::iterator oldestFlow = _flows.end(); SharedPtr expiredFlow; if (age) { // Remove by specific age while (it != _flows.end()) { if (it->second->age(now) > age) { - debug("forget flow %x (age %llu) (%u / %lu)", it->first, (unsigned long long)it->second->age(now), _paths[it->second->assignedPath].assignedFlowCount, (_flows.size() - 1)); + debug("forget flow %04x (age %llu) (%u / %lu)", it->first, (unsigned long long)it->second->age(now), _paths[it->second->assignedPath].assignedFlowCount, (_flows.size() - 1)); _paths[it->second->assignedPath].assignedFlowCount--; it = _flows.erase(it); } @@ -663,7 +699,7 @@ void Bond::forgetFlowsWhenNecessary(uint64_t age, bool oldest, int64_t now) ++it; } if (oldestFlow != _flows.end()) { - debug("forget oldest flow %x (age %llu) (total flows: %lu)", oldestFlow->first, (unsigned long long)oldestFlow->second->age(now), (unsigned long)(_flows.size() - 1)); + debug("forget oldest flow %04x (age %llu) (total flows: %lu)", oldestFlow->first, (unsigned long long)oldestFlow->second->age(now), (unsigned long)(_flows.size() - 1)); _paths[oldestFlow->second->assignedPath].assignedFlowCount--; _flows.erase(oldestFlow); } @@ -810,7 +846,7 @@ void Bond::sendQOS_MEASUREMENT(void* tPtr, int pathIdx, int64_t localSocket, con char qosData[ZT_QOS_MAX_PACKET_SIZE]; int16_t len = generateQoSPacket(pathIdx, _now, qosData); if (len) { - debug("sending QOS via link %s (len=%d)", pathToStr(_paths[pathIdx].p).c_str(), len); + // debug("sending QOS via link %s (len=%d)", pathToStr(_paths[pathIdx].p).c_str(), len); outp.append(qosData, len); if (atAddress) { outp.armor(_peer->key(), false, _peer->aesKeysIfSupported()); @@ -827,6 +863,9 @@ void Bond::sendQOS_MEASUREMENT(void* tPtr, int pathIdx, int64_t localSocket, con void Bond::processBackgroundBondTasks(void* tPtr, int64_t now) { + if (! _run) { + return; + } if (! _peer->_localMultipathSupported || (now - _lastBackgroundTaskCheck) < ZT_BOND_BACKGROUND_TASK_MIN_INTERVAL) { return; } @@ -852,7 +891,7 @@ void Bond::processBackgroundBondTasks(void* tPtr, int64_t now) RR->node->putPacket(tPtr, _paths[i].p->localSocket(), _paths[i].p->address(), outp.data(), outp.size()); _paths[i].p->_lastOut = now; _overheadBytes += outp.size(); - debug("tx: verb 0x%-2x of len %4d via %s (ECHO)", Packet::VERB_ECHO, outp.size(), pathToStr(_paths[i].p).c_str()); + // debug("tx: verb 0x%-2x of len %4d via %s (ECHO)", Packet::VERB_ECHO, outp.size(), pathToStr(_paths[i].p).c_str()); } } // QOS @@ -970,11 +1009,9 @@ void Bond::curateBond(int64_t now, bool rebuildBond) if (! currEligibility) { _paths[i].adjustRefractoryPeriod(now, _defaultPathRefractoryPeriod, ! currEligibility); if (_paths[i].bonded) { - if (_allowFlowHashing) { - debug("link %s was bonded, flow reallocation will occur soon", pathToStr(_paths[i].p).c_str()); - rebuildBond = true; - _paths[i].shouldReallocateFlows = _paths[i].bonded; - } + debug("link %s was bonded, flow reallocation will occur soon", pathToStr(_paths[i].p).c_str()); + rebuildBond = true; + _paths[i].shouldAvoid = true; _paths[i].bonded = false; } } @@ -999,6 +1036,7 @@ void Bond::curateBond(int64_t now, bool rebuildBond) */ bool foundUsablePrimaryPath = false; for (int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { + // debug("[%d], bonded=%d, alive=%d", i, _paths[i].bonded , _paths[i].alive); if (_paths[i].p && _paths[i].bonded && _paths[i].alive) { foundUsablePrimaryPath = true; } @@ -1014,11 +1052,9 @@ void Bond::curateBond(int64_t now, bool rebuildBond) rebuildBond = true; } if (rebuildBond) { - debug("rebuilding bond"); - // Clear previous bonded index mapping for (int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { - _bondIdxMap[i] = ZT_MAX_PEER_NETWORK_PATHS; + _realIdxMap[i] = ZT_MAX_PEER_NETWORK_PATHS; _paths[i].bonded = false; } @@ -1037,11 +1073,10 @@ void Bond::curateBond(int64_t now, bool rebuildBond) std::map, std::vector >::iterator it = linkMap.begin(); while (it != linkMap.end()) { SharedPtr link = it->first; - int ipvPref = link->ipvPref(); // Bond a spare link if required (no viable primary links left) if (! foundUsablePrimaryPath) { - log("no usable primary links remain, will attempt to use spare if available"); + debug("no usable primary links remain, will attempt to use spare if available"); for (int j = 0; j < it->second.size(); j++) { int idx = it->second.at(j); if (! _paths[idx].p || ! _paths[idx].eligible || ! _paths[idx].allowed() || ! _paths[idx].isSpare()) { @@ -1053,6 +1088,8 @@ void Bond::curateBond(int64_t now, bool rebuildBond) } } + int ipvPref = link->ipvPref(); + // If user has no address type preference, then use every path we find on a link if (ipvPref == 0) { for (int j = 0; j < it->second.size(); j++) { @@ -1127,26 +1164,6 @@ void Bond::curateBond(int64_t now, bool rebuildBond) void Bond::estimatePathQuality(int64_t now) { - uint32_t totUserSpecifiedLinkSpeed = 0; - if (_numBondedPaths) { // Compute relative user-specified speeds of links - for (unsigned int i = 0; i < _numBondedPaths; ++i) { - if (_paths[i].p && _paths[i].allowed()) { - SharedPtr link = RR->bc->getLinkBySocket(_policyAlias, _paths[i].p->localSocket()); - if (link) { - totUserSpecifiedLinkSpeed += link->speed(); - } - } - } - for (unsigned int i = 0; i < _numBondedPaths; ++i) { - if (_paths[i].p && _paths[i].allowed()) { - SharedPtr link = RR->bc->getLinkBySocket(_policyAlias, _paths[i].p->localSocket()); - if (link) { - link->setRelativeSpeed((uint8_t)round(((float)link->speed() / (float)totUserSpecifiedLinkSpeed) * 255)); - } - } - } - } - float lat[ZT_MAX_PEER_NETWORK_PATHS] = { 0 }; float pdv[ZT_MAX_PEER_NETWORK_PATHS] = { 0 }; float plr[ZT_MAX_PEER_NETWORK_PATHS] = { 0 }; @@ -1157,35 +1174,15 @@ void Bond::estimatePathQuality(int64_t now) float maxPLR = 0; float maxPER = 0; - float quality[ZT_MAX_PEER_NETWORK_PATHS] = { 0 }; - uint8_t alloc[ZT_MAX_PEER_NETWORK_PATHS] = { 0 }; + float absoluteQuality[ZT_MAX_PEER_NETWORK_PATHS] = { 0 }; float totQuality = 0.0f; - // Compute initial summary statistics + // Process observation samples, compute summary statistics, and compute relative link qualities for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { if (! _paths[i].p || ! _paths[i].allowed()) { continue; } - // Compute/Smooth average of real-world observations - _paths[i].latencyMean = _paths[i].latencySamples.mean(); - _paths[i].latencyVariance = _paths[i].latencySamples.stddev(); - - // Write values to external path object so that it can be propagated to the user - _paths[i].p->_latencyMean = _paths[i].latencyMean; - _paths[i].p->_latencyVariance = _paths[i].latencyVariance; - _paths[i].p->_packetLossRatio = _paths[i].packetLossRatio; - _paths[i].p->_packetErrorRatio = _paths[i].packetErrorRatio; - _paths[i].p->_bonded = _paths[i].bonded; - _paths[i].p->_eligible = _paths[i].eligible; - // _valid is written elsewhere - _paths[i].p->_allocation = _paths[i].allocation; - SharedPtr link = RR->bc->getLinkBySocket(_policyAlias, _paths[i].p->localSocket()); - if (link) { - _paths[i].p->_givenLinkSpeed = link->speed(); - } - //_paths[i].packetErrorRatio = 1.0 - (_paths[i].packetValiditySamples.count() ? _paths[i].packetValiditySamples.mean() : 1.0); - // Drain unacknowledged QoS records int qosRecordTimeout = (_qosSendInterval * 3); std::map::iterator it = _paths[i].qosStatsOut.begin(); @@ -1200,7 +1197,7 @@ void Bond::estimatePathQuality(int64_t now) } } if (numDroppedQosOutRecords) { - debug("Dropped %d QOS out-records", numDroppedQosOutRecords); + // debug("dropped %d QOS out-records", numDroppedQosOutRecords); } /* @@ -1229,116 +1226,185 @@ void Bond::estimatePathQuality(int64_t now) } } if (numDroppedQosInRecords) { - log("Dropped %d QOS in-records", numDroppedQosInRecords); + // debug("dropped %d QOS in-records", numDroppedQosInRecords); } - quality[i] = 0; + absoluteQuality[i] = 0; totQuality = 0; // Normalize raw observations according to sane limits and/or user specified values - lat[i] = 1.0 / expf(4 * Utils::normalize(_paths[i].latencyMean, 0, _maxAcceptableLatency, 0, 1)); - pdv[i] = 1.0 / expf(4 * Utils::normalize(_paths[i].latencyVariance, 0, _maxAcceptablePacketDelayVariance, 0, 1)); - plr[i] = 1.0 / expf(4 * Utils::normalize(_paths[i].packetLossRatio, 0, _maxAcceptablePacketLossRatio, 0, 1)); - per[i] = 1.0 / expf(4 * Utils::normalize(_paths[i].packetErrorRatio, 0, _maxAcceptablePacketErrorRatio, 0, 1)); + lat[i] = 1.0 / expf(4 * Utils::normalize(_paths[i].latency, 0, _qw[ZT_QOS_LAT_MAX_IDX], 0, 1)); + pdv[i] = 1.0 / expf(4 * Utils::normalize(_paths[i].latencyVariance, 0, _qw[ZT_QOS_PDV_MAX_IDX], 0, 1)); + plr[i] = 1.0 / expf(4 * Utils::normalize(_paths[i].packetLossRatio, 0, _qw[ZT_QOS_PLR_MAX_IDX], 0, 1)); + per[i] = 1.0 / expf(4 * Utils::normalize(_paths[i].packetErrorRatio, 0, _qw[ZT_QOS_PER_MAX_IDX], 0, 1)); // Record bond-wide maximums to determine relative values maxLAT = lat[i] > maxLAT ? lat[i] : maxLAT; maxPDV = pdv[i] > maxPDV ? pdv[i] : maxPDV; maxPLR = plr[i] > maxPLR ? plr[i] : maxPLR; maxPER = per[i] > maxPER ? per[i] : maxPER; } + + // Compute relative user-specified link capacities (may change during life of Bond) + int maxObservedLinkCap = 0; + // Find current maximum + for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { + if (_paths[i].p && _paths[i].allowed()) { + SharedPtr link = RR->bc->getLinkBySocket(_policyAlias, _paths[i].p->localSocket()); + if (link) { + int linkSpeed = link->capacity(); + _paths[i].p->_givenLinkSpeed = linkSpeed; + maxObservedLinkCap = linkSpeed > maxObservedLinkCap ? linkSpeed : maxObservedLinkCap; + } + } + } + // Compute relative link capacity (Used for weighting traffic allocations) + for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { + if (_paths[i].p && _paths[i].allowed()) { + SharedPtr link = RR->bc->getLinkBySocket(_policyAlias, _paths[i].p->localSocket()); + if (link) { + float relativeCapacity = (link->capacity() / (float)maxObservedLinkCap); + link->setRelativeCapacity(relativeCapacity); + _paths[i].relativeLinkCapacity = relativeCapacity; + } + } + } + // Convert metrics to relative quantities and apply contribution weights for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { if (_paths[i].p && _paths[i].bonded) { - quality[i] += ((maxLAT > 0.0f ? lat[i] / maxLAT : 0.0f) * _qw[ZT_QOS_LAT_IDX]); - quality[i] += ((maxPDV > 0.0f ? pdv[i] / maxPDV : 0.0f) * _qw[ZT_QOS_PDV_IDX]); - quality[i] += ((maxPLR > 0.0f ? plr[i] / maxPLR : 0.0f) * _qw[ZT_QOS_PLR_IDX]); - quality[i] += ((maxPER > 0.0f ? per[i] / maxPER : 0.0f) * _qw[ZT_QOS_PER_IDX]); - totQuality += quality[i]; + absoluteQuality[i] += ((maxLAT > 0.0f ? lat[i] / maxLAT : 0.0f) * _qw[ZT_QOS_LAT_WEIGHT_IDX]); + absoluteQuality[i] += ((maxPDV > 0.0f ? pdv[i] / maxPDV : 0.0f) * _qw[ZT_QOS_PDV_WEIGHT_IDX]); + absoluteQuality[i] += ((maxPLR > 0.0f ? plr[i] / maxPLR : 0.0f) * _qw[ZT_QOS_PLR_WEIGHT_IDX]); + absoluteQuality[i] += ((maxPER > 0.0f ? per[i] / maxPER : 0.0f) * _qw[ZT_QOS_PER_WEIGHT_IDX]); + absoluteQuality[i] *= _paths[i].relativeLinkCapacity; + totQuality += absoluteQuality[i]; } } - // Normalize to 8-bit allocation values + + // Compute quality of link relative to all others in the bond (also accounting for stated link capacity) + if (totQuality > 0.0) { + for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { + if (_paths[i].p && _paths[i].bonded) { + _paths[i].relativeQuality = absoluteQuality[i] / totQuality; + // debug("[%2d], abs=%f, tot=%f, rel=%f, relcap=%f", i, absoluteQuality[i], totQuality, _paths[i].relativeQuality, _paths[i].relativeLinkCapacity); + } + } + } + + // Compute summary statistics for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { - if (_paths[i].p && _paths[i].bonded) { - alloc[i] = (uint8_t)(std::ceil((quality[i] / totQuality) * (float)255)); - _paths[i].allocation = alloc[i]; + if (! _paths[i].p || ! _paths[i].allowed()) { + continue; + } + // Compute/Smooth average of real-world observations + if (_paths[i].latencySamples.count() == ZT_QOS_SHORTTERM_SAMPLE_WIN_SIZE) { + _paths[i].latency = _paths[i].latencySamples.mean(); + } + if (_paths[i].latencySamples.count() == ZT_QOS_SHORTTERM_SAMPLE_WIN_SIZE) { + _paths[i].latencyVariance = _paths[i].latencySamples.stddev(); + } + + // Write values to external path object so that it can be propagated to the user + _paths[i].p->_latencyMean = _paths[i].latency; + _paths[i].p->_latencyVariance = _paths[i].latencyVariance; + _paths[i].p->_packetLossRatio = _paths[i].packetLossRatio; + _paths[i].p->_packetErrorRatio = _paths[i].packetErrorRatio; + _paths[i].p->_bonded = _paths[i].bonded; + _paths[i].p->_eligible = _paths[i].eligible; + //_paths[i].packetErrorRatio = 1.0 - (_paths[i].packetValiditySamples.count() ? _paths[i].packetValiditySamples.mean() : 1.0); + // _valid is written elsewhere + _paths[i].p->_relativeQuality = _paths[i].relativeQuality; + } + + // Flag links for avoidance + for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { + if (! _paths[i].p || ! _paths[i].allowed()) { + continue; + } + bool shouldAvoid = false; + if (! _paths[i].shouldAvoid) { + if (_paths[i].latency > _qw[ZT_QOS_LAT_MAX_IDX]) { + log("avoiding link %s because (lat %6.4f > %6.4f)", pathToStr(_paths[i].p).c_str(), _paths[i].latency, _qw[ZT_QOS_LAT_MAX_IDX]); + shouldAvoid = true; + } + if (_paths[i].latencyVariance > _qw[ZT_QOS_PDV_MAX_IDX]) { + log("avoiding link %s because (pdv %6.4f > %6.4f)", pathToStr(_paths[i].p).c_str(), _paths[i].latencyVariance, _qw[ZT_QOS_PDV_MAX_IDX]); + shouldAvoid = true; + } + if (_paths[i].packetErrorRatio > _qw[ZT_QOS_PER_MAX_IDX]) { + log("avoiding link %s because (per %6.4f > %6.4f)", pathToStr(_paths[i].p).c_str(), _paths[i].packetErrorRatio, _qw[ZT_QOS_PER_MAX_IDX]); + shouldAvoid = true; + } + if (_paths[i].packetLossRatio > _qw[ZT_QOS_PLR_MAX_IDX]) { + log("avoiding link %s because (plr %6.4f > %6.4f)", pathToStr(_paths[i].p).c_str(), _paths[i].packetLossRatio, _qw[ZT_QOS_PLR_MAX_IDX]); + shouldAvoid = true; + } + _paths[i].shouldAvoid = shouldAvoid; + } + else { + if (! shouldAvoid) { + log("no longer avoiding link %s", pathToStr(_paths[i].p).c_str()); + _paths[i].shouldAvoid = false; + } } } } void Bond::processBalanceTasks(int64_t now) { - if (_allowFlowHashing) { - /** - * Clean up and reset flows if necessary - */ - if ((now - _lastFlowExpirationCheck) > ZT_PEER_PATH_EXPIRATION) { - Mutex::Lock _l(_flows_m); - forgetFlowsWhenNecessary(ZT_PEER_PATH_EXPIRATION, false, now); - std::map >::iterator it = _flows.begin(); - while (it != _flows.end()) { - it->second->resetByteCounts(); - ++it; - } - _lastFlowExpirationCheck = now; + if (! _numBondedPaths) { + return; + } + /** + * Clean up and reset flows if necessary + */ + if ((now - _lastFlowExpirationCheck) > ZT_PEER_PATH_EXPIRATION) { + Mutex::Lock _l(_flows_m); + forgetFlowsWhenNecessary(ZT_PEER_PATH_EXPIRATION, false, now); + std::map >::iterator it = _flows.begin(); + while (it != _flows.end()) { + it->second->resetByteCounts(); + ++it; } - /** - * Re-allocate flows from dead paths - */ - if (_policy == ZT_BOND_POLICY_BALANCE_XOR || _policy == ZT_BOND_POLICY_BALANCE_AWARE) { - Mutex::Lock _l(_flows_m); - for (int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { - if (! _paths[i].p) { - continue; - } - if (! _paths[i].eligible && _paths[i].shouldReallocateFlows) { - log("reallocate flows from dead link %s", pathToStr(_paths[i].p).c_str()); - std::map >::iterator flow_it = _flows.begin(); - while (flow_it != _flows.end()) { - if (_paths[flow_it->second->assignedPath].p == _paths[i].p) { - if (assignFlowToBondedPath(flow_it->second, now)) { - _paths[i].assignedFlowCount--; - } - } - ++flow_it; - } - _paths[i].shouldReallocateFlows = false; + _lastFlowExpirationCheck = now; + } + /** + * Move (all) flows from dead paths + */ + if (_policy == ZT_BOND_POLICY_BALANCE_XOR || _policy == ZT_BOND_POLICY_BALANCE_AWARE) { + Mutex::Lock _l(_flows_m); + std::map >::iterator flow_it = _flows.begin(); + while (flow_it != _flows.end()) { + if (! _paths[flow_it->second->assignedPath].p) { + continue; + } + int originalPathIdx = flow_it->second->assignedPath; + if (! _paths[originalPathIdx].eligible) { + log("moving all flows from dead link %s", pathToStr(_paths[originalPathIdx].p).c_str()); + if (assignFlowToBondedPath(flow_it->second, now, true)) { + _paths[originalPathIdx].assignedFlowCount--; } } + ++flow_it; } - /** - * Re-allocate flows from under-performing - * NOTE: This could be part of the above block but was kept separate for clarity. - */ - if (_policy == ZT_BOND_POLICY_BALANCE_AWARE) { - int totalAllocation = 0; - for (int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { - if (! _paths[i].p) { - continue; - } - if (_paths[i].p && _paths[i].bonded && _paths[i].eligible) { - totalAllocation += _paths[i].allocation; - } - } - unsigned char minimumAllocationValue = (uint8_t)(0.33 * ((float)totalAllocation / (float)_numBondedPaths)); - - Mutex::Lock _l(_flows_m); - for (int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { - if (! _paths[i].p) { - continue; - } - if (_paths[i].p && _paths[i].bonded && _paths[i].eligible && (_paths[i].allocation < minimumAllocationValue) && _paths[i].assignedFlowCount) { - log("reallocate flows from under-performing link %s\n", pathToStr(_paths[i].p).c_str()); - std::map >::iterator flow_it = _flows.begin(); - while (flow_it != _flows.end()) { - if (flow_it->second->assignedPath == _paths[i].p) { - if (assignFlowToBondedPath(flow_it->second, now)) { - _paths[i].assignedFlowCount--; - } - } - ++flow_it; - } - _paths[i].shouldReallocateFlows = false; + } + /** + * Move (some) flows from low quality paths + */ + if (_policy == ZT_BOND_POLICY_BALANCE_AWARE) { + Mutex::Lock _l(_flows_m); + std::map >::iterator flow_it = _flows.begin(); + while (flow_it != _flows.end()) { + if (! _paths[flow_it->second->assignedPath].p) { + continue; + } + int originalPathIdx = flow_it->second->assignedPath; + if (_paths[originalPathIdx].shouldAvoid) { + if (assignFlowToBondedPath(flow_it->second, now, true)) { + _paths[originalPathIdx].assignedFlowCount--; + return; // Only move one flow at a time } } + ++flow_it; } } } @@ -1534,7 +1600,7 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) } if (! _paths[i].failoverScore) { // If we didn't inherit a failover score from a "parent" that wants to use this path as a failover - int newHandicap = failoverScoreHandicap ? failoverScoreHandicap : _paths[i].allocation; + int newHandicap = failoverScoreHandicap ? failoverScoreHandicap : (_paths[i].relativeQuality * 255.0); _paths[i].failoverScore = newHandicap; } SharedPtr failoverLink; @@ -1603,7 +1669,7 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) _paths[i].negotiated = false; } */ - _paths[i].failoverScore = _paths[i].allocation + failoverScoreHandicap; + _paths[i].failoverScore = _paths[i].relativeQuality + failoverScoreHandicap; if (_paths[i].p.ptr() != _paths[_abPathIdx].p.ptr()) { bool bFoundPathInQueue = false; for (std::deque::iterator it(_abFailoverQueue.begin()); it != _abFailoverQueue.end(); ++it) { @@ -1703,7 +1769,7 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) int prevFScore = _paths[_abPathIdx].failoverScore; // Establish a minimum switch threshold to prevent flapping int failoverScoreDifference = _paths[_abFailoverQueue.front()].failoverScore - _paths[_abPathIdx].failoverScore; - int thresholdQuantity = (int)(ZT_BOND_ACTIVE_BACKUP_OPTIMIZE_MIN_THRESHOLD * (float)_paths[_abPathIdx].allocation); + int thresholdQuantity = (int)(ZT_BOND_ACTIVE_BACKUP_OPTIMIZE_MIN_THRESHOLD * (float)_paths[_abPathIdx].relativeQuality); if ((failoverScoreDifference > 0) && (failoverScoreDifference > thresholdQuantity)) { SharedPtr oldPath = _paths[_abPathIdx].p; dequeueNextActiveBackupPath(now); @@ -1746,10 +1812,6 @@ void Bond::setBondParameters(int policy, SharedPtr templateBond, bool useT } _isLeaf = _peer ? (role != ZT_PEER_ROLE_PLANET && role != ZT_PEER_ROLE_MOON) : false; - // Flows - - _allowFlowHashing = false; - // Path negotiation _allowPathNegotiation = false; @@ -1761,7 +1823,7 @@ void Bond::setBondParameters(int policy, SharedPtr templateBond, bool useT _userHasSpecifiedPrimaryLink = false; _userHasSpecifiedFailoverInstructions = false; - _userHasSpecifiedLinkSpeeds = 0; + _userHasSpecifiedLinkCapacities = 0; // Bond status @@ -1769,62 +1831,36 @@ void Bond::setBondParameters(int policy, SharedPtr templateBond, bool useT _numTotalLinks = 0; _numBondedPaths = 0; - // active-backup - - _abPathIdx = ZT_MAX_PEER_NETWORK_PATHS; - - // rr - - _rrPacketsSentOnCurrLink = 0; - _rrIdx = 0; - // General parameters _downDelay = 0; _upDelay = 0; _monitorInterval = 0; - // (Sane?) limits - - _maxAcceptableLatency = 100; - _maxAcceptablePacketDelayVariance = 50; - _maxAcceptablePacketLossRatio = 0.10f; - _maxAcceptablePacketErrorRatio = 0.10f; - // balance-aware _totalBondUnderload = 0; _overheadBytes = 0; /** - * Policy-specific defaults + * Policy defaults */ - switch (_policy) { - case ZT_BOND_POLICY_ACTIVE_BACKUP: - _abLinkSelectMethod = ZT_BOND_RESELECTION_POLICY_OPTIMIZE; - break; - case ZT_BOND_POLICY_BROADCAST: - _downDelay = 30000; - _upDelay = 0; - break; - case ZT_BOND_POLICY_BALANCE_RR: - _packetsPerLink = 64; - break; - case ZT_BOND_POLICY_BALANCE_XOR: - _allowFlowHashing = true; - break; - case ZT_BOND_POLICY_BALANCE_AWARE: - _allowFlowHashing = true; - break; - default: - break; - } + _abPathIdx = ZT_MAX_PEER_NETWORK_PATHS; + _abLinkSelectMethod = ZT_BOND_RESELECTION_POLICY_OPTIMIZE; + _rrPacketsSentOnCurrLink = 0; + _rrIdx = 0; + _packetsPerLink = 64; - _qw[ZT_QOS_LAT_IDX] = 0.3f; - _qw[ZT_QOS_LTM_IDX] = 0.1f; - _qw[ZT_QOS_PDV_IDX] = 0.3f; - _qw[ZT_QOS_PLR_IDX] = 0.1f; - _qw[ZT_QOS_PER_IDX] = 0.1f; + // Sane quality defaults + + _qw[ZT_QOS_LAT_MAX_IDX] = 500.0f; + _qw[ZT_QOS_PDV_MAX_IDX] = 100.0f; + _qw[ZT_QOS_PLR_MAX_IDX] = 0.001f; + _qw[ZT_QOS_PER_MAX_IDX] = 0.0001f; + _qw[ZT_QOS_LAT_WEIGHT_IDX] = 0.25f; + _qw[ZT_QOS_PDV_WEIGHT_IDX] = 0.25f; + _qw[ZT_QOS_PLR_WEIGHT_IDX] = 0.25f; + _qw[ZT_QOS_PER_WEIGHT_IDX] = 0.25f; _failoverInterval = ZT_BOND_FAILOVER_DEFAULT_INTERVAL; @@ -1836,7 +1872,8 @@ void Bond::setBondParameters(int policy, SharedPtr templateBond, bool useT _downDelay = templateBond->_downDelay; _upDelay = templateBond->_upDelay; _abLinkSelectMethod = templateBond->_abLinkSelectMethod; - memcpy(_qw, templateBond->_qw, ZT_QOS_WEIGHT_SIZE * sizeof(float)); + memcpy(_qw, templateBond->_qw, ZT_QOS_PARAMETER_SIZE * sizeof(float)); + debug("user link quality spec = {%6.3f, %6.3f, %6.3f, %6.3f, %6.3f, %6.3f, %6.3f, %6.3f}", _qw[0], _qw[1], _qw[2], _qw[3], _qw[4], _qw[5], _qw[6], _qw[7]); } if (! _isLeaf) { @@ -1854,16 +1891,18 @@ void Bond::setBondParameters(int policy, SharedPtr templateBond, bool useT _defaultPathRefractoryPeriod = 8000; } -void Bond::setUserQualityWeights(float weights[], int len) +void Bond::setUserLinkQualitySpec(float weights[], int len) { - if (len == ZT_QOS_WEIGHT_SIZE) { - float weightTotal = 0.0; - for (unsigned int i = 0; i < ZT_QOS_WEIGHT_SIZE; ++i) { - weightTotal += weights[i]; - } - if (weightTotal > 0.99 && weightTotal < 1.01) { - memcpy(_qw, weights, len * sizeof(float)); - } + if (len != ZT_QOS_PARAMETER_SIZE) { + debug("link quality spec has an invalid number of parameters (%d out of %d), ignoring", len, ZT_QOS_PARAMETER_SIZE); + return; + } + float weightTotal = 0.0; + for (unsigned int i = 4; i < ZT_QOS_PARAMETER_SIZE; ++i) { + weightTotal += weights[i]; + } + if (weightTotal > 0.99 && weightTotal < 1.01) { + memcpy(_qw, weights, len * sizeof(float)); } } @@ -1898,7 +1937,7 @@ void Bond::dumpPathStatus(int64_t now, int pathIdx) std::string aliveOrDead = _paths[pathIdx].alive ? std::string("alive") : std::string("dead"); std::string eligibleOrNot = _paths[pathIdx].eligible ? std::string("eligible") : std::string("ineligible"); std::string bondedOrNot = _paths[pathIdx].bonded ? std::string("bonded") : std::string("unbonded"); - log("path[%2u] --- %5s (in %7lld, out: %7lld), %10s, %8s, flows=%-6u lat=%-8.3f pdv=%-7.3f err=%-6.4f loss=%-6.4f alloc=%-3u --- (%s) spare=%d", + log("path[%2u] --- %5s (in %7lld, out: %7lld), %10s, %8s, flows=%-6u lat=%-8.3f pdv=%-7.3f err=%-6.4f loss=%-6.4f qual=%-6.4f --- (%s) spare=%d", pathIdx, aliveOrDead.c_str(), static_cast(_paths[pathIdx].p->age(now)), @@ -1906,11 +1945,11 @@ void Bond::dumpPathStatus(int64_t now, int pathIdx) eligibleOrNot.c_str(), bondedOrNot.c_str(), _paths[pathIdx].assignedFlowCount, - _paths[pathIdx].latencyMean, + _paths[pathIdx].latency, _paths[pathIdx].latencyVariance, _paths[pathIdx].packetErrorRatio, _paths[pathIdx].packetLossRatio, - _paths[pathIdx].allocation, + _paths[pathIdx].relativeQuality, pathToStr(_paths[pathIdx].p).c_str(), _paths[pathIdx].isSpare()); #endif diff --git a/node/Bond.hpp b/node/Bond.hpp index abb0a8507..3419c8cfe 100644 --- a/node/Bond.hpp +++ b/node/Bond.hpp @@ -29,7 +29,7 @@ /** * Indices for the path quality weight vector */ -enum ZT_BondQualityWeightIndex { ZT_QOS_LAT_IDX, ZT_QOS_LTM_IDX, ZT_QOS_PDV_IDX, ZT_QOS_PLR_IDX, ZT_QOS_PER_IDX, ZT_QOS_WEIGHT_SIZE }; +enum ZT_BondQualityWeightIndex { ZT_QOS_LAT_MAX_IDX, ZT_QOS_PDV_MAX_IDX, ZT_QOS_PLR_MAX_IDX, ZT_QOS_PER_MAX_IDX, ZT_QOS_LAT_WEIGHT_IDX, ZT_QOS_PDV_WEIGHT_IDX, ZT_QOS_PLR_WEIGHT_IDX, ZT_QOS_PER_WEIGHT_IDX, ZT_QOS_PARAMETER_SIZE }; /** * Multipath bonding policy @@ -117,17 +117,16 @@ class Link { * * @param ifnameStr * @param ipvPref - * @param speed + * @param capacity * @param enabled * @param mode * @param failoverToLinkStr - * @param userSpecifiedAlloc */ - Link(std::string ifnameStr, uint8_t ipvPref, uint32_t speed, bool enabled, uint8_t mode, std::string failoverToLinkStr) + Link(std::string ifnameStr, uint8_t ipvPref, uint32_t capacity, bool enabled, uint8_t mode, std::string failoverToLinkStr) : _ifnameStr(ifnameStr) , _ipvPref(ipvPref) - , _speed(speed) - , _relativeSpeed(0) + , _capacity(capacity) + , _relativeCapacity(0.0) , _enabled(enabled) , _mode(mode) , _failoverToLinkStr(failoverToLinkStr) @@ -194,29 +193,29 @@ class Link { } /** - * @return The speed of the link relative to others in the bond. + * @return The capacity of the link relative to others in the bond. */ - inline uint8_t relativeSpeed() + inline float relativeCapacity() { - return _relativeSpeed; + return _relativeCapacity; } /** - * Sets the speed of the link relative to others in the bond. + * Sets the capacity of the link relative to others in the bond. * - * @param relativeSpeed The speed relative to the rest of the link. + * @param relativeCapacity The capacity relative to the rest of the link. */ - inline void setRelativeSpeed(uint8_t relativeSpeed) + inline void setRelativeCapacity(float relativeCapacity) { - _relativeSpeed = relativeSpeed; + _relativeCapacity = relativeCapacity; } /** - * @return The absolute speed of the link (as specified by the user.) + * @return The absolute capacity of the link (as specified by the user.) */ - inline uint32_t speed() + inline uint32_t capacity() { - return _speed; + return _capacity; } /** @@ -262,14 +261,14 @@ class Link { uint8_t _ipvPref; /** - * User-specified speed of this link + * User-specified capacity of this link */ - uint32_t _speed; + uint32_t _capacity; /** * Speed relative to other specified links (computed by Bond) */ - uint8_t _relativeSpeed; + float _relativeCapacity; /** * Whether this link is enabled, or (disabled (possibly bad config)) @@ -302,6 +301,17 @@ class Peer; class Bond { public: + + /** + * Stop bond's internal functions (can be resumed) + */ + void stopBond(); + + /** + * Start or resume a bond's internal functions + */ + void startBond(); + /** * @return Whether this link is permitted to become a member of a bond. */ @@ -576,6 +586,14 @@ class Bond { return _policyAlias; } + /** + * Return whether this bond is able to properly process traffic + */ + bool isReady() + { + return _numBondedPaths; + } + /** * Inform the bond about the path that its peer (owning object) just learned about. * If the path is allowed to be used, it will be inducted into the bond on a trial @@ -706,8 +724,9 @@ class Bond { * * @param flow Flow to be assigned * @param now Current time + * @param reassign Whether this flow is being re-assigned to another path */ - bool assignFlowToBondedPath(SharedPtr& flow, int64_t now); + bool assignFlowToBondedPath(SharedPtr& flow, int64_t now, bool reassign); /** * Determine whether a path change should occur given the remote peer's reported utility and our @@ -796,52 +815,12 @@ class Bond { void setBondParameters(int policy, SharedPtr templateBond, bool useTemplate); /** - * Check and assign user-specified quality weights to this bond. + * Check and assign user-specified link quality parameters to this bond. * - * @param weights Set of user-specified weights - * @param len Length of weight vector + * @param weights Set of user-specified parameters + * @param len Length of parameter vector */ - void setUserQualityWeights(float weights[], int len); - - /** - * @param latencyInMilliseconds Maximum acceptable latency. - */ - void setMaxAcceptableLatency(int16_t latencyInMilliseconds) - { - _maxAcceptableLatency = latencyInMilliseconds; - } - - /** - * @param latencyInMilliseconds Maximum acceptable (mean) latency. - */ - void setMaxAcceptableMeanLatency(int16_t latencyInMilliseconds) - { - _maxAcceptableMeanLatency = latencyInMilliseconds; - } - - /** - * @param latencyVarianceInMilliseconds Maximum acceptable packet delay variance (jitter). - */ - void setMaxAcceptablePacketDelayVariance(int16_t latencyVarianceInMilliseconds) - { - _maxAcceptablePacketDelayVariance = latencyVarianceInMilliseconds; - } - - /** - * @param lossRatio Maximum acceptable packet loss ratio (PLR). - */ - void setMaxAcceptablePacketLossRatio(float lossRatio) - { - _maxAcceptablePacketLossRatio = lossRatio; - } - - /** - * @param errorRatio Maximum acceptable packet error ratio (PER). - */ - void setMaxAcceptablePacketErrorRatio(float errorRatio) - { - _maxAcceptablePacketErrorRatio = errorRatio; - } + void setUserLinkQualitySpec(float weights[], int len); /** * @return Whether the user has defined links for use on this bond @@ -868,11 +847,11 @@ class Bond { } /** - * @return Whether the user has specified link speeds + * @return Whether the user has specified link capacities */ - inline bool userHasSpecifiedLinkSpeeds() + inline bool userHasSpecifiedLinkCapacities() { - return _userHasSpecifiedLinkSpeeds; + return _userHasSpecifiedLinkCapacities; } /** @@ -911,10 +890,9 @@ class Bond { */ inline bool rateGateQoS(int64_t now, SharedPtr& path) { - // TODO: Verify before production char pathStr[64] = { 0 }; path->address().toString(pathStr); - int diff = now - _lastQoSRateCheck; + uint64_t diff = now - _lastQoSRateCheck; if ((diff) <= (_qosSendInterval / ZT_MAX_PEER_NETWORK_PATHS)) { ++_qosCutoffCount; } @@ -922,7 +900,6 @@ class Bond { _qosCutoffCount = 0; } _lastQoSRateCheck = now; - // fprintf(stderr, "rateGateQoS (count=%d, send_interval=%d, diff=%d, path=%s)\n", _qosCutoffCount, _qosSendInterval, diff, pathStr); return (_qosCutoffCount < (ZT_MAX_PEER_NETWORK_PATHS * 2)); } @@ -934,7 +911,6 @@ class Bond { */ inline bool rateGatePathNegotiation(int64_t now, SharedPtr& path) { - // TODO: Verify before production char pathStr[64] = { 0 }; path->address().toString(pathStr); int diff = now - _lastPathNegotiationReceived; @@ -945,7 +921,6 @@ class Bond { _pathNegotiationCutoffCount = 0; } _lastPathNegotiationReceived = now; - // fprintf(stderr, "rateGateNeg (count=%d, send_interval=%d, diff=%d, path=%s)\n", _pathNegotiationCutoffCount, (ZT_PATH_NEGOTIATION_CUTOFF_TIME / ZT_MAX_PEER_NETWORK_PATHS), diff, pathStr); return (_pathNegotiationCutoffCount < (ZT_MAX_PEER_NETWORK_PATHS * 2)); } @@ -1061,20 +1036,11 @@ class Bond { } /** - * - * @param allowFlowHashing + * @return Whether flow-hashing is currently supported for this bond. */ - inline void setFlowHashing(bool allowFlowHashing) + bool flowHashingSupported() { - _allowFlowHashing = allowFlowHashing; - } - - /** - * @return Whether flow-hashing is currently enabled for this bond. - */ - bool flowHashingEnabled() - { - return _allowFlowHashing; + return _policy == ZT_BOND_POLICY_BALANCE_XOR || _policy == ZT_BOND_POLICY_BALANCE_AWARE; } /** @@ -1221,16 +1187,14 @@ class Bond { , onlyPathOnLink(false) , bonded(false) , negotiated(false) - , shouldReallocateFlows(false) + , shouldAvoid(false) , assignedFlowCount(0) - , latencyMean(0) + , latency(0) , latencyVariance(0) , packetLossRatio(0) , packetErrorRatio(0) - , allocation(0) - , byteLoad(0) - , relativeByteLoad(0) - , affinity(0) + , relativeQuality(0) + , relativeLinkCapacity(0) , failoverScore(0) , packetsReceivedSinceLastQoS(0) , packetsIn(0) @@ -1298,7 +1262,7 @@ class Bond { * @param now Current time * @return Whether a QoS (VERB_QOS_MEASUREMENT) packet needs to be emitted at this time */ - inline bool needsToSendQoS(int64_t now, int qosSendInterval) + inline bool needsToSendQoS(int64_t now, uint64_t qosSendInterval) { // fprintf(stderr, "QOS table (%d / %d)\n", packetsReceivedSinceLastQoS, ZT_QOS_TABLE_SIZE); return ((packetsReceivedSinceLastQoS >= ZT_QOS_TABLE_SIZE) || ((now - lastQoSMeasurement) > qosSendInterval)) && packetsReceivedSinceLastQoS; @@ -1308,7 +1272,7 @@ class Bond { * @param now Current time * @return Whether an ACK (VERB_ACK) packet needs to be emitted at this time */ - inline bool needsToSendAck(int64_t now, int ackSendInterval) + inline bool needsToSendAck(int64_t now, uint64_t ackSendInterval) { return ((now - lastAckSent) >= ackSendInterval || (packetsReceivedSinceLastAck == ZT_QOS_TABLE_SIZE)) && packetsReceivedSinceLastAck; } @@ -1344,26 +1308,25 @@ class Bond { uint64_t lastRefractoryUpdate; // The last time that the refractory period was updated. uint64_t lastAliveToggle; // The last time that the path was marked as "alive". bool alive; - bool eligible; // State of eligibility at last check. Used for determining state changes. - uint64_t lastEligibility; // The last time that this path was eligible - uint64_t whenNominated; // Timestamp indicating when this path's trial period began. - uint32_t refractoryPeriod; // Amount of time that this path will be prevented from becoming a member of a bond. - uint8_t ipvPref; // IP version preference inherited from the physical link. - uint8_t mode; // Mode inherited from the physical link. - bool onlyPathOnLink; // IP version preference inherited from the physical link. - bool enabled; // Enabled state inherited from the physical link. - bool bonded; // Whether this path is currently part of a bond. - bool negotiated; // Whether this path was intentionally negotiated by either peer. - bool shouldReallocateFlows; // Whether flows should be moved from this path. Current traffic flows will be re-allocated immediately. - uint16_t assignedFlowCount; // The number of flows currently assigned to this path. - float latencyMean; // The mean latency (computed from a sliding window.) - float latencyVariance; // Packet delay variance (computed from a sliding window.) - float packetLossRatio; // The ratio of lost packets to received packets. - float packetErrorRatio; // The ratio of packets that failed their MAC/CRC checks to those that did not. - uint8_t allocation; // The relative quality of this path to all others in the bond, [0-255]. - uint64_t byteLoad; // How much load this path is under. - uint8_t relativeByteLoad; // How much load this path is under (relative to other paths in the bond.) - uint8_t affinity; // Relative value expressing how "deserving" this path is of new traffic. + bool eligible; // State of eligibility at last check. Used for determining state changes. + uint64_t lastEligibility; // The last time that this path was eligible + uint64_t whenNominated; // Timestamp indicating when this path's trial period began. + uint32_t refractoryPeriod; // Amount of time that this path will be prevented from becoming a member of a bond. + uint8_t ipvPref; // IP version preference inherited from the physical link. + uint8_t mode; // Mode inherited from the physical link. + bool onlyPathOnLink; // IP version preference inherited from the physical link. + bool enabled; // Enabled state inherited from the physical link. + bool bonded; // Whether this path is currently part of a bond. + bool negotiated; // Whether this path was intentionally negotiated by either peer. + bool shouldAvoid; // Whether flows should be moved from this path. Current traffic flows will be re-allocated immediately. + uint16_t assignedFlowCount; // The number of flows currently assigned to this path. + float latency; // The mean latency (computed from a sliding window.) + float latencyVariance; // Packet delay variance (computed from a sliding window.) + float packetLossRatio; // The ratio of lost packets to received packets. + float packetErrorRatio; // The ratio of packets that failed their MAC/CRC checks to those that did not. + float relativeQuality; // The relative quality of the link. + float relativeLinkCapacity; // The relative capacity of the link. + uint32_t failoverScore; // Score that indicates to what degree this path is preferred over others that are available to the bonding policy. (specifically for active-backup) int32_t packetsReceivedSinceLastQoS; // Number of packets received since the last VERB_QOS_MEASUREMENT was sent to the remote peer. @@ -1461,10 +1424,12 @@ class Bond { * may only be updated during a call to curateBond(). The reason for this is so that * we can simplify the high frequency packet egress logic. */ - int _bondIdxMap[ZT_MAX_PEER_NETWORK_PATHS]; - int _numBondedPaths; // Number of paths currently included in the _bondIdxMap set. - std::map > _flows; // Flows hashed according to port and protocol - float _qw[ZT_QOS_WEIGHT_SIZE]; // How much each factor contributes to the "quality" score of a path. + int _realIdxMap[ZT_MAX_PEER_NETWORK_PATHS] = { ZT_MAX_PEER_NETWORK_PATHS }; + int _numBondedPaths; // Number of paths currently included in the _realIdxMap set. + std::map > _flows; // Flows hashed according to port and protocol + float _qw[ZT_QOS_PARAMETER_SIZE]; // Link quality specification (can be customized by user) + + bool _run; uint8_t _policy; uint32_t _upDelay; @@ -1500,20 +1465,11 @@ class Bond { /** * Timers and intervals */ - uint32_t _failoverInterval; - uint32_t _qosSendInterval; - uint32_t _ackSendInterval; - uint32_t throughputMeasurementInterval; - uint32_t _qualityEstimationInterval; - - /** - * Acceptable quality thresholds - */ - float _maxAcceptablePacketLossRatio; - float _maxAcceptablePacketErrorRatio; - uint16_t _maxAcceptableLatency; - uint16_t _maxAcceptableMeanLatency; - uint16_t _maxAcceptablePacketDelayVariance; + uint64_t _failoverInterval; + uint64_t _qosSendInterval; + uint64_t _ackSendInterval; + uint64_t throughputMeasurementInterval; + uint64_t _qualityEstimationInterval; /** * Link state reporting @@ -1563,7 +1519,7 @@ class Bond { bool _userHasSpecifiedLinks; // Whether the user has specified links for this bond. bool _userHasSpecifiedPrimaryLink; // Whether the user has specified a primary link for this bond. bool _userHasSpecifiedFailoverInstructions; // Whether the user has specified failover instructions for this bond. - bool _userHasSpecifiedLinkSpeeds; // Whether the user has specified links speeds for this bond. + bool _userHasSpecifiedLinkCapacities; // Whether the user has specified links capacities for this bond. /** * How frequently (in ms) a VERB_ECHO is sent to a peer to verify that a * path is still active. A value of zero (0) will disable active path diff --git a/node/Constants.hpp b/node/Constants.hpp index 6389bdcd3..f9fa72333 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -390,7 +390,7 @@ /** * Number of samples to consider when processing real-time path statistics */ -#define ZT_QOS_SHORTTERM_SAMPLE_WIN_SIZE 32 +#define ZT_QOS_SHORTTERM_SAMPLE_WIN_SIZE 64 /** * Max allowable time spent in any queue (in ms) diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 72cd4bde7..9080128b6 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -707,7 +707,7 @@ bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const Shar { int32_t _flowId = ZT_QOS_NO_FLOW; SharedPtr bond = peer->bond(); - if (bond && bond->flowHashingEnabled()) { + if (bond && bond->flowHashingSupported()) { if (size() > ZT_PROTO_VERB_EXT_FRAME_IDX_PAYLOAD) { const unsigned int etherType = at(ZT_PROTO_VERB_FRAME_IDX_ETHERTYPE); const unsigned int frameLen = size() - ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; diff --git a/node/Node.cpp b/node/Node.cpp index 087d8d048..019a8afca 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -510,7 +510,7 @@ ZT_PeerList *Node::peers() const p->paths[p->pathCount].latencyVariance = (*path)->latencyVariance(); p->paths[p->pathCount].packetLossRatio = (*path)->packetLossRatio(); p->paths[p->pathCount].packetErrorRatio = (*path)->packetErrorRatio(); - p->paths[p->pathCount].allocation = (*path)->allocation(); + p->paths[p->pathCount].relativeQuality = (*path)->relativeQuality(); p->paths[p->pathCount].linkSpeed = (*path)->givenLinkSpeed(); p->paths[p->pathCount].bonded = (*path)->bonded(); p->paths[p->pathCount].eligible = (*path)->eligible(); diff --git a/node/Path.hpp b/node/Path.hpp index 8782f35cf..11a3e5113 100644 --- a/node/Path.hpp +++ b/node/Path.hpp @@ -93,7 +93,7 @@ public: _eligible(false), _bonded(false), _givenLinkSpeed(0), - _allocation(0), + _relativeQuality(0), _latency(0xffff), _addr(), _ipScope(InetAddress::IP_SCOPE_NONE) @@ -113,7 +113,7 @@ public: _eligible(false), _bonded(false), _givenLinkSpeed(0), - _allocation(0), + _relativeQuality(0), _latency(0xffff), _addr(addr), _ipScope(addr.ipScope()) @@ -335,14 +335,14 @@ public: inline unsigned int bonded() const { return _bonded; } /** - * @return Given link speed as reported by the bonding layer + * @return Given link capacity as reported by the bonding layer */ inline unsigned int givenLinkSpeed() const { return _givenLinkSpeed; } /** - * @return Traffic allocation as reported by the bonding layer + * @return Path's quality as reported by the bonding layer */ - inline unsigned char allocation() const { return _allocation; } + inline float relativeQuality() const { return _relativeQuality; } /** * @return Physical interface name that this path lives on @@ -371,7 +371,7 @@ private: volatile bool _eligible; volatile bool _bonded; volatile uint32_t _givenLinkSpeed; - volatile uint8_t _allocation; + volatile float _relativeQuality; volatile unsigned int _latency; InetAddress _addr; diff --git a/node/Peer.cpp b/node/Peer.cpp index 963774d5e..99fa8d277 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -270,30 +270,30 @@ SharedPtr Peer::getAppropriatePath(int64_t now, bool includeExpired, int32 { Mutex::Lock _l(_paths_m); Mutex::Lock _lb(_bond_m); - if (!_bond) { - unsigned int bestPath = ZT_MAX_PEER_NETWORK_PATHS; - /** - * Send traffic across the highest quality path only. This algorithm will still - * use the old path quality metric from protocol version 9. - */ - long bestPathQuality = 2147483647; - for(unsigned int i=0;iquality(now) / _paths[i].priority; - if (q <= bestPathQuality) { - bestPathQuality = q; - bestPath = i; - } - } - } else break; - } - if (bestPath != ZT_MAX_PEER_NETWORK_PATHS) { - return _paths[bestPath].p; - } - return SharedPtr(); + if(_bond && _bond->isReady()) { + return _bond->getAppropriatePath(now, flowId); } - return _bond->getAppropriatePath(now, flowId); + unsigned int bestPath = ZT_MAX_PEER_NETWORK_PATHS; + /** + * Send traffic across the highest quality path only. This algorithm will still + * use the old path quality metric from protocol version 9. + */ + long bestPathQuality = 2147483647; + for(unsigned int i=0;iquality(now) / _paths[i].priority; + if (q <= bestPathQuality) { + bestPathQuality = q; + bestPath = i; + } + } + } else break; + } + if (bestPath != ZT_MAX_PEER_NETWORK_PATHS) { + return _paths[bestPath].p; + } + return SharedPtr(); } void Peer::introduce(void *const tPtr,const int64_t now,const SharedPtr &other) const diff --git a/one.cpp b/one.cpp index 9a3363933..62710547c 100644 --- a/one.cpp +++ b/one.cpp @@ -637,20 +637,20 @@ static int cli(int argc,char **argv) ); } printf("\nidx lat pdv " - "plr per speed alloc " + "plr per capacity qual " "rx_age tx_age eligible bonded\n"); for(int i=0; i<100; i++) { printf("-"); } printf("\n"); for (int i=0; i j["bonded"] = peer->paths[i].bonded; j["eligible"] = peer->paths[i].eligible; j["givenLinkSpeed"] = peer->paths[i].linkSpeed; - j["allocation"] = std::round(((float)(peer->paths[i].allocation) / 255.0) * 1000.0) / 1000.0; + j["relativeQuality"] = peer->paths[i].relativeQuality; } pa.push_back(j); } @@ -1484,7 +1484,6 @@ public: _peerToJson(res,&(pl->peers[i]),bond); scode = 200; } else { - fprintf(stderr, "unable to find bond to peer %llx\n", (unsigned long long)wantp); scode = 400; } } @@ -2023,23 +2022,20 @@ public: } // New bond, used as a copy template for new instances SharedPtr newTemplateBond = new Bond(NULL, basePolicyStr, customPolicyStr, SharedPtr()); - // Acceptable ranges newTemplateBond->setPolicy(basePolicyCode); - newTemplateBond->setMaxAcceptableLatency(OSUtils::jsonInt(customPolicy["maxAcceptableLatency"],-1)); - newTemplateBond->setMaxAcceptableMeanLatency(OSUtils::jsonInt(customPolicy["maxAcceptableMeanLatency"],-1)); - newTemplateBond->setMaxAcceptablePacketDelayVariance(OSUtils::jsonInt(customPolicy["maxAcceptablePacketDelayVariance"],-1)); - newTemplateBond->setMaxAcceptablePacketLossRatio((float)OSUtils::jsonDouble(customPolicy["maxAcceptablePacketLossRatio"],-1)); - newTemplateBond->setMaxAcceptablePacketErrorRatio((float)OSUtils::jsonDouble(customPolicy["maxAcceptablePacketErrorRatio"],-1)); - // Quality weights - json &qualityWeights = customPolicy["qualityWeights"]; - if (qualityWeights.size() == ZT_QOS_WEIGHT_SIZE) { - float weights[ZT_QOS_WEIGHT_SIZE]; - weights[ZT_QOS_LAT_IDX] = (float)OSUtils::jsonDouble(qualityWeights["lat"],0.0); - weights[ZT_QOS_LTM_IDX] = (float)OSUtils::jsonDouble(qualityWeights["ltm"],0.0); - weights[ZT_QOS_PDV_IDX] = (float)OSUtils::jsonDouble(qualityWeights["pdv"],0.0); - weights[ZT_QOS_PLR_IDX] = (float)OSUtils::jsonDouble(qualityWeights["plr"],0.0); - weights[ZT_QOS_PER_IDX] = (float)OSUtils::jsonDouble(qualityWeights["per"],0.0); - newTemplateBond->setUserQualityWeights(weights,ZT_QOS_WEIGHT_SIZE); + // Custom link quality spec + json &linkQualitySpec = customPolicy["linkQuality"]; + if (linkQualitySpec.size() == ZT_QOS_PARAMETER_SIZE) { + float weights[ZT_QOS_PARAMETER_SIZE] = {}; + weights[ZT_QOS_LAT_MAX_IDX] = (float)OSUtils::jsonDouble(linkQualitySpec["lat_max"],0.0); + weights[ZT_QOS_PDV_MAX_IDX] = (float)OSUtils::jsonDouble(linkQualitySpec["pdv_max"],0.0); + weights[ZT_QOS_PLR_MAX_IDX] = (float)OSUtils::jsonDouble(linkQualitySpec["plr_max"],0.0); + weights[ZT_QOS_PER_MAX_IDX] = (float)OSUtils::jsonDouble(linkQualitySpec["per_max"],0.0); + weights[ZT_QOS_LAT_WEIGHT_IDX] = (float)OSUtils::jsonDouble(linkQualitySpec["lat_weight"],0.0); + weights[ZT_QOS_PDV_WEIGHT_IDX] = (float)OSUtils::jsonDouble(linkQualitySpec["pdv_weight"],0.0); + weights[ZT_QOS_PLR_WEIGHT_IDX] = (float)OSUtils::jsonDouble(linkQualitySpec["plr_weight"],0.0); + weights[ZT_QOS_PER_WEIGHT_IDX] = (float)OSUtils::jsonDouble(linkQualitySpec["per_weight"],0.0); + newTemplateBond->setUserLinkQualitySpec(weights,ZT_QOS_PARAMETER_SIZE); } // Bond-specific properties newTemplateBond->setUpDelay(OSUtils::jsonInt(customPolicy["upDelay"],-1)); @@ -2053,7 +2049,7 @@ public: std::string linkNameStr(linkItr.key()); json &link = linkItr.value(); bool enabled = OSUtils::jsonInt(link["enabled"],true); - uint32_t speed = OSUtils::jsonInt(link["speed"],0); + uint32_t capacity = OSUtils::jsonInt(link["capacity"],0); uint8_t ipvPref = OSUtils::jsonInt(link["ipvPref"],0); std::string failoverToStr(OSUtils::jsonString(link["failoverTo"],"")); // Mode @@ -2071,7 +2067,7 @@ public: failoverToStr = ""; enabled = false; } - _node->bondController()->addCustomLink(customPolicyStr, new Link(linkNameStr,ipvPref,speed,enabled,linkMode,failoverToStr)); + _node->bondController()->addCustomLink(customPolicyStr, new Link(linkNameStr,ipvPref,capacity,enabled,linkMode,failoverToStr)); } std::string linkSelectMethodStr(OSUtils::jsonString(customPolicy["activeReselect"],"optimize")); if (linkSelectMethodStr == "always") { From 99c0ca621be63b6f8342a2fb211f521f27970084 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 13 Oct 2022 09:01:14 -0400 Subject: [PATCH 07/31] 1.10.2 bump --- debian/changelog | 6 ++++++ ext/installfiles/mac/ZeroTier One.pkgproj | 2 +- version.h | 2 +- zerotier-one.spec | 5 ++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 19e9929d9..dcc312250 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +zerotier-one (1.10.2) unstable; urgency=medium + + * See RELEASE-NOTES.md for release notes. + + -- Adam Ierymenko Thu, 13 Oct 2022 01:00:00 -0700 + zerotier-one (1.10.1) unstable; urgency=medium * See RELEASE-NOTES.md for release notes. diff --git a/ext/installfiles/mac/ZeroTier One.pkgproj b/ext/installfiles/mac/ZeroTier One.pkgproj index 49d9a24c6..3b4423d22 100755 --- a/ext/installfiles/mac/ZeroTier One.pkgproj +++ b/ext/installfiles/mac/ZeroTier One.pkgproj @@ -701,7 +701,7 @@ USE_HFS+_COMPRESSION VERSION - 1.10.1 + 1.10.2 TYPE 0 diff --git a/version.h b/version.h index 346e3df01..64fbfa5d8 100644 --- a/version.h +++ b/version.h @@ -27,7 +27,7 @@ /** * Revision */ -#define ZEROTIER_ONE_VERSION_REVISION 1 +#define ZEROTIER_ONE_VERSION_REVISION 2 /** * Build version diff --git a/zerotier-one.spec b/zerotier-one.spec index 022fa039c..86fe7d0d8 100644 --- a/zerotier-one.spec +++ b/zerotier-one.spec @@ -1,5 +1,5 @@ Name: zerotier-one -Version: 1.10.1 +Version: 1.10.2 Release: 1%{?dist} Summary: ZeroTier network virtualization service @@ -137,6 +137,9 @@ chmod 0755 $RPM_BUILD_ROOT/etc/init.d/zerotier-one %endif %changelog +* Mon Oct 13 2022 Adam Ierymenko - 1.10.2 +- see https://github.com/zerotier/ZeroTierOne for release notes + * Mon Jun 27 2022 Adam Ierymenko - 1.10.1 - see https://github.com/zerotier/ZeroTierOne for release notes From 82c799b9d16861dd2627b58d38402804835588f3 Mon Sep 17 00:00:00 2001 From: travis laduke Date: Tue, 25 Oct 2022 11:25:21 -0700 Subject: [PATCH 08/31] Expose surface addresses in info json Surface Addresses are the addresses that the roots report back to you. This is helpful for trouble shooting. If you're behind NAT, the source port is different than what zerotier is bound to. If the list of surface address ports is larger than the list of bound addresses, you are probably behind symmetric NAT. Anways this can be added to later with a more simple "easy" or "hard" nat computed message somewhere. --- node/Node.hpp | 3 +++ service/OneService.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/node/Node.hpp b/node/Node.hpp index 52506ed9e..834f50cc9 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -35,6 +35,7 @@ #include "NetworkController.hpp" #include "Hashtable.hpp" #include "Bond.hpp" +#include "SelfAwareness.hpp" // Bit mask for "expecting reply" hash #define ZT_EXPECTING_REPLIES_BUCKET_MASK1 255 @@ -187,6 +188,8 @@ public: inline const Identity &identity() const { return _RR.identity; } + inline const std::vector SurfaceAddresses() const { return _RR.sa->whoami(); } + inline Bond *bondController() const { return _RR.bc; } /** diff --git a/service/OneService.cpp b/service/OneService.cpp index a9cb229ec..d17b539f2 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1560,6 +1560,15 @@ public: } settings["listeningOn"] = boundAddrArray; + std::vector surfaceAddrs = _node-> SurfaceAddresses(); + auto surfaceAddrArray = json::array(); + for (int i = 0; i < surfaceAddrs.size(); i++) { + char ipBuf[64] = { 0 }; + surfaceAddrs[i].toString(ipBuf); + surfaceAddrArray.push_back(ipBuf); + } + settings["surfaceAddresses"] = surfaceAddrArray; + #ifdef ZT_USE_MINIUPNPC settings["portMappingEnabled"] = OSUtils::jsonBool(settings["portMappingEnabled"],true); #else From 880a99adf8670f2cc75903c8c22efeae3cc4a665 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 25 Oct 2022 14:17:23 -0700 Subject: [PATCH 09/31] Minor edits to comments --- service/OneService.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/OneService.cpp b/service/OneService.cpp index d3ea2ab29..daba4d99b 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1526,7 +1526,7 @@ public: settings["primaryPort"] = OSUtils::jsonInt(settings["primaryPort"],(uint64_t)_primaryPort) & 0xffff; settings["secondaryPort"] = OSUtils::jsonInt(settings["secondaryPort"],(uint64_t)_secondaryPort) & 0xffff; settings["tertiaryPort"] = OSUtils::jsonInt(settings["tertiaryPort"],(uint64_t)_tertiaryPort) & 0xffff; - // Enumerate all external listening address/port pairs + // Enumerate all local address/port pairs that this node is listening on std::vector boundAddrs(_binder.allBoundLocalInterfaceAddresses()); auto boundAddrArray = json::array(); for (int i = 0; i < boundAddrs.size(); i++) { @@ -1535,8 +1535,8 @@ public: boundAddrArray.push_back(ipBuf); } settings["listeningOn"] = boundAddrArray; - - std::vector surfaceAddrs = _node-> SurfaceAddresses(); + // Enumerate all external address/port pairs that are reported for this node + std::vector surfaceAddrs = _node->SurfaceAddresses(); auto surfaceAddrArray = json::array(); for (int i = 0; i < surfaceAddrs.size(); i++) { char ipBuf[64] = { 0 }; From ad54d0ed52f25cc80de9de90702e9123a11b1a02 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 1 Nov 2022 15:56:36 -0400 Subject: [PATCH 10/31] 1.10.2 bump in Advanced Installer --- ext/installfiles/windows/ZeroTier One.aip | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index 2f1fdc632..daaea8cc3 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@ - + @@ -32,10 +32,10 @@ - + - + @@ -70,7 +70,7 @@ - + @@ -194,7 +194,7 @@ - + @@ -420,6 +420,7 @@ + @@ -527,7 +528,7 @@ - + From e0acccc3c918b59678033e585b31eb000c68fdf2 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 1 Nov 2022 16:08:52 -0400 Subject: [PATCH 11/31] release notes --- RELEASE-NOTES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 5fc0de669..f57e9820e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,6 +1,17 @@ ZeroTier Release Notes ====== +# 2022-11-01 -- Version 1.10.2 + + * Fix another SSO "stuck client" issue in zeroidc. + * Expose root-reported external IP/port information via the local JSON API for better diagnostics. + * Multipath: CLI output improvement for inspecting bonds + * Multipath: balance-aware mode + * Multipath: Custom policies + * Multipath: Link quality measurement improvements + +Note that releases are coming few and far between because most of our dev effort is going into version 2. + # 2022-06-27 -- Version 1.10.1 * Fix an issue that could cause SSO clients to get "stuck" on stale auth URLs. From b02a41751c95e6eaab8bd6d053f0e91d2a9c8bac Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Wed, 2 Nov 2022 08:46:11 -0700 Subject: [PATCH 12/31] Fix unresponsiveness when moving flows in balance-aware (See #1764) --- node/Bond.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/node/Bond.cpp b/node/Bond.cpp index 5ab164bb5..23c309acf 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -1374,14 +1374,13 @@ void Bond::processBalanceTasks(int64_t now) Mutex::Lock _l(_flows_m); std::map >::iterator flow_it = _flows.begin(); while (flow_it != _flows.end()) { - if (! _paths[flow_it->second->assignedPath].p) { - continue; - } - int originalPathIdx = flow_it->second->assignedPath; - if (! _paths[originalPathIdx].eligible) { - log("moving all flows from dead link %s", pathToStr(_paths[originalPathIdx].p).c_str()); - if (assignFlowToBondedPath(flow_it->second, now, true)) { - _paths[originalPathIdx].assignedFlowCount--; + if (_paths[flow_it->second->assignedPath].p) { + int originalPathIdx = flow_it->second->assignedPath; + if (! _paths[originalPathIdx].eligible) { + log("moving all flows from dead link %s", pathToStr(_paths[originalPathIdx].p).c_str()); + if (assignFlowToBondedPath(flow_it->second, now, true)) { + _paths[originalPathIdx].assignedFlowCount--; + } } } ++flow_it; @@ -1394,14 +1393,13 @@ void Bond::processBalanceTasks(int64_t now) Mutex::Lock _l(_flows_m); std::map >::iterator flow_it = _flows.begin(); while (flow_it != _flows.end()) { - if (! _paths[flow_it->second->assignedPath].p) { - continue; - } - int originalPathIdx = flow_it->second->assignedPath; - if (_paths[originalPathIdx].shouldAvoid) { - if (assignFlowToBondedPath(flow_it->second, now, true)) { - _paths[originalPathIdx].assignedFlowCount--; - return; // Only move one flow at a time + if (_paths[flow_it->second->assignedPath].p) { + int originalPathIdx = flow_it->second->assignedPath; + if (_paths[originalPathIdx].shouldAvoid) { + if (assignFlowToBondedPath(flow_it->second, now, true)) { + _paths[originalPathIdx].assignedFlowCount--; + return; // Only move one flow at a time + } } } ++flow_it; From 1694d510ecbad85fdc80ac26ab8bdaa292a404cd Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 8 Nov 2022 16:50:42 -0800 Subject: [PATCH 13/31] Update snap build target --- make-linux.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-linux.mk b/make-linux.mk index 3941573cf..c7c6e3663 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -498,7 +498,7 @@ snap-uninstall: FORCE snap remove zerotier snap-build-remote: FORCE - cd pkg && snapcraft remote-build --build-on=amd64,arm64,s390x,ppc64el,armhf,i386 + cd pkg && snapcraft remote-build --build-for=amd64,arm64,s390x,ppc64el,armhf,i386 snap-upload-beta: FORCE snapcraft login --with-file=snapcraft-login-data From 6448189d2099d751b664a49bdecbbc9c627011db Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Wed, 9 Nov 2022 08:52:55 -0800 Subject: [PATCH 14/31] Update snap upload target --- make-linux.mk | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/make-linux.mk b/make-linux.mk index c7c6e3663..ba4810656 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -500,13 +500,10 @@ snap-uninstall: FORCE snap-build-remote: FORCE cd pkg && snapcraft remote-build --build-for=amd64,arm64,s390x,ppc64el,armhf,i386 -snap-upload-beta: FORCE - snapcraft login --with-file=snapcraft-login-data - pushd pkg - for SNAPFILE in ./*.snap; do\ - snapcraft upload --release=stable,beta,edge,candidate $${SNAPFILE};\ +snap-upload: ./pkg/*.snap + for file in $^ ; do \ + snapcraft upload --release=beta,edge,candidate $${file} ; \ done - popd synology-pkg: FORCE cd pkg/synology ; ./build.sh build From b41e0910b0fb0b0dcc0c398313ce7697964b695e Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Wed, 9 Nov 2022 11:11:10 -0800 Subject: [PATCH 15/31] Fun times in ~~cleveland~~ NDK-land --- java/jni/Application.mk | 2 +- java/jni/ZT_jniarray.cpp | 1 + osdep/Binder.hpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/java/jni/Application.mk b/java/jni/Application.mk index 8613c15ee..7980d8c27 100644 --- a/java/jni/Application.mk +++ b/java/jni/Application.mk @@ -1,5 +1,5 @@ # NDK_TOOLCHAIN_VERSION := clang3.5 APP_STL := c++_static -APP_CPPFLAGS := -Wall -fstack-protector -fexceptions -fno-strict-aliasing -frtti -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1 +APP_CPPFLAGS := -Wall -fstack-protector -fexceptions -fno-strict-aliasing -frtti -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1 -DZT_SSO_SUPPORTED=0 -DOMIT_JSON_SUPPORT=1 APP_PLATFORM := android-21 APP_ABI := all diff --git a/java/jni/ZT_jniarray.cpp b/java/jni/ZT_jniarray.cpp index 24ae97c71..a1cae76ed 100644 --- a/java/jni/ZT_jniarray.cpp +++ b/java/jni/ZT_jniarray.cpp @@ -5,6 +5,7 @@ #include "ZT_jniarray.h" #include #include +#include jclass java_util_ArrayList; jmethodID java_util_ArrayList_; diff --git a/osdep/Binder.hpp b/osdep/Binder.hpp index 8ce4e20e2..3236d30b7 100644 --- a/osdep/Binder.hpp +++ b/osdep/Binder.hpp @@ -311,7 +311,7 @@ class Binder { #else const bool gotViaProc = false; #endif -#if ! defined(ZT_SDK) || ! defined(__ANDROID__) // getifaddrs() freeifaddrs() not available on Android +#if ! (defined(ZT_SDK) || defined(__ANDROID__)) // getifaddrs() freeifaddrs() not available on Android if (! gotViaProc) { struct ifaddrs* ifatbl = (struct ifaddrs*)0; struct ifaddrs* ifa; From 9568a4f2b4bce03db072fc2d0cc92f431b2587ac Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 10 Nov 2022 11:35:34 -0800 Subject: [PATCH 16/31] netinet6/in6_var.h not available in iOS --- osdep/Binder.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osdep/Binder.hpp b/osdep/Binder.hpp index 3236d30b7..4e08f4539 100644 --- a/osdep/Binder.hpp +++ b/osdep/Binder.hpp @@ -42,7 +42,9 @@ #if (defined(__unix__) || defined(__APPLE__)) && !defined(__LINUX__) && !defined(ZT_SDK) #include +#if ! defined(TARGET_OS_IOS) #include +#endif #include #endif @@ -324,7 +326,7 @@ class Binder { while (ifa) { if ((ifa->ifa_name) && (ifa->ifa_addr)) { InetAddress ip = *(ifa->ifa_addr); -#if (defined(__unix__) || defined(__APPLE__)) && !defined(__LINUX__) && !defined(ZT_SDK) +#if (defined(__unix__) || defined(__APPLE__)) && !defined(__LINUX__) && !defined(ZT_SDK) && !defined(TARGET_OS_IOS) // Check if the address is an IPv6 Temporary Address, macOS/BSD version if (ifa->ifa_addr->sa_family == AF_INET6) { struct sockaddr_in6* sa6 = (struct sockaddr_in6*)ifa->ifa_addr; From 98b190c626a652c730f5e58fcaecc9ae9c2c76d3 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Mon, 14 Nov 2022 15:25:50 -0800 Subject: [PATCH 17/31] Minor adjustment to packaging README --- pkg/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/README.md b/pkg/README.md index defc65112..0bd8ef00b 100644 --- a/pkg/README.md +++ b/pkg/README.md @@ -1,4 +1,4 @@ Third-party packaging ===== -Builds packages for various embedded devices and appliances and platforms +For package documentation see the `Devices` section here: [docs.zerotier.com](https://docs.zerotier.com/) From 668ab8b85c169648141d961566f183cf71ae6fa6 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Sat, 19 Nov 2022 22:59:55 +0100 Subject: [PATCH 18/31] fixing Makefile for armv6k (#1790) --- make-linux.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/make-linux.mk b/make-linux.mk index ba4810656..e188d3e60 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -198,6 +198,11 @@ ifeq ($(CC_MACH),armv6kz) override DEFS+=-DZT_NO_TYPE_PUNNING ZT_USE_ARM32_NEON_ASM_CRYPTO=1 endif +ifeq ($(CC_MACH),armv6k) + ZT_ARCHITECTURE=3 + override DEFS+=-DZT_NO_TYPE_PUNNING + ZT_USE_ARM32_NEON_ASM_CRYPTO=1 +endif ifeq ($(CC_MACH),armv7) ZT_ARCHITECTURE=3 override DEFS+=-DZT_NO_TYPE_PUNNING @@ -257,7 +262,7 @@ endif # Fail if system architecture could not be determined ifeq ($(ZT_ARCHITECTURE),999) -ERR=$(error FATAL: architecture could not be determined from $(CC) -dumpmachine: $CC_MACH) +ERR=$(error FATAL: architecture could not be determined from $(CC) -dumpmachine: $(CC_MACH)) .PHONY: err err: ; $(ERR) endif From f74a594e988590d80e43082ec85d40ac64e0291d Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Mon, 28 Nov 2022 09:23:45 -0500 Subject: [PATCH 19/31] fix typos in comments and strings --- java/jni/ZT_jnilookup.cpp | 2 +- java/jni/ZT_jniutils.cpp | 2 +- java/jni/com_zerotierone_sdk_Node.cpp | 4 ++-- java/src/com/zerotier/sdk/NativeUtils.java | 2 +- java/src/com/zerotier/sdk/Node.java | 4 ++-- node/Bond.cpp | 2 +- node/DNS.hpp | 2 +- node/NetworkConfig.hpp | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/java/jni/ZT_jnilookup.cpp b/java/jni/ZT_jnilookup.cpp index 51d9c0739..4d867a35c 100644 --- a/java/jni/ZT_jnilookup.cpp +++ b/java/jni/ZT_jnilookup.cpp @@ -62,7 +62,7 @@ jclass JniLookup::findClass(const std::string &name) JNIEnv *env = NULL; if(m_jvm->GetEnv((void**)&env, JNI_VERSION_1_6) != JNI_OK) { - LOGE("Error retreiving JNI Environment"); + LOGE("Error retrieving JNI Environment"); return NULL; } const char *c = name.c_str(); diff --git a/java/jni/ZT_jniutils.cpp b/java/jni/ZT_jniutils.cpp index bcbd31916..bfb969abb 100644 --- a/java/jni/ZT_jniutils.cpp +++ b/java/jni/ZT_jniutils.cpp @@ -296,7 +296,7 @@ jobject newInetAddress(JNIEnv *env, const sockaddr_storage &addr) inetAddressClass, "getByAddress", "([B)Ljava/net/InetAddress;"); if(env->ExceptionCheck() || inetAddress_getByAddress == NULL) { - LOGE("Erorr finding getByAddress() static method"); + LOGE("Error finding getByAddress() static method"); return NULL; } diff --git a/java/jni/com_zerotierone_sdk_Node.cpp b/java/jni/com_zerotierone_sdk_Node.cpp index 6ddc35565..50dfd22e6 100644 --- a/java/jni/com_zerotierone_sdk_Node.cpp +++ b/java/jni/com_zerotierone_sdk_Node.cpp @@ -107,7 +107,7 @@ namespace { enum ZT_VirtualNetworkConfigOperation operation, const ZT_VirtualNetworkConfig *config) { - LOGV("VritualNetworkConfigFunctionCallback"); + LOGV("VirtualNetworkConfigFunctionCallback"); JniRef *ref = (JniRef*)userData; JNIEnv *env = NULL; ref->jvm->GetEnv((void**)&env, JNI_VERSION_1_6); @@ -1025,7 +1025,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket( inetAddressClass, "getAddress", "()[B"); if(getAddressMethod == NULL) { - // cant find InetAddress.getAddres() + // cant find InetAddress.getAddress() return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL); } diff --git a/java/src/com/zerotier/sdk/NativeUtils.java b/java/src/com/zerotier/sdk/NativeUtils.java index 07e1ef5bc..4932a6c71 100644 --- a/java/src/com/zerotier/sdk/NativeUtils.java +++ b/java/src/com/zerotier/sdk/NativeUtils.java @@ -43,7 +43,7 @@ public class NativeUtils { String[] parts = path.split("/"); String filename = (parts.length > 1) ? parts[parts.length - 1] : null; - // Split filename to prexif and suffix (extension) + // Split filename to prefix and suffix (extension) String prefix = ""; String suffix = null; if (filename != null) { diff --git a/java/src/com/zerotier/sdk/Node.java b/java/src/com/zerotier/sdk/Node.java index ef6ac9d2d..1b3a4901f 100644 --- a/java/src/com/zerotier/sdk/Node.java +++ b/java/src/com/zerotier/sdk/Node.java @@ -84,7 +84,7 @@ public class Node { * * @param now Current clock in milliseconds * @param getListener User written instance of the {@link DataStoreGetListener} interface called to get objects from persistent storage. This instance must be unique per Node object. - * @param putListener User written intstance of the {@link DataStorePutListener} interface called to put objects in persistent storage. This instance must be unique per Node object. + * @param putListener User written instance of the {@link DataStorePutListener} interface called to put objects in persistent storage. This instance must be unique per Node object. * @param sender * @param eventListener User written instance of the {@link EventListener} interface to receive status updates and non-fatal error notices. This instance must be unique per Node object. * @param frameListener @@ -197,7 +197,7 @@ public class Node { * Join a network * *

This may generate calls to the port config callback before it returns, - * or these may be deffered if a netconf is not available yet.

+ * or these may be deferred if a netconf is not available yet.

* *

If we are already a member of the network, nothing is done and OK is * returned.

diff --git a/node/Bond.cpp b/node/Bond.cpp index 23c309acf..14bf95ad8 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -428,7 +428,7 @@ void Bond::recordOutgoingPacket(const SharedPtr& path, uint64_t packetId, } if (shouldRecord) { //_paths[pathIdx].expectingAckAsOf = now; - //_paths[pathIdx].totalBytesSentSinceLastAckRecieved += payloadLength; + //_paths[pathIdx].totalBytesSentSinceLastAckReceived += payloadLength; //_paths[pathIdx].unackedBytes += payloadLength; if (_paths[pathIdx].qosStatsOut.size() < ZT_QOS_MAX_PENDING_RECORDS) { _paths[pathIdx].qosStatsOut[packetId] = now; diff --git a/node/DNS.hpp b/node/DNS.hpp index a954a6406..778680ff7 100644 --- a/node/DNS.hpp +++ b/node/DNS.hpp @@ -24,7 +24,7 @@ namespace ZeroTier { /** - * DNS data serealization methods + * DNS data serialization methods */ class DNS { public: diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp index 846f922da..0161b4fa9 100644 --- a/node/NetworkConfig.hpp +++ b/node/NetworkConfig.hpp @@ -177,7 +177,7 @@ namespace ZeroTier { #define ZT_NETWORKCONFIG_DICT_KEY_CERTIFICATES_OF_OWNERSHIP "COO" // dns (binary blobs) #define ZT_NETWORKCONFIG_DICT_KEY_DNS "DNS" -// sso enabld +// sso enabled #define ZT_NETWORKCONFIG_DICT_KEY_SSO_ENABLED "ssoe" // so version #define ZT_NETWORKCONFIG_DICT_KEY_SSO_VERSION "ssov" @@ -200,7 +200,7 @@ namespace ZeroTier { // AuthInfo Version #define ZT_AUTHINFO_DICT_KEY_VERSION "aV" -// authenticaiton URL +// authentication URL #define ZT_AUTHINFO_DICT_KEY_AUTHENTICATION_URL "aU" // issuer URL #define ZT_AUTHINFO_DICT_KEY_ISSUER_URL "iU" @@ -659,7 +659,7 @@ public: bool ssoEnabled; /** - * SSO verison + * SSO version */ uint64_t ssoVersion; From 3b8c33d49a846ee71ad300d1cf6d3f5c270a8163 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Mon, 28 Nov 2022 09:23:58 -0500 Subject: [PATCH 20/31] fix typos in code --- java/src/com/zerotier/sdk/NodeStatus.java | 2 +- node/Constants.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/com/zerotier/sdk/NodeStatus.java b/java/src/com/zerotier/sdk/NodeStatus.java index 94376d85b..11e49ade1 100644 --- a/java/src/com/zerotier/sdk/NodeStatus.java +++ b/java/src/com/zerotier/sdk/NodeStatus.java @@ -38,7 +38,7 @@ public final class NodeStatus { /** * 40-bit ZeroTier address of this node */ - public final long getAddres() { + public final long getAddress() { return address; } diff --git a/node/Constants.hpp b/node/Constants.hpp index f9fa72333..e234d510f 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -517,7 +517,7 @@ #define ZT_ACK_CUTOFF_LIMIT 128 #define ZT_ACK_DRAINAGE_DIVISOR (1000 / ZT_ACK_CUTOFF_LIMIT) -#define ZT_BOND_DEFAULT_REFRCTORY_PERIOD 8000 +#define ZT_BOND_DEFAULT_REFRACTORY_PERIOD 8000 #define ZT_BOND_MAX_REFRACTORY_PERIOD 600000 /** From 3ddaa60de95ffad7e96b2b436fb87c237689f9e9 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Tue, 29 Nov 2022 11:55:33 -0500 Subject: [PATCH 21/31] prevent: warning: unused variable 'gotViaProc' (#1797) --- osdep/Binder.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osdep/Binder.hpp b/osdep/Binder.hpp index 4e08f4539..666d63670 100644 --- a/osdep/Binder.hpp +++ b/osdep/Binder.hpp @@ -313,6 +313,13 @@ class Binder { #else const bool gotViaProc = false; #endif + + // + // prevent: + // warning: unused variable 'gotViaProc' + // + (void)gotViaProc; + #if ! (defined(ZT_SDK) || defined(__ANDROID__)) // getifaddrs() freeifaddrs() not available on Android if (! gotViaProc) { struct ifaddrs* ifatbl = (struct ifaddrs*)0; From 85da0b419c19da97f8310f9200b48d7ae68f2e23 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Wed, 30 Nov 2022 10:29:33 +0100 Subject: [PATCH 22/31] drone config --- .drone.jsonnet | 74 +- .drone.yml | 2565 +------------------------------------------ ci/Dockerfile.deb | 2 +- ci/Dockerfile.none | 5 + ci/Dockerfile.rpm | 2 +- ci/scripts/build.sh | 96 +- 6 files changed, 124 insertions(+), 2620 deletions(-) create mode 100644 ci/Dockerfile.none diff --git a/.drone.jsonnet b/.drone.jsonnet index 30271d99e..eae15501b 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -1,50 +1,7 @@ +local registry = "084037375216.dkr.ecr.us-east-2.amazonaws.com"; local targets = [ - // - // Render these into .drone.yaml by running "make drone" - // - { "os": "linux", "name": "el9", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "el8", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "el7", "isas": [ "amd64", "ppc64le"], "events": [ "tag" ] }, - { "os": "linux", "name": "el6", "isas": [ "amd64" ], "events": [ "tag" ] }, - { "os": "linux", "name": "amzn2", "isas": [ "amd64", "arm64" ], "events": [ "tag" ] }, - { "os": "linux", "name": "fc37", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "fc36", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "fc35", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "jammy", "isas": [ "amd64", "arm64", "armv7", "riscv64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "focal", "isas": [ "amd64", "arm64", "armv7", "riscv64", "ppc64le" ], "events": [ "tag" ] }, - { "os": "linux", "name": "bionic", "isas": [ "amd64", "arm64", "386", "ppc64le", "s390x" ], "events": ["tag" ] }, - { "os": "linux", "name": "xenial", "isas": [ "amd64", "arm64", "386" ], "events": [ "tag" ] }, - { "os": "linux", "name": "sid", "isas": [ "386", "amd64", "arm64", "riscv64", "mips64le", "ppc64le", "s390x" ], "events": [ "push", "tag" ] }, - { "os": "linux", "name": "bookworm", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "bullseye", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "buster", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "stretch", "isas": [ "amd64", "arm64", "386" ], "events": [ "tag" ] }, - // { "os": "windows", "name": "win2k19", "isas": [ "amd64" ], "events": ["push", "tag" ] } -]; - -local master_targets = [ - // - // Render these into .drone.yaml by running "make drone" - // - { "os": "linux", "name": "el9", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "el8", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "el7", "isas": [ "amd64", "ppc64le"], "events": [ "tag" ] }, - { "os": "linux", "name": "el6", "isas": [ "amd64" ], "events": [ "tag" ] }, - { "os": "linux", "name": "amzn2", "isas": [ "amd64", "arm64" ], "events": [ "tag" ] }, - { "os": "linux", "name": "fc37", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "fc36", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "fc35", "isas": [ "amd64", "arm64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "jammy", "isas": [ "amd64", "arm64", "armv7", "riscv64", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "focal", "isas": [ "amd64", "arm64", "armv7", "riscv64", "ppc64le" ], "events": [ "tag" ] }, - { "os": "linux", "name": "bionic", "isas": [ "amd64", "arm64", "386", "ppc64le", "s390x" ], "events": ["tag" ] }, - { "os": "linux", "name": "xenial", "isas": [ "amd64", "arm64", "386" ], "events": [ "tag" ] }, - { "os": "linux", "name": "sid", "isas": [ "386", "amd64", "arm64", "riscv64", "mips64le", "ppc64le", "s390x" ], "events": [ "push", "tag" ] }, - { "os": "linux", "name": "bookworm", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "bullseye", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "buster", "isas": [ "amd64", "arm64", "armv7", "386", "mips64le", "ppc64le", "s390x" ], "events": [ "tag" ] }, - { "os": "linux", "name": "stretch", "isas": [ "amd64", "arm64", "386" ], "events": [ "tag" ] }, - // { "os": "windows", "name": "win2k19", "isas": [ "amd64" ], "events": ["push", "tag" ] } + { "os": "linux", "name": "sid", "isas": [ "386", "armv7", "amd64", "arm64", "mips64le", "ppc64le", "s390x", "riscv64" ], "events": [ "push", "tag", "custom" ] }, ]; local Build(platform, os, isa, events) = { @@ -56,27 +13,18 @@ local Build(platform, os, isa, events) = { "steps": [ { "name": "build", - "image": "registry.sean.farm/honda-builder", - "commands": [ "./ci/scripts/build.sh " + platform + " " + isa + " " + "100.0.0+${DRONE_COMMIT_SHA:0:8}" + " " + "${DRONE_BUILD_EVENT}" ] - }, - { - "name": "list", - "image": "registry.sean.farm/honda-builder", - "commands": [ "ls -la " + platform ] + "image": registry + "/honda-builder", + "commands": [ + "aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin " + registry, + "./ci/scripts/build.sh " + platform + " " + isa + " " + "100.0.0+${DRONE_COMMIT_SHA:0:8}" + " " + "${DRONE_BUILD_EVENT}" + ] }, // { - // "name": "notify-mattermost", - // "image": "registry.sean.farm/mattermost-notify", - // "environment": { - // "token": { "from_secret": "mattermost-token" }, - // "host": { "from_secret": "mattermost-host" }, - // "channel": { "from_secret": "mattermost-channel" }, - // "maxRetry": 3, - // }, - // "when": { "status": [ "failure" ] } - // } + // "name": "list", + // "image": registry + "/honda-builder", + // "commands": [ "ls -la " + platform ] + // }, ], - "image_pull_secrets": [ "dockerconfigjson" ], [ if isa == "arm64" || isa == "armv7" then "platform" ]: { os: os, arch: "arm64" }, "trigger": { "event": events } }; diff --git a/.drone.yml b/.drone.yml index b2f91fe91..fc7643d45 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,1610 +1,66 @@ --- clone: depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el9 amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el9 amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el9 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el9 arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el9 arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el9 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el9 ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el9 ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el9 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el9 s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el9 s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el9 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el8 amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el8 amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el8 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el8 arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el8 arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el8 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el8 ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el8 ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el8 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el8 s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el8 s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el8 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el7 amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el7 amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el7 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el7 ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el7 ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el7 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: el6 amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh el6 amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la el6 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: amzn2 amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh amzn2 amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la amzn2 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: amzn2 arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh amzn2 arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la amzn2 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc37 amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc37 amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc37 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc37 arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc37 arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc37 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc37 ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc37 ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc37 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc37 s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc37 s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc37 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc36 amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc36 amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc36 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc36 arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc36 arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc36 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc36 ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc36 ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc36 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc36 s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc36 s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc36 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc35 amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc35 amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc35 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc35 arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc35 arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc35 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc35 ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc35 ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc35 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: fc35 s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh fc35 s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la fc35 - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: jammy amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh jammy amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la jammy - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: jammy arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh jammy arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la jammy - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: jammy armv7 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh jammy armv7 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la jammy - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: jammy riscv64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh jammy riscv64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la jammy - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: jammy ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh jammy ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la jammy - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: jammy s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh jammy s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la jammy - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: focal amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh focal amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la focal - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: focal arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh focal arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la focal - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: focal armv7 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh focal armv7 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la focal - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: focal riscv64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh focal riscv64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la focal - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: focal ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh focal ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la focal - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bionic amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bionic amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bionic - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bionic arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bionic arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bionic - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bionic 386 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bionic 386 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bionic - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bionic ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bionic ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bionic - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bionic s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bionic s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bionic - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: xenial amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh xenial amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la xenial - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: xenial arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh xenial arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la xenial - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: xenial 386 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh xenial 386 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la xenial - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson kind: pipeline name: sid 386 build pull: always steps: - commands: + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin + 084037375216.dkr.ecr.us-east-2.amazonaws.com - ./ci/scripts/build.sh sid 386 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder + image: 084037375216.dkr.ecr.us-east-2.amazonaws.com/honda-builder name: build -- commands: - - ls -la sid - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure trigger: event: - push - tag + - custom +type: docker +--- +clone: + depth: 1 +kind: pipeline +name: sid armv7 build +platform: + arch: arm64 + os: linux +pull: always +steps: +- commands: + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin + 084037375216.dkr.ecr.us-east-2.amazonaws.com + - ./ci/scripts/build.sh sid armv7 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} + image: 084037375216.dkr.ecr.us-east-2.amazonaws.com/honda-builder + name: build +trigger: + event: + - push + - tag + - custom type: docker --- clone: depth: 1 -image_pull_secrets: -- dockerconfigjson kind: pipeline name: sid amd64 build pull: always steps: - commands: + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin + 084037375216.dkr.ecr.us-east-2.amazonaws.com - ./ci/scripts/build.sh sid amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder + image: 084037375216.dkr.ecr.us-east-2.amazonaws.com/honda-builder name: build -- commands: - - ls -la sid - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure trigger: event: - push - tag + - custom type: docker --- clone: depth: 1 -image_pull_secrets: -- dockerconfigjson kind: pipeline name: sid arm64 build platform: @@ -1613,1005 +69,90 @@ platform: pull: always steps: - commands: + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin + 084037375216.dkr.ecr.us-east-2.amazonaws.com - ./ci/scripts/build.sh sid arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder + image: 084037375216.dkr.ecr.us-east-2.amazonaws.com/honda-builder name: build -- commands: - - ls -la sid - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure trigger: event: - push - tag + - custom type: docker --- clone: depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: sid riscv64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh sid riscv64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la sid - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - push - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson kind: pipeline name: sid mips64le build pull: always steps: - commands: + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin + 084037375216.dkr.ecr.us-east-2.amazonaws.com - ./ci/scripts/build.sh sid mips64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder + image: 084037375216.dkr.ecr.us-east-2.amazonaws.com/honda-builder name: build -- commands: - - ls -la sid - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure trigger: event: - push - tag + - custom type: docker --- clone: depth: 1 -image_pull_secrets: -- dockerconfigjson kind: pipeline name: sid ppc64le build pull: always steps: - commands: + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin + 084037375216.dkr.ecr.us-east-2.amazonaws.com - ./ci/scripts/build.sh sid ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder + image: 084037375216.dkr.ecr.us-east-2.amazonaws.com/honda-builder name: build -- commands: - - ls -la sid - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure trigger: event: - push - tag + - custom type: docker --- clone: depth: 1 -image_pull_secrets: -- dockerconfigjson kind: pipeline name: sid s390x build pull: always steps: - commands: + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin + 084037375216.dkr.ecr.us-east-2.amazonaws.com - ./ci/scripts/build.sh sid s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder + image: 084037375216.dkr.ecr.us-east-2.amazonaws.com/honda-builder name: build -- commands: - - ls -la sid - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure trigger: event: - push - tag + - custom type: docker --- clone: depth: 1 -image_pull_secrets: -- dockerconfigjson kind: pipeline -name: bookworm amd64 build +name: sid riscv64 build pull: always steps: - commands: - - ./ci/scripts/build.sh bookworm amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin + 084037375216.dkr.ecr.us-east-2.amazonaws.com + - ./ci/scripts/build.sh sid riscv64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} + image: 084037375216.dkr.ecr.us-east-2.amazonaws.com/honda-builder name: build -- commands: - - ls -la bookworm - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bookworm arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bookworm arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bookworm - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bookworm armv7 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bookworm armv7 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bookworm - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bookworm 386 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bookworm 386 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bookworm - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bookworm mips64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bookworm mips64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bookworm - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bookworm ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bookworm ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bookworm - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bookworm s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bookworm s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bookworm - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bullseye amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bullseye amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bullseye - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bullseye arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bullseye arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bullseye - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bullseye armv7 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bullseye armv7 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bullseye - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bullseye 386 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bullseye 386 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bullseye - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bullseye mips64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bullseye mips64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bullseye - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bullseye ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bullseye ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bullseye - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: bullseye s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh bullseye s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la bullseye - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: buster amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh buster amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la buster - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: buster arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh buster arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la buster - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: buster armv7 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh buster armv7 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la buster - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: buster 386 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh buster 386 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la buster - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: buster mips64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh buster mips64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la buster - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: buster ppc64le build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh buster ppc64le 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la buster - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: buster s390x build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh buster s390x 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la buster - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: stretch amd64 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh stretch amd64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la stretch - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: stretch arm64 build -platform: - arch: arm64 - os: linux -pull: always -steps: -- commands: - - ./ci/scripts/build.sh stretch arm64 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la stretch - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure -trigger: - event: - - tag -type: docker ---- -clone: - depth: 1 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: stretch 386 build -pull: always -steps: -- commands: - - ./ci/scripts/build.sh stretch 386 100.0.0+${DRONE_COMMIT_SHA:0:8} ${DRONE_BUILD_EVENT} - image: registry.sean.farm/honda-builder - name: build -- commands: - - ls -la stretch - image: registry.sean.farm/honda-builder - name: list -- environment: - channel: - from_secret: mattermost-channel - host: - from_secret: mattermost-host - maxRetry: 3 - token: - from_secret: mattermost-token - image: registry.sean.farm/mattermost-notify - name: notify-mattermost - when: - status: - - failure trigger: event: + - push - tag + - custom type: docker diff --git a/ci/Dockerfile.deb b/ci/Dockerfile.deb index 91b383a6a..151bca397 100644 --- a/ci/Dockerfile.deb +++ b/ci/Dockerfile.deb @@ -1,5 +1,5 @@ ARG PLATFORM -FROM registry.sean.farm/${PLATFORM}-builder as stage +FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${PLATFORM}-builder as stage WORKDIR /work/build COPY . . RUN make debian diff --git a/ci/Dockerfile.none b/ci/Dockerfile.none new file mode 100644 index 000000000..bee0128f7 --- /dev/null +++ b/ci/Dockerfile.none @@ -0,0 +1,5 @@ +ARG PLATFORM +FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${PLATFORM}-builder as stage +WORKDIR /work +COPY . . +RUN make diff --git a/ci/Dockerfile.rpm b/ci/Dockerfile.rpm index 9969be05e..0965148bc 100644 --- a/ci/Dockerfile.rpm +++ b/ci/Dockerfile.rpm @@ -1,5 +1,5 @@ ARG PLATFORM -FROM registry.sean.farm/${PLATFORM}-builder as stage +FROM 084037375216.dkr.ecr.us-east-2.amazonaws.com/${PLATFORM}-builder as stage WORKDIR /root/rpmbuild/BUILD COPY . . RUN make redhat diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh index e6aee6bc6..bc28e42f2 100755 --- a/ci/scripts/build.sh +++ b/ci/scripts/build.sh @@ -8,6 +8,9 @@ export VERSION=$3 export EVENT=$4 case $PLATFORM in + sid) + export PKGFMT=none + ;; el*|fc*|amzn*) export PKGFMT=rpm ;; @@ -15,22 +18,21 @@ case $PLATFORM in export PKGFMT=deb esac -# OSX -# x86_64-apple-darwin -# aarch64-apple-darwin +# +# Allow user to drop in custom Dockerfile for PLATFORM +# -# Windows -# x86_64-pc-windows-msvc -# i686-pc-windows-msvc -# aarch64-pc-windows-msvc +if [ -f "ci/Dockerfile.${PLATFORM}" ]; then + export DOCKERFILE="ci/Dockerfile.${PLATFORM}" +else + export DOCKERFILE="ci/Dockerfile.${PKGFMT}" +fi -# Linux -# i686-unknown-linux-gnu -# x86_64-unknown-linux-gnu -# arm-unknown-linux-gnueabi ? -# arm-unknown-linux-gnueabihf ? -# armv7-unknown-linux-gnueabihf -# +# +# Rust sometimes gets confused about where it's running. +# Normally, the build images will have Rust pre-baked. +# Pass RUST_TRIPLET for convenience when using a custom Dockerfile +# case $ZT_ISA in 386) @@ -41,13 +43,9 @@ case $ZT_ISA in export DOCKER_ARCH=amd64 export RUST_TRIPLET=x86_64-unknown-linux-gnu ;; - armv6) - export DOCKER_ARCH=arm/v6 - export RUST_TRIPLET=arm-unknown-linux-gnueabi - ;; - armv7) + armv7) export DOCKER_ARCH=arm/v7 - export RUST_TRIPLET=arm-unknown-linux-gnueabihf + export RUST_TRIPLET=armv7-unknown-linux-gnueabihf ;; arm64) export DOCKER_ARCH=arm64/v8 @@ -60,7 +58,7 @@ case $ZT_ISA in ppc64le) export DOCKER_ARCH=ppc64le export RUST_TRIPLET=powerpc64le-unknown-linux-gnu - ;; + ;; mips64le) export DOCKER_ARCH=mips64le export RUST_TRIPLET=mips64el-unknown-linux-gnuabi64 @@ -69,17 +67,15 @@ case $ZT_ISA in export DOCKER_ARCH=s390x export RUST_TRIPLET=s390x-unknown-linux-gnu ;; - *) + *) echo "ERROR: could not determine architecture settings. PLEASE FIX ME" exit 1 ;; esac -if [ -f "ci/Dockerfile.${PLATFORM}" ]; then - export DOCKERFILE="ci/Dockerfile.${PLATFORM}" -else - export DOCKERFILE="ci/Dockerfile.${PKGFMT}" -fi +# +# Print debug info +# echo "#~~~~~~~~~~~~~~~~~~~~" echo "$0 variables:" @@ -94,23 +90,37 @@ echo "PWD: ${PWD}" echo "DOCKERFILE: ${DOCKERFILE}" echo "#~~~~~~~~~~~~~~~~~~~~" -if [ ${EVENT} == "push" ]; then -make munge_rpm zerotier-one.spec VERSION=${VERSION} -make munge_deb debian/changelog VERSION=${VERSION} +# +# Munge RPM and Deb +# + +if [ ${PKGFMT} != "none" ] && [ ${EVENT} != "tag" ]; then + make munge_rpm zerotier-one.spec VERSION=${VERSION} + make munge_deb debian/changelog VERSION=${VERSION} fi -export DOCKER_BUILDKIT=1 -docker run --privileged --rm tonistiigi/binfmt --install all +# +# Assemble buildx arguments +# -# docker pull --platform linux/${DOCKER_ARCH} registry.sean.farm/${PLATFORM}-builder +build_args=( + --no-cache + --build-arg PLATFORM=${PLATFORM} + --build-arg RUST_TRIPLET=${RUST_TRIPLET} + --build-arg DOCKER_ARCH=${DOCKER_ARCH} + --platform linux/${DOCKER_ARCH} + -f ${DOCKERFILE} + -t build + . +) -docker buildx build \ - --build-arg PLATFORM="${PLATFORM}" \ - --build-arg RUST_TRIPLET="${RUST_TRIPLET}" \ - --build-arg DOCKER_ARCH="${DOCKER_ARCH}" \ - --platform linux/${DOCKER_ARCH} \ - -f ${DOCKERFILE} \ - -t build \ - . \ - --output type=local,dest=. \ - --target export +if [ ${PKGFMT} != "none" ]; then + build_args+=("--output type=local,dest=.") + build_args+=("--target export") +fi + +# +# Do build +# + +docker buildx build ${build_args[@]} From 9ac2cfe611a61cfd16463928159cee2de5b07b18 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Wed, 30 Nov 2022 12:44:32 -0500 Subject: [PATCH 23/31] Fix warning: suggest braces around initialization of subobject --- java/jni/com_zerotierone_sdk_Node.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/java/jni/com_zerotierone_sdk_Node.cpp b/java/jni/com_zerotierone_sdk_Node.cpp index 50dfd22e6..75af18bc8 100644 --- a/java/jni/com_zerotierone_sdk_Node.cpp +++ b/java/jni/com_zerotierone_sdk_Node.cpp @@ -573,7 +573,26 @@ namespace { return true; } - struct sockaddr_storage nullAddress = {0}; + // + // was: + // struct sockaddr_storage nullAddress = {0}; + // + // but was getting this warning: + // warning: suggest braces around initialization of subobject + // + // when building ZeroTierOne + // + struct sockaddr_storage nullAddress; + + // + // It is possible to assume knowledge about internals of sockaddr_storage and construct + // correct 0-initializer, but it is simpler to just treat sockaddr_storage as opaque and + // use memset here to fill with 0 + // + // This is also done in InetAddress.hpp for InetAddress + // + memset(&nullAddress, 0, sizeof(sockaddr_storage)); + jobject remoteAddressObj = NULL; if(memcmp(remoteAddress, &nullAddress, sizeof(sockaddr_storage)) != 0) From 4d50ed0b9d099a9588430693caeffb05e68f49a7 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Wed, 30 Nov 2022 12:45:16 -0500 Subject: [PATCH 24/31] Fix several warning: format specifies type 'XXX' but the argument has type 'YYY' Use %z for printing size_t and PRId64 etc. macros for printing platform-specific widths, and remove now-redundant casts --- node/Bond.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/node/Bond.cpp b/node/Bond.cpp index 14bf95ad8..dc17e6bee 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -18,6 +18,7 @@ #include #include #include +#include // for PRId64, etc. macros namespace ZeroTier { @@ -546,7 +547,7 @@ int32_t Bond::generateQoSPacket(int pathIdx, int64_t now, char* qosBuffer) std::map::iterator it = _paths[pathIdx].qosStatsIn.begin(); int i = 0; int numRecords = std::min(_paths[pathIdx].packetsReceivedSinceLastQoS, ZT_QOS_TABLE_SIZE); - // debug("numRecords=%3d, packetsReceivedSinceLastQoS=%3d, _paths[pathIdx].qosStatsIn.size()=%3lu", numRecords, _paths[pathIdx].packetsReceivedSinceLastQoS, _paths[pathIdx].qosStatsIn.size()); + // debug("numRecords=%3d, packetsReceivedSinceLastQoS=%3d, _paths[pathIdx].qosStatsIn.size()=%3zu", numRecords, _paths[pathIdx].packetsReceivedSinceLastQoS, _paths[pathIdx].qosStatsIn.size()); while (i < numRecords && it != _paths[pathIdx].qosStatsIn.end()) { uint64_t id = it->first; memcpy(qosBuffer, &id, sizeof(uint64_t)); @@ -582,7 +583,7 @@ bool Bond::assignFlowToBondedPath(SharedPtr& flow, int64_t now, bool reass int nextBestQualIdx = ZT_MAX_PEER_NETWORK_PATHS; if (reassign) { - log("attempting to re-assign out-flow %04x previously on idx %d (%u / %lu flows)", flow->id, flow->assignedPath, _paths[_realIdxMap[flow->assignedPath]].assignedFlowCount, _flows.size()); + log("attempting to re-assign out-flow %04x previously on idx %d (%u / %zu flows)", flow->id, flow->assignedPath, _paths[_realIdxMap[flow->assignedPath]].assignedFlowCount, _flows.size()); } else { debug("attempting to assign flow for the first time"); @@ -607,7 +608,7 @@ bool Bond::assignFlowToBondedPath(SharedPtr& flow, int64_t now, bool reass continue; } if (! _paths[_realIdxMap[bondedIdx]].shouldAvoid && randomLinkCapacity <= _paths[_realIdxMap[bondedIdx]].relativeLinkCapacity) { - // debug(" assign out-flow %04x to link %s (%u / %lu flows)", flow->id, pathToStr(_paths[_realIdxMap[bondedIdx]].p).c_str(), _paths[_realIdxMap[bondedIdx]].assignedFlowCount, _flows.size()); + // debug(" assign out-flow %04x to link %s (%u / %zu flows)", flow->id, pathToStr(_paths[_realIdxMap[bondedIdx]].p).c_str(), _paths[_realIdxMap[bondedIdx]].assignedFlowCount, _flows.size()); break; // Acceptable -- No violation of quality spec } if (_paths[_realIdxMap[bondedIdx]].relativeQuality > bestQuality) { @@ -636,7 +637,7 @@ bool Bond::assignFlowToBondedPath(SharedPtr& flow, int64_t now, bool reass } flow->assignPath(_abPathIdx, now); } - log("assign out-flow %04x to link %s (%u / %lu flows)", flow->id, pathToStr(_paths[flow->assignedPath].p).c_str(), _paths[flow->assignedPath].assignedFlowCount, _flows.size()); + log("assign out-flow %04x to link %s (%u / %zu flows)", flow->id, pathToStr(_paths[flow->assignedPath].p).c_str(), _paths[flow->assignedPath].assignedFlowCount, _flows.size()); return true; } @@ -660,7 +661,7 @@ SharedPtr Bond::createFlow(int pathIdx, int32_t flowId, unsigned cha if (pathIdx != ZT_MAX_PEER_NETWORK_PATHS) { flow->assignPath(pathIdx, now); _paths[pathIdx].assignedFlowCount++; - debug("assign in-flow %04x to link %s (%u / %lu)", flow->id, pathToStr(_paths[pathIdx].p).c_str(), _paths[pathIdx].assignedFlowCount, _flows.size()); + debug("assign in-flow %04x to link %s (%u / %zu)", flow->id, pathToStr(_paths[pathIdx].p).c_str(), _paths[pathIdx].assignedFlowCount, _flows.size()); } /** * Add a flow when no path was provided. This means that it is an outgoing packet @@ -680,7 +681,7 @@ void Bond::forgetFlowsWhenNecessary(uint64_t age, bool oldest, int64_t now) if (age) { // Remove by specific age while (it != _flows.end()) { if (it->second->age(now) > age) { - debug("forget flow %04x (age %llu) (%u / %lu)", it->first, (unsigned long long)it->second->age(now), _paths[it->second->assignedPath].assignedFlowCount, (_flows.size() - 1)); + debug("forget flow %04x (age %" PRId64 ") (%u / %zu)", it->first, it->second->age(now), _paths[it->second->assignedPath].assignedFlowCount, (_flows.size() - 1)); _paths[it->second->assignedPath].assignedFlowCount--; it = _flows.erase(it); } @@ -699,7 +700,7 @@ void Bond::forgetFlowsWhenNecessary(uint64_t age, bool oldest, int64_t now) ++it; } if (oldestFlow != _flows.end()) { - debug("forget oldest flow %04x (age %llu) (total flows: %lu)", oldestFlow->first, (unsigned long long)oldestFlow->second->age(now), (unsigned long)(_flows.size() - 1)); + debug("forget oldest flow %04x (age %" PRId64 ") (total flows: %zu)", oldestFlow->first, oldestFlow->second->age(now), _flows.size() - 1); _paths[oldestFlow->second->assignedPath].assignedFlowCount--; _flows.erase(oldestFlow); } @@ -824,7 +825,7 @@ void Bond::sendACK(void* tPtr, int pathIdx, int64_t localSocket, const InetAddre bytesToAck += it->second; ++it; } - debug("sending ACK of %d bytes on path %s (table size = %d)", bytesToAck, pathToStr(_paths[pathIdx].p).c_str(), _paths[pathIdx].ackStatsIn.size()); + debug("sending ACK of %d bytes on path %s (table size = %zu)", bytesToAck, pathToStr(_paths[pathIdx].p).c_str(), _paths[pathIdx].ackStatsIn.size()); outp.append(bytesToAck); if (atAddress) { outp.armor(_peer->key(), false, _peer->aesKeysIfSupported()); @@ -1919,7 +1920,7 @@ std::string Bond::pathToStr(const SharedPtr& path) SharedPtr link = getLink(path); if (link) { std::string ifnameStr = std::string(link->ifname()); - snprintf(fullPathStr, 384, "%.16llx-%s/%s", (unsigned long long)(path->localSocket()), ifnameStr.c_str(), pathStr); + snprintf(fullPathStr, 384, "%.16" PRIx64 "-%s/%s", path->localSocket(), ifnameStr.c_str(), pathStr); return std::string(fullPathStr); } } @@ -1935,11 +1936,11 @@ void Bond::dumpPathStatus(int64_t now, int pathIdx) std::string aliveOrDead = _paths[pathIdx].alive ? std::string("alive") : std::string("dead"); std::string eligibleOrNot = _paths[pathIdx].eligible ? std::string("eligible") : std::string("ineligible"); std::string bondedOrNot = _paths[pathIdx].bonded ? std::string("bonded") : std::string("unbonded"); - log("path[%2u] --- %5s (in %7lld, out: %7lld), %10s, %8s, flows=%-6u lat=%-8.3f pdv=%-7.3f err=%-6.4f loss=%-6.4f qual=%-6.4f --- (%s) spare=%d", + log("path[%2u] --- %5s (in %7" PRId64 ", out: %7" PRId64 "), %10s, %8s, flows=%-6u lat=%-8.3f pdv=%-7.3f err=%-6.4f loss=%-6.4f qual=%-6.4f --- (%s) spare=%d", pathIdx, aliveOrDead.c_str(), - static_cast(_paths[pathIdx].p->age(now)), - static_cast(_paths[pathIdx].p->_lastOut == 0 ? 0 : now - _paths[pathIdx].p->_lastOut), + _paths[pathIdx].p->age(now), + _paths[pathIdx].p->_lastOut == 0 ? static_cast(0) : now - _paths[pathIdx].p->_lastOut, eligibleOrNot.c_str(), bondedOrNot.c_str(), _paths[pathIdx].assignedFlowCount, @@ -1963,13 +1964,13 @@ void Bond::dumpInfo(int64_t now, bool force) _lastSummaryDump = now; float overhead = (_overheadBytes / (timeSinceLastDump / 1000.0f) / 1000.0f); _overheadBytes = 0; - log("bond: bp=%d, fi=%d, mi=%d, ud=%d, dd=%d, flows=%lu, leaf=%d, overhead=%f KB/s, links=(%d/%d)", + log("bond: bp=%d, fi=%" PRIu64 ", mi=%d, ud=%d, dd=%d, flows=%zu, leaf=%d, overhead=%f KB/s, links=(%d/%d)", _policy, _failoverInterval, _monitorInterval, _upDelay, _downDelay, - (unsigned long)_flows.size(), + _flows.size(), _isLeaf, overhead, _numAliveLinks, From ebc1ed40158eadf8f9da6a28e337a9ba6058f8cd Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 1 Dec 2022 11:07:20 -0500 Subject: [PATCH 25/31] Hide warning about readdir_r for now. --- osdep/OSUtils.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osdep/OSUtils.cpp b/osdep/OSUtils.cpp index ab3f1078b..36814523a 100644 --- a/osdep/OSUtils.cpp +++ b/osdep/OSUtils.cpp @@ -43,6 +43,10 @@ #include "OSUtils.hpp" +#ifdef __GCC__ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + namespace ZeroTier { unsigned int OSUtils::ztsnprintf(char *buf,unsigned int len,const char *fmt,...) From 85c032231382cc86cec7443f79c59042d9271e74 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Thu, 1 Dec 2022 15:12:54 -0800 Subject: [PATCH 26/31] Fix TCP relay setting --- service/OneService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/OneService.cpp b/service/OneService.cpp index daba4d99b..4cebe9fd2 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -2112,7 +2112,7 @@ public: // bondingPolicy cannot be used with allowTcpFallbackRelay _allowTcpFallbackRelay = OSUtils::jsonBool(settings["allowTcpFallbackRelay"],true); #ifdef ZT_TCP_FALLBACK_RELAY - _fallbackRelayAddress = InetAddress(OSUtils::jsonString("tcpFallbackRelay", ZT_TCP_FALLBACK_RELAY).c_str()); + _fallbackRelayAddress = InetAddress(OSUtils::jsonString(settings["tcpFallbackRelay"], ZT_TCP_FALLBACK_RELAY).c_str()); #endif _primaryPort = (unsigned int)OSUtils::jsonInt(settings["primaryPort"],(uint64_t)_primaryPort) & 0xffff; _allowSecondaryPort = OSUtils::jsonBool(settings["allowSecondaryPort"],true); From cdf248b1e2333f914fcecb8dabc651914f2a65d7 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Mon, 5 Dec 2022 09:56:13 -0500 Subject: [PATCH 27/31] Fix build problem related to unified headers Since NDKr15 (released 2017), unified headers are used by default [1] Remove -isystem option that was passing bad values to command-line. The actual value being passed to command-line was: ``` -isystem DK/sysroot/usr/include/RIPLE ``` because of using $NDK and $TRIPLE instead of $(NDK) and $(TRIPLE) But regardless, $NDK and $TRIPLE were never actually defined values and were just place-holders mentioned in [1] [1] https://android.googlesource.com/platform/ndk/+/ndk-release-r16/docs/UnifiedHeaders.md --- java/jni/Android.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/jni/Android.mk b/java/jni/Android.mk index 952bc4328..9f3434b7d 100644 --- a/java/jni/Android.mk +++ b/java/jni/Android.mk @@ -11,15 +11,13 @@ LOCAL_C_INCLUDES := \ LOCAL_LDLIBS := -llog # LOCAL_CFLAGS := -g -APP_UNIFIED_HEADERS := true - LOCAL_CFLAGS := -DZT_USE_MINIUPNPC ifeq ($(TARGET_ARCH_ABI),x86_64) LOCAL_CXXFLAGS := -maes -mpclmul -msse3 -msse4.1 endif ifeq ($(TARGET_ARCH_ABI),arm64-v8a) LOCAL_ARM_NEON := true - LOCAL_CXXFLAGS := -march=armv8-a+crypto -mfloat-abi=softfp -mfpu=neon -maes -isystem $NDK/sysroot/usr/include/$TRIPLE + LOCAL_CXXFLAGS := -march=armv8-a+crypto -mfloat-abi=softfp -mfpu=neon -maes endif # ZeroTierOne SDK source files From 475281935ec1026ac7a5d4349071e1bbe1e30fd5 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Mon, 5 Dec 2022 10:08:01 -0500 Subject: [PATCH 28/31] Remove unused flags for arm64-v8a Through using ndk-build, -Wno-unused-command-line-argument is passed in somewhere in the pipeline and hides this warning. The warning can be turned on with: APP_CPPFLAGS := -Wunused-command-line-argument ... and then when building, you can see: C/C++: clang++: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] C/C++: clang++: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] C/C++: clang++: warning: argument unused during compilation: '-maes' [-Wunused-command-line-argument] These are unused because both floating-point and NEON are required in all standard ARMv8 implementations. [1] [2] [1] https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON [2] https://stackoverflow.com/a/29891469 --- java/jni/Android.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/java/jni/Android.mk b/java/jni/Android.mk index 9f3434b7d..c2e51e2f0 100644 --- a/java/jni/Android.mk +++ b/java/jni/Android.mk @@ -16,8 +16,7 @@ ifeq ($(TARGET_ARCH_ABI),x86_64) LOCAL_CXXFLAGS := -maes -mpclmul -msse3 -msse4.1 endif ifeq ($(TARGET_ARCH_ABI),arm64-v8a) - LOCAL_ARM_NEON := true - LOCAL_CXXFLAGS := -march=armv8-a+crypto -mfloat-abi=softfp -mfpu=neon -maes + LOCAL_CXXFLAGS := -march=armv8-a+crypto endif # ZeroTierOne SDK source files From 77c7f9133f1530580978e676bf56b18126a5ccc6 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Mon, 5 Dec 2022 10:08:26 -0500 Subject: [PATCH 29/31] Migrate from ndk-build to CMake --- java/jni/Android.mk | 63 ----------------------------------------- java/jni/Application.mk | 5 ---- 2 files changed, 68 deletions(-) delete mode 100644 java/jni/Android.mk delete mode 100644 java/jni/Application.mk diff --git a/java/jni/Android.mk b/java/jni/Android.mk deleted file mode 100644 index c2e51e2f0..000000000 --- a/java/jni/Android.mk +++ /dev/null @@ -1,63 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := ZeroTierOneJNI -LOCAL_C_INCLUDES := \ - $(ZT1)/include \ - $(ZT1)/node \ - $(ZT1)/osdep - -LOCAL_LDLIBS := -llog -# LOCAL_CFLAGS := -g - -LOCAL_CFLAGS := -DZT_USE_MINIUPNPC -ifeq ($(TARGET_ARCH_ABI),x86_64) - LOCAL_CXXFLAGS := -maes -mpclmul -msse3 -msse4.1 -endif -ifeq ($(TARGET_ARCH_ABI),arm64-v8a) - LOCAL_CXXFLAGS := -march=armv8-a+crypto -endif - -# ZeroTierOne SDK source files -LOCAL_SRC_FILES := \ - $(ZT1)/node/AES.cpp \ - $(ZT1)/node/AES_aesni.cpp \ - $(ZT1)/node/AES_armcrypto.cpp \ - $(ZT1)/node/Bond.cpp \ - $(ZT1)/node/C25519.cpp \ - $(ZT1)/node/Capability.cpp \ - $(ZT1)/node/CertificateOfMembership.cpp \ - $(ZT1)/node/CertificateOfOwnership.cpp \ - $(ZT1)/node/Identity.cpp \ - $(ZT1)/node/IncomingPacket.cpp \ - $(ZT1)/node/InetAddress.cpp \ - $(ZT1)/node/Membership.cpp \ - $(ZT1)/node/Multicaster.cpp \ - $(ZT1)/node/Network.cpp \ - $(ZT1)/node/NetworkConfig.cpp \ - $(ZT1)/node/Node.cpp \ - $(ZT1)/node/OutboundMulticast.cpp \ - $(ZT1)/node/Packet.cpp \ - $(ZT1)/node/Path.cpp \ - $(ZT1)/node/Peer.cpp \ - $(ZT1)/node/Poly1305.cpp \ - $(ZT1)/node/Revocation.cpp \ - $(ZT1)/node/Salsa20.cpp \ - $(ZT1)/node/SelfAwareness.cpp \ - $(ZT1)/node/SHA512.cpp \ - $(ZT1)/node/Switch.cpp \ - $(ZT1)/node/Tag.cpp \ - $(ZT1)/node/Topology.cpp \ - $(ZT1)/node/Trace.cpp \ - $(ZT1)/node/Utils.cpp \ - $(ZT1)/osdep/OSUtils.cpp - -# JNI Files -LOCAL_SRC_FILES += \ - com_zerotierone_sdk_Node.cpp \ - ZT_jniarray.cpp \ - ZT_jniutils.cpp \ - ZT_jnilookup.cpp - -include $(BUILD_SHARED_LIBRARY) \ No newline at end of file diff --git a/java/jni/Application.mk b/java/jni/Application.mk deleted file mode 100644 index 7980d8c27..000000000 --- a/java/jni/Application.mk +++ /dev/null @@ -1,5 +0,0 @@ -# NDK_TOOLCHAIN_VERSION := clang3.5 -APP_STL := c++_static -APP_CPPFLAGS := -Wall -fstack-protector -fexceptions -fno-strict-aliasing -frtti -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1 -DZT_SSO_SUPPORTED=0 -DOMIT_JSON_SUPPORT=1 -APP_PLATFORM := android-21 -APP_ABI := all From 5b5f9a069aec62e26d06afbc0c41d50c42b99716 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Thu, 1 Dec 2022 09:24:33 -0500 Subject: [PATCH 30/31] fix typos --- RELEASE-NOTES.md | 2 +- include/ZeroTierOne.h | 4 ++-- java/README.md | 2 +- node/Path.hpp | 2 +- selftest.cpp | 2 +- service/OneService.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index f57e9820e..a925a3a04 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -32,7 +32,7 @@ Note that releases are coming few and far between because most of our dev effort # 2022-04-25 -- Version 1.8.9 - * Fixed a long-standing and strange bug that was causing sporadic "phantom" packet authentication failures. Not a security problem but could be behind spordaic reports of link failures under some conditions. + * Fixed a long-standing and strange bug that was causing sporadic "phantom" packet authentication failures. Not a security problem but could be behind sporadic reports of link failures under some conditions. * Fized a memory leak in SSO/OIDC support. * Fixed SSO/OIDC display error on CLI. * Fixed a bug causing nodes to sometimes fail to push certs to each other (primarily affects SSO/OIDC use cases). diff --git a/include/ZeroTierOne.h b/include/ZeroTierOne.h index b8b23825f..23f97b388 100644 --- a/include/ZeroTierOne.h +++ b/include/ZeroTierOne.h @@ -1208,7 +1208,7 @@ typedef struct bool ssoEnabled; /** - * SSO verison + * SSO version */ uint64_t ssoVersion; @@ -2066,7 +2066,7 @@ ZT_SDK_API int ZT_Node_sendUserMessage(ZT_Node *node,void *tptr,uint64_t dest,ui * NetworkConfigMaster base class in node/. No type checking is performed, * so a pointer to anything else will result in a crash. * - * @param node ZertTier One node + * @param node ZeroTier One node * @param networkConfigMasterInstance Instance of NetworkConfigMaster C++ class or NULL to disable * @return OK (0) or error code if a fatal error condition has occurred */ diff --git a/java/README.md b/java/README.md index 2650ec3df..979101c5e 100644 --- a/java/README.md +++ b/java/README.md @@ -5,7 +5,7 @@ ZeroTier One SDK - Android JNI Wrapper Building ----- -Reqires: +Requires: * JDK * ANT diff --git a/node/Path.hpp b/node/Path.hpp index 11a3e5113..8304f27d8 100644 --- a/node/Path.hpp +++ b/node/Path.hpp @@ -194,7 +194,7 @@ public: */ inline unsigned int preferenceRank() const { - // This causes us to rank paths in order of IP scope rank (see InetAdddress.hpp) but + // This causes us to rank paths in order of IP scope rank (see InetAddress.hpp) but // within each IP scope class to prefer IPv6 over IPv4. return ( ((unsigned int)_ipScope << 1) | (unsigned int)(_addr.ss_family == AF_INET6) ); } diff --git a/selftest.cpp b/selftest.cpp index f43cee1af..cc161777b 100644 --- a/selftest.cpp +++ b/selftest.cpp @@ -667,7 +667,7 @@ static int testPacket() std::cout << "(compressed: " << complen << ", decompressed: " << a.size() << ") "; if (a != b) { - std::cout << "FAIL (compresssion)" << std::endl; + std::cout << "FAIL (compression)" << std::endl; return -1; } diff --git a/service/OneService.cpp b/service/OneService.cpp index 4cebe9fd2..5984b8b86 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1401,7 +1401,7 @@ public: /* Note: this is kind of restricted in what it'll take. It does not support * URL encoding, and /'s in URL args will screw it up. But the only URL args - * it really uses in ?jsonp=funcionName, and otherwise it just takes simple + * it really uses in ?jsonp=functionName, and otherwise it just takes simple * paths to simply-named resources. */ if (!ps.empty()) { std::size_t qpos = ps[ps.size() - 1].find('?'); From 2f5dc10399e5c808100081fed2ffdf19726eaa10 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Mon, 5 Dec 2022 15:33:00 -0600 Subject: [PATCH 31/31] Fix syntax error (#1806) Similar previous fix: https://github.com/zerotier/ZeroTierOne/commit/668ab8b85c169648141d961566f183cf71ae6fa6 --- make-bsd.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-bsd.mk b/make-bsd.mk index 889e0e093..8234f2fdb 100644 --- a/make-bsd.mk +++ b/make-bsd.mk @@ -133,7 +133,7 @@ endif # Fail if system architecture could not be determined ifeq ($(ZT_ARCHITECTURE),999) -ERR=$(error FATAL: architecture could not be determined from $(CC) -dumpmachine: $CC_MACH) +ERR=$(error FATAL: architecture could not be determined from $(CC) -dumpmachine: $(CC_MACH)) .PHONY: err err: ; $(ERR) endif