diff --git a/src/org/torproject/android/service/TorTransProxy.java b/src/org/torproject/android/service/TorTransProxy.java index 8753097a..1a34c5c8 100644 --- a/src/org/torproject/android/service/TorTransProxy.java +++ b/src/org/torproject/android/service/TorTransProxy.java @@ -309,6 +309,16 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -j REJECT"); script.append(" || exit\n"); + // Reject all other outbound UDP packets + script.append(ipTablesPath); + script.append(" -A OUTPUT"); + script.append(" -t filter"); + script.append(" -m owner --uid-owner "); + script.append(tApp.getUid()); + script.append(" -p udp"); + script.append(" -j REJECT"); + script.append(" || exit\n"); + } } @@ -407,6 +417,16 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -j REJECT"); script.append(" || exit\n"); + // Reject all other outbound TCP packets + script.append(ipTablesPath); + script.append(" -D OUTPUT"); + script.append(" -t filter"); + script.append(" -m owner --uid-owner "); + script.append(tApp.getUid()); + script.append(" -p udp"); + script.append(" -j REJECT"); + script.append(" || exit\n"); + } } @@ -648,7 +668,15 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -p tcp"); script.append(" -j REJECT"); script.append(" || exit\n"); - + + // Reject all other outbound UDP packets + script.append(ipTablesPath); + script.append(" -t filter"); + script.append(" -A OUTPUT"); + script.append(" -p udp"); + script.append(" -j REJECT"); + script.append(" || exit\n"); + String[] cmdAdd = {script.toString()}; code = TorServiceUtils.doShellCommand(cmdAdd, res, runRoot, waitFor); @@ -717,6 +745,14 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -j REJECT"); script.append(" || exit\n"); + // Reject all other outbound TCP packets + script.append(ipTablesPath); + script.append(" -D OUTPUT"); + script.append(" -t filter"); + script.append(" -p udp"); + script.append(" -j REJECT"); + script.append(" || exit\n"); + String[] cmdAdd = {script.toString()}; code = TorServiceUtils.doShellCommand(cmdAdd, res, runRoot, waitFor);