commit 456f8962f157065fdd291280b5cf58715bf0808d Author: n8fr8 nathan@freitas.net Date: Mon Apr 23 22:43:33 2018 -0400
set pdnsd path dynamically, in case it is installed elsewhere --- .../torproject/android/service/vpn/OrbotVpnManager.java | 14 ++++++++------ orbotservice/src/main/res/values/pdnsd.xml | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java b/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java index e3927d5b..e19b8847 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java +++ b/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java @@ -307,6 +307,7 @@ public class OrbotVpnManager implements Handler.Callback { + String.valueOf(mTorSocks); final String localDNS = virtualGateway + ':' + "8091";//String.valueOf(TorServiceConstants.TOR_DNS_PORT_DEFAULT); + //final String localDNS = virtualGateway + ":" + DEFAULT_ACTUAL_DNS_PORT; final boolean localDnsTransparentProxy = true; builder.setMtu(VPN_MTU); @@ -400,14 +401,15 @@ public class OrbotVpnManager implements Handler.Callback {
}
+ private void startDNS (String dns, int port) throws IOException, TimeoutException { - makePdnsdConf(mService, dns, port,filePdnsd.getParentFile() ); + + makePdnsdConf(mService, dns, port,filePdnsd.getParentFile()); ArrayList<String> customEnv = new ArrayList<String>(); - String baseDirectory = filePdnsd.getParent();
- String[] cmdString = {filePdnsd.getCanonicalPath(),"-c",baseDirectory + "/pdnsd.conf"}; + String[] cmdString = {filePdnsd.getCanonicalPath(),"-c",filePdnsd.getParent() + "/pdnsd.conf"}; ProcessBuilder pb = new ProcessBuilder(cmdString); pb.redirectErrorStream(true); Process proc = pb.start(); @@ -429,8 +431,8 @@ public class OrbotVpnManager implements Handler.Callback {
}
- public static void makePdnsdConf(Context context, String dns, int port, File fileDir) throws FileNotFoundException { - String conf = String.format(context.getString(R.string.pdnsd_conf), dns, port); + public static void makePdnsdConf(Context context, String dns, int port, File fileDir) throws FileNotFoundException, IOException { + String conf = String.format(context.getString(R.string.pdnsd_conf), dns, port, fileDir.getCanonicalPath());
File f = new File(fileDir,"pdnsd.conf");
@@ -452,7 +454,7 @@ public class OrbotVpnManager implements Handler.Callback {
} } -} + }
} diff --git a/orbotservice/src/main/res/values/pdnsd.xml b/orbotservice/src/main/res/values/pdnsd.xml index a9ba34d7..4fd6d79e 100644 --- a/orbotservice/src/main/res/values/pdnsd.xml +++ b/orbotservice/src/main/res/values/pdnsd.xml @@ -3,7 +3,7 @@ <string name="pdnsd_conf" formatted="true"> global { perm_cache=0; - cache_dir="/data/data/org.torproject.android/app_bin"; + cache_dir="%3$s"; server_port = 8091; server_ip = 0.0.0.0; query_method=udp_only; @@ -11,7 +11,7 @@ global { max_ttl=1w; timeout=10; daemon=on; - pid_file="/data/data/org.torproject.android/app_bin/pdnsd.pid"; + pid_file="%3$s/pdnsd.pid";
}