From f764e588bddb8710f81ae51f8e73bfdcfc8fa79b Mon Sep 17 00:00:00 2001 From: Dave Hart Date: Thu, 6 Apr 2023 11:00:10 -0400 Subject: [PATCH 1/3] Workaround for failed tunnel connection attempt after TestFlight update --- Common/TunnelMgr.swift | 52 ++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/Common/TunnelMgr.swift b/Common/TunnelMgr.swift index 46427afa..4ecb5764 100644 --- a/Common/TunnelMgr.swift +++ b/Common/TunnelMgr.swift @@ -159,6 +159,26 @@ class TunnelMgr: NSObject { } } + func prefReloadHack(_ tpm: NETunnelProviderManager) { + tpm.saveToPreferences { error in + if let error = error { + zLog.error(error.localizedDescription) + } else { + zLog.info("Saved successfully. Re-loading preferences") + // ios hack per apple forums (else NEVPNErrorDomain Code=1 on starting tunnel) + tpm.loadFromPreferences { [weak tpm] error in + zLog.error("Re-loaded preferences, error=\(error != nil). Attempting to start") + do { + zLog.info("Attempting to start tunnel after load from preferences") + try (tpm?.connection as? NETunnelProviderSession)?.startTunnel() + } catch { + zLog.error("Failed starting tunnel after re-enabling. \(error.localizedDescription)") + } + } + } + } + } + func startTunnel() throws { guard let tpm = self.tpm else { zLog.error("Unable to access TPM") @@ -172,26 +192,24 @@ class TunnelMgr: NSObject { } zLog.info("starting tunnel") try tps.startTunnel() - } else { - zLog.warn("startTunnel - tunnel not enabled. Re-enabling and starting tunnel") - tpm.isEnabled = true - tpm.saveToPreferences { error in - if let error = error { - zLog.error(error.localizedDescription) - } else { - zLog.info("Saved successfully. Re-loading preferences") - // ios hack per apple forums (else NEVPNErrorDomain Code=1 on starting tunnel) - tpm.loadFromPreferences { [weak tpm] error in - zLog.error("Re-loaded preferences, error=\(error != nil). Attempting to start") - do { - zLog.info("Attempting to start tunnel after load from preferences") - try (tpm?.connection as? NETunnelProviderSession)?.startTunnel() - } catch { - zLog.error("Failed starting tunnel after re-enabling. \(error.localizedDescription)") - } + zLog.info("start tunnel called with no error") + + if #available(iOS 16, *), #available(macOS 13, *) { + tps.fetchLastDisconnectError { err in + guard let err = err else { + zLog.info("No lastDisconnect error found") + return } + zLog.error("lastDisconnectError: \(err.localizedDescription)") + + zLog.info("Attempting reload prefs hack") + self.prefReloadHack(tpm) } } + } else { + zLog.warn("startTunnel - tunnel not enabled. Re-enabling and starting tunnel") + tpm.isEnabled = true + self.prefReloadHack(tpm) } } From 3b4faea4a3a5043c08611c480d17e53d6a0cb0bf Mon Sep 17 00:00:00 2001 From: Dave Hart Date: Thu, 6 Apr 2023 11:01:53 -0400 Subject: [PATCH 2/3] Start 2.30 release train --- MobilePacketTunnelProvider/Info.plist | 2 +- MobileShare/Info.plist | 2 +- PacketTunnelProvider/Info.plist | 2 +- ZitiMobilePacketTunnel/Info.plist | 2 +- ZitiPacketTunnel/Info.plist | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MobilePacketTunnelProvider/Info.plist b/MobilePacketTunnelProvider/Info.plist index 14ab43a5..185764a6 100644 --- a/MobilePacketTunnelProvider/Info.plist +++ b/MobilePacketTunnelProvider/Info.plist @@ -23,7 +23,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 2.29 + 2.30 CFBundleVersion 0 NSExtension diff --git a/MobileShare/Info.plist b/MobileShare/Info.plist index 3877bca9..f69a59fd 100644 --- a/MobileShare/Info.plist +++ b/MobileShare/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 2.29 + 2.30 CFBundleVersion 0 NSExtension diff --git a/PacketTunnelProvider/Info.plist b/PacketTunnelProvider/Info.plist index b975f068..987366ee 100644 --- a/PacketTunnelProvider/Info.plist +++ b/PacketTunnelProvider/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 2.29 + 2.30 CFBundleVersion 0 LSMinimumSystemVersion diff --git a/ZitiMobilePacketTunnel/Info.plist b/ZitiMobilePacketTunnel/Info.plist index cfab0eb0..5ebd4cb0 100644 --- a/ZitiMobilePacketTunnel/Info.plist +++ b/ZitiMobilePacketTunnel/Info.plist @@ -56,7 +56,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.29 + 2.30 CFBundleVersion 0 LSRequiresIPhoneOS diff --git a/ZitiPacketTunnel/Info.plist b/ZitiPacketTunnel/Info.plist index 03002ca4..a3bb8503 100644 --- a/ZitiPacketTunnel/Info.plist +++ b/ZitiPacketTunnel/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.29 + 2.30 CFBundleVersion 0 LSApplicationCategoryType From fedd7eb62e653e69d1de3de62515ed4788b0f5b4 Mon Sep 17 00:00:00 2001 From: Dave Hart Date: Thu, 6 Apr 2023 11:35:38 -0400 Subject: [PATCH 3/3] Retreive build number for new release train --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0912b011..df4b0ef6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -105,7 +105,7 @@ jobs: run: | mvers=$(agvtool mvers -terse1) app="${{ steps.get_app_info.outputs.apple_id }}" - url="https://api.appstoreconnect.apple.com/v1/builds?filter[app]=${app}&fields[builds]=version&filter[preReleaseVersion.version]=${mvers}&limit=1" + url="https://api.appstoreconnect.apple.com/v1/builds?filter[app]=${app}&fields[builds]=version&limit=1" acs_vers=$(curl -g -s -H "Authorization: Bearer ${bearer}" "${url}" | jq '.data[].attributes.version|tonumber') echo "ACS Vers: ${acs_vers}" curr=$([[ -z "${acs_vers}" ]] && echo ${steps.get_app_info.outputs.version_number} || echo ${acs_vers})