Index: src/org/adblockplus/android/configurators/IptablesProxyConfigurator.java |
=================================================================== |
--- a/src/org/adblockplus/android/configurators/IptablesProxyConfigurator.java |
+++ b/src/org/adblockplus/android/configurators/IptablesProxyConfigurator.java |
@@ -58,14 +58,7 @@ |
throw new IllegalStateException("No root access"); |
} |
- final File ipt = this.context.getFileStreamPath("iptables"); |
- |
- if (!ipt.exists()) |
- { |
- throw new FileNotFoundException("No iptables executable"); |
- } |
- |
- final String path = ipt.getAbsolutePath(); |
+ final String path = getIptablesExecutablePath(); |
RootTools.sendShell("chmod 700 " + path, DEFAULT_TIMEOUT); |
@@ -103,6 +96,19 @@ |
} |
} |
+ private String getIptablesExecutablePath() throws FileNotFoundException |
+ { |
+ File iptablesExecutable = new File("/system/bin/iptables"); |
+ if (!iptablesExecutable.exists()) |
+ { |
+ Log.i(TAG, "iptables not found on the system, using embedded binary"); |
+ iptablesExecutable = context.getFileStreamPath("iptables"); |
+ } |
+ if (!iptablesExecutable.exists()) |
+ throw new FileNotFoundException("No iptables executable"); |
+ return iptablesExecutable.getAbsolutePath(); |
+ } |
+ |
@Override |
public boolean registerProxy(final InetAddress address, final int port) |
{ |