From 2ccc153ecc3fb89ba8a78b8a4c4e08aaf28e1575 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 16 Mar 2022 11:32:07 +0100 Subject: Also set fake mac address with OpenVPN 2.x The OpenVPN 2.x part of actually sending IV_HWADDR from env is still mising. --- .../de/blinkt/openvpn/core/OpenVPNThreadv3.java | 24 +--------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'main/src/ui') diff --git a/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java b/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java index 927cb14d..780fa217 100644 --- a/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java +++ b/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java @@ -189,7 +189,7 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable config.setExternalPkiAlias("extpki"); config.setCompressionMode("asym"); - config.setHwAddrOverride(getFakeMacAddrFromSAAID(mService)); + config.setHwAddrOverride(NetworkUtils.getFakeMacAddrFromSAAID(mService)); config.setInfo(true); config.setAllowLocalLanAccess(mVp.mAllowLocalLAN); boolean retryOnAuthFailed = mVp.mAuthRetry == AUTH_RETRY_NOINTERACT; @@ -213,28 +213,6 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable } } - @SuppressLint("HardwareIds") - private String getFakeMacAddrFromSAAID(Context c) { - char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); - - String saaid = Settings.Secure.getString(c.getContentResolver(), - Settings.Secure.ANDROID_ID); - - StringBuilder ret = new StringBuilder(); - if (saaid.length() >= 6) { - byte[] sb = saaid.getBytes(); - for (int b = 0; b <= 6; b++) { - if (b != 0) - ret.append(":"); - int v = sb[b] & 0xFF; - ret.append(HEX_ARRAY[v >>> 4]); - ret.append(HEX_ARRAY[v & 0x0F]); - } - } - return ret.toString(); - } - - @Override public void external_pki_cert_request(ClientAPI_ExternalPKICertRequest certreq) { VpnStatus.logDebug("Got external PKI certificate request from OpenVPN core"); -- cgit v1.2.3