summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/build.gradle.kts10
-rw-r--r--main/src/main/cpp/CMakeLists.txt16
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java19
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java21
4 files changed, 11 insertions, 55 deletions
diff --git a/main/build.gradle.kts b/main/build.gradle.kts
index a8adcdee..59bc8215 100644
--- a/main/build.gradle.kts
+++ b/main/build.gradle.kts
@@ -13,13 +13,13 @@ plugins {
}
android {
- compileSdkVersion(31)
+ compileSdk = 31
- ndkVersion = "23.0.7599858"
+ //ndkVersion = "23.0.7599858"
defaultConfig {
- minSdkVersion(14)
- targetSdkVersion(31)
+ minSdk = 16
+ targetSdk = 31
versionCode = 178
versionName = "0.7.24"
@@ -143,6 +143,8 @@ fun registerGenTask(variantName: String, variantDirName: String): File {
"-Isrc/main/cpp/openvpn3/client", "-Isrc/main/cpp/openvpn3/",
"-o", "${genDir}/ovpncli_wrap.cxx", "-oh", "${genDir}/ovpncli_wrap.h",
"src/main/cpp/openvpn3/javacli/ovpncli.i"))
+ inputs.files( "src/main/cpp/openvpn3/javacli/ovpncli.i")
+ outputs.dir( genDir)
}
return baseDir
diff --git a/main/src/main/cpp/CMakeLists.txt b/main/src/main/cpp/CMakeLists.txt
index 7034c0c0..a4689802 100644
--- a/main/src/main/cpp/CMakeLists.txt
+++ b/main/src/main/cpp/CMakeLists.txt
@@ -104,7 +104,6 @@ target_compile_definitions(ovpnutil PRIVATE -DTARGET_ARCH_ABI=\"${ANDROID_ABI}\"
)
target_link_libraries(ovpnutil log)
-
if (NOT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} MATCHES "build/intermediates/cmake/.*skeleton.*/")
add_library(osslspeedtest SHARED ovpnutil/sslspeed.c)
target_link_libraries(osslspeedtest log crypto ssl)
@@ -243,23 +242,12 @@ add_executable(pie_openvpn.${ANDROID_ABI} minivpn/minivpn.c)
target_compile_options(pie_openvpn.${ANDROID_ABI} PRIVATE -fPIE)
target_link_libraries(pie_openvpn.${ANDROID_ABI} PRIVATE openvpn -fPIE -pie)
-add_executable(nopie_openvpn.${ANDROID_ABI} minivpn/minivpn.c)
-target_link_libraries(nopie_openvpn.${ANDROID_ABI} PRIVATE openvpn)
-
# Hack to copy OpenVPN binaries to assets directory
SET(OVPN_ASSET_DIR ${CMAKE_SOURCE_DIR}/../../../build/ovpnassets)
add_custom_target(makeassetdir ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${OVPN_ASSET_DIR})
-
-add_custom_command(TARGET nopie_openvpn.${ANDROID_ABI} POST_BUILD
- COMMAND
- ${CMAKE_COMMAND} -E copy
- $<TARGET_FILE:nopie_openvpn.${ANDROID_ABI}>
- ${OVPN_ASSET_DIR}
- )
-
add_custom_command(TARGET pie_openvpn.${ANDROID_ABI} POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy
@@ -268,6 +256,6 @@ add_custom_command(TARGET pie_openvpn.${ANDROID_ABI} POST_BUILD
)
# Hack that these targets are really executed
-add_dependencies(ovpnutil pie_openvpn.${ANDROID_ABI} nopie_openvpn.${ANDROID_ABI})
+add_dependencies(ovpnutil pie_openvpn.${ANDROID_ABI})
add_dependencies(pie_openvpn.${ANDROID_ABI} makeassetdir)
-add_dependencies(nopie_openvpn.${ANDROID_ABI} makeassetdir)
+
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
index c43b3ea6..bb3b804d 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
@@ -27,8 +27,6 @@ import de.blinkt.openvpn.R;
public class OpenVPNThread implements Runnable {
private static final String DUMP_PATH_STRING = "Dump path: ";
@SuppressLint("SdCardPath")
- private static final String BROKEN_PIE_SUPPORT = "/data/data/de.blinkt.openvpn/cache/pievpn";
- private final static String BROKEN_PIE_SUPPORT2 = "syntax error";
private static final String TAG = "OpenVPN";
// 1380308330.240114 18000002 Send to HTTP proxy: 'X-Online-Host: bla.blabla.com'
private static final Pattern LOG_PATTERN = Pattern.compile("(\\d+).(\\d+) ([0-9a-f])+ (.*)");
@@ -42,7 +40,6 @@ public class OpenVPNThread implements Runnable {
private String mTmpDir;
private OpenVPNService mService;
private String mDumpPath;
- private boolean mBrokenPie = false;
private boolean mNoProcessExitStatus = false;
public OpenVPNThread(OpenVPNService service, String[] argv, String nativelibdir, String tmpdir) {
@@ -82,19 +79,6 @@ public class OpenVPNThread implements Runnable {
}
if (exitvalue != 0) {
VpnStatus.logError("Process exited with exit value " + exitvalue);
- if (mBrokenPie) {
- /* This will probably fail since the NoPIE binary is probably not written */
- String[] noPieArgv = VPNLaunchHelper.replacePieWithNoPie(mArgv);
-
- // We are already noPIE, nothing to gain
- if (!noPieArgv.equals(mArgv)) {
- mArgv = noPieArgv;
- VpnStatus.logInfo("PIE Version could not be executed. Trying no PIE version");
- run();
- }
-
- }
-
}
if (!mNoProcessExitStatus)
@@ -150,9 +134,6 @@ public class OpenVPNThread implements Runnable {
if (logline.startsWith(DUMP_PATH_STRING))
mDumpPath = logline.substring(DUMP_PATH_STRING.length());
- if (logline.startsWith(BROKEN_PIE_SUPPORT) || logline.contains(BROKEN_PIE_SUPPORT2))
- mBrokenPie = true;
-
Matcher m = LOG_PATTERN.matcher(logline);
int logerror = 0;
if (m.matches()) {
diff --git a/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java b/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java
index 52ec55d7..7f9508b1 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java
@@ -21,11 +21,9 @@ import de.blinkt.openvpn.R;
import de.blinkt.openvpn.VpnProfile;
public class VPNLaunchHelper {
- private static final String MININONPIEVPN = "nopie_openvpn";
private static final String MINIPIEVPN = "pie_openvpn";
private static final String OVPNCONFIGFILE = "android.conf";
-
private static String writeMiniVPN(Context context) {
String nativeAPI = NativeUtils.getNativeAPI();
/* Q does not allow executing binaries written in temp directory anymore */
@@ -45,7 +43,7 @@ public class VPNLaunchHelper {
for (String abi : abis) {
- File vpnExecutable = new File(context.getCacheDir(), "c_" + getMiniVPNExecutableName() + "." + abi);
+ File vpnExecutable = new File(context.getCacheDir(), "c_" + MINIPIEVPN + "." + abi);
if ((vpnExecutable.exists() && vpnExecutable.canExecute()) || writeMiniVPNBinary(context, abi, vpnExecutable)) {
return vpnExecutable.getPath();
}
@@ -59,19 +57,6 @@ public class VPNLaunchHelper {
return Build.SUPPORTED_ABIS;
}
- private static String getMiniVPNExecutableName() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
- return MINIPIEVPN;
- else
- return MININONPIEVPN;
- }
-
-
- public static String[] replacePieWithNoPie(String[] mArgv) {
- mArgv[0] = mArgv[0].replace(MINIPIEVPN, MININONPIEVPN);
- return mArgv;
- }
-
static String[] buildOpenvpnArgv(Context c) {
Vector<String> args = new Vector<>();
@@ -93,9 +78,9 @@ public class VPNLaunchHelper {
InputStream mvpn;
try {
- mvpn = context.getAssets().open(getMiniVPNExecutableName() + "." + abi);
+ mvpn = context.getAssets().open(MINIPIEVPN + "." + abi);
} catch (IOException errabi) {
- VpnStatus.logInfo("Failed getting assets for archicture " + abi);
+ VpnStatus.logInfo("Failed getting assets for architecture " + abi);
return false;
}