diff options
author | Arne Schwabe <arne@rfc2549.org> | 2022-03-16 11:58:12 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2022-03-16 11:58:42 +0100 |
commit | 721b39034ca24fafa884516b6af265989511f224 (patch) | |
tree | efe23613a8ac9b966a428e8510c62fffa1e63655 /main/src | |
parent | d5d728338694cac72c145017de4f7b969d974e65 (diff) |
Fix unit tests calling into NetworkUtils.getFakeMacAddrFromSAAID
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/VpnProfile.java | 4 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java index 54d2eb02..edbc38ed 100644 --- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -388,7 +388,9 @@ public class VpnProfile implements Serializable, Cloneable { cfg.append("setenv IV_SSO openurl,webauth,crtext\n"); String versionString = getPlatformVersionEnvString(); cfg.append(String.format("setenv IV_PLAT_VER %s\n", openVpnEscape(versionString))); - cfg.append(String.format("setenv IV_HWADDR %s\n", NetworkUtils.getFakeMacAddrFromSAAID(context))); + String hwaddr = NetworkUtils.getFakeMacAddrFromSAAID(context); + if (hwaddr != null) + cfg.append(String.format("setenv IV_HWADDR %s\n", hwaddr)); if (mUseLegacyProvider) cfg.append("providers legacy default\n"); diff --git a/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java b/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java index 814aba92..8710ce7f 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java +++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java @@ -81,6 +81,9 @@ public class NetworkUtils { String saaid = Settings.Secure.getString(c.getContentResolver(), Settings.Secure.ANDROID_ID); + if (saaid == null) + return null; + StringBuilder ret = new StringBuilder(); if (saaid.length() >= 6) { byte[] sb = saaid.getBytes(); |