[tor-commits] [orbot/master] ensure all iptables rules are always wiped
n8fr8 at torproject.org
n8fr8 at torproject.org
Sun Sep 7 13:42:55 UTC 2014
commit b35a239e44cd2f2b5e518cec79ba243edfd8787d
Author: Nathan Freitas <nathan at freitas.net>
Date: Sun Sep 7 09:34:48 2014 -0400
ensure all iptables rules are always wiped
and reapply rules settings if modifed after settings menu accessed
---
src/org/torproject/android/Orbot.java | 8 +++-
src/org/torproject/android/service/TorService.java | 42 +++++++++++++++-----
2 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index d5cd9da..8992826 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -815,8 +815,14 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
e.printStackTrace();
}
}
- else
+ else if (torStatus == TorServiceConstants.STATUS_ON)
{
+ try {
+ mService.processSettings();
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
Toast.makeText(this, R.string.you_may_need_to_stop_and_start_orbot_for_settings_change_to_be_enabled_, Toast.LENGTH_SHORT).show();
}
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index b9f3791..ec56ceb 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -897,15 +897,11 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (mTransProxy == null)
mTransProxy = new TorTransProxy(this, fileXtables);
-
- if (mTransProxyAll)
- mTransProxy.setTransparentProxyingAll(this, false);
- else
- {
- ArrayList<TorifiedApp> apps = AppManager.getApps(this, TorServiceUtils.getSharedPrefs(getApplicationContext()));
- mTransProxy.setTransparentProxyingByApp(this, apps, false);
- }
-
+
+ mTransProxy.setTransparentProxyingAll(this, false);
+ ArrayList<TorifiedApp> apps = AppManager.getApps(this, TorServiceUtils.getSharedPrefs(getApplicationContext()));
+ mTransProxy.setTransparentProxyingByApp(this, apps, false);
+
return true;
}
@@ -1730,7 +1726,31 @@ public class TorService extends Service implements TorServiceConstants, TorConst
public void processSettings ()
{
- /*
+
+ try {
+
+ boolean hadEnableTransparentProxy = mEnableTransparentProxy;
+
+ updateSettings ();
+
+ if (mHasRoot)
+ {
+ if (hadEnableTransparentProxy)
+ disableTransparentProxy();
+
+ if (mEnableTransparentProxy)
+ {
+ disableTransparentProxy();
+ enableTransparentProxy();
+ }
+ }
+
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
Thread thread = new Thread()
{
@@ -1750,7 +1770,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
};
thread.start();
- */
+
}
More information about the tor-commits
mailing list