mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-26 01:38:07 +00:00
Revert "Only add routes when needed"
This reverts commit c8cec0839e
.
Refs #395
This commit is contained in:
parent
c8cec0839e
commit
285cbb1217
2 changed files with 52 additions and 59 deletions
40
app/app.iml
40
app/app.iml
|
@ -41,12 +41,6 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/renderscript" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/renderscript" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/all/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/all/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/all/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/all/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/all/debug" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/all/debug" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/res" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/res" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/resources" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/resources" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/assets" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/assets" type="java-test-resource" />
|
||||||
|
@ -54,6 +48,12 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/java" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/java" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/jni" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/jni" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/rs" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/rs" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/all/debug" isTestSource="true" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/all/debug" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/all/debug" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/all/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/all/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/all/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/all/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/all/assets" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/all/assets" type="java-resource" />
|
||||||
|
@ -61,13 +61,6 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/all/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/all/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/all/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/all/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/all/renderscript" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/all/renderscript" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAll/res" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAll/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAll/assets" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAll/aidl" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAll/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAll/jni" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testAll/rs" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/res" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/res" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/resources" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/resources" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/assets" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/assets" type="java-test-resource" />
|
||||||
|
@ -75,6 +68,13 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/java" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/java" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/jni" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/jni" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/rs" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/rs" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/testAll/res" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/testAll/resources" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/testAll/assets" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/testAll/aidl" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/testAll/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/testAll/jni" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/testAll/rs" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||||
|
@ -96,13 +96,6 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/renderscript" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/renderscript" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/renderscript" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||||
|
@ -110,6 +103,13 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/renderscript" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/renderscript" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/renderscript" isTestSource="true" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/binaries" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/binaries" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||||
|
|
|
@ -969,19 +969,15 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
builder.addDnsServer(dns);
|
builder.addDnsServer(dns);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Routing
|
|
||||||
Configuration config = getResources().getConfiguration();
|
|
||||||
if (tethering || (config.mcc == 310 && config.mnc == 260)) {
|
|
||||||
// Exclude IP ranges
|
// Exclude IP ranges
|
||||||
List<IPUtil.CIDR> listExclude = new ArrayList<>();
|
List<IPUtil.CIDR> listExclude = new ArrayList<>();
|
||||||
listExclude.add(new IPUtil.CIDR("127.0.0.0", 8)); // localhost
|
listExclude.add(new IPUtil.CIDR("127.0.0.0", 8)); // localhost
|
||||||
|
|
||||||
if (tethering) {
|
if (tethering) {
|
||||||
// USB Tethering 192.168.42.x
|
// USB Tethering 192.168.42.x
|
||||||
// Wi-Fi Tethering 192.168.43.x
|
// Wi-Fi Tethering 192.168.43.x
|
||||||
listExclude.add(new IPUtil.CIDR("192.168.42.0", 23));
|
listExclude.add(new IPUtil.CIDR("192.168.42.0", 23));
|
||||||
}
|
}
|
||||||
|
Configuration config = getResources().getConfiguration();
|
||||||
if (config.mcc == 310 && config.mnc == 260) {
|
if (config.mcc == 310 && config.mnc == 260) {
|
||||||
// T-Mobile Wi-Fi calling
|
// T-Mobile Wi-Fi calling
|
||||||
listExclude.add(new IPUtil.CIDR("66.94.2.0", 24));
|
listExclude.add(new IPUtil.CIDR("66.94.2.0", 24));
|
||||||
|
@ -989,7 +985,6 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
listExclude.add(new IPUtil.CIDR("66.94.8.0", 22));
|
listExclude.add(new IPUtil.CIDR("66.94.8.0", 22));
|
||||||
listExclude.add(new IPUtil.CIDR("208.54.0.0", 16));
|
listExclude.add(new IPUtil.CIDR("208.54.0.0", 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
listExclude.add(new IPUtil.CIDR("224.0.0.0", 3)); // broadcast
|
listExclude.add(new IPUtil.CIDR("224.0.0.0", 3)); // broadcast
|
||||||
|
|
||||||
Collections.sort(listExclude);
|
Collections.sort(listExclude);
|
||||||
|
@ -1015,8 +1010,6 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
} catch (UnknownHostException ex) {
|
} catch (UnknownHostException ex) {
|
||||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
builder.addRoute("0.0.0.0", 0);
|
|
||||||
|
|
||||||
builder.addRoute("0:0:0:0:0:0:0:0", 0);
|
builder.addRoute("0:0:0:0:0:0:0:0", 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue