commit e13d228dfc98648aafddc0062e0555571a160e19 Author: Nathan Freitas nathan@freitas.net Date: Fri Jun 27 13:02:21 2014 -0400
fix bug with wrong apps being transproxied (typo!) --- src/org/torproject/android/service/TorTransProxy.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/org/torproject/android/service/TorTransProxy.java b/src/org/torproject/android/service/TorTransProxy.java index 400b1db..bf3efbd 100644 --- a/src/org/torproject/android/service/TorTransProxy.java +++ b/src/org/torproject/android/service/TorTransProxy.java @@ -343,8 +343,6 @@ public class TorTransProxy implements TorServiceConstants { //StringBuilder script = new StringBuilder(); String srcChainName = "OUTPUT"; - - int torUid = context.getApplicationInfo().uid;
//run the delete commands in a separate process as it might error out //String[] cmdExecClear = {script.toString()}; @@ -369,8 +367,8 @@ public class TorTransProxy implements TorServiceConstants { { - logMessage("enabling transproxy for app: " + tApp.getUsername() + "(" + tApp.getUid() + ")"); - + logMessage("enabling transproxy for app: " + tApp.getUsername() + " (" + tApp.getUid() + ")"); + dropAllIPv6Traffic(context, tApp.getUid()); script = new StringBuilder(); @@ -407,7 +405,7 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -t nat"); script.append(" -A ").append(srcChainName); script.append(" -p udp"); - script.append(" -m owner ! --uid-owner "); + script.append(" -m owner --uid-owner "); script.append(tApp.getUid()); script.append(" -m udp --dport "); script.append(STANDARD_DNS_PORT); @@ -441,9 +439,12 @@ public class TorTransProxy implements TorServiceConstants { { SimpleCommand cmd = new SimpleCommand(cmdString + "|| exit"); shell.add(cmd); - logMessage(cmdString);// + "; exit=" + cmd.getExitCode() + ";output=" + cmd.getOutput()); + int exitCode = cmd.getExitCode(); + String output = cmd.getOutput(); + + logMessage(cmdString + "; exit=" + exitCode + ";output=" + output); - return cmd.getExitCode(); + return exitCode; }