diff --git a/app/app.iml b/app/app.iml
index 1ee7df9e..abb7fbad 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -41,12 +41,6 @@
-
-
-
-
-
-
@@ -54,6 +48,12 @@
+
+
+
+
+
+
@@ -61,13 +61,6 @@
-
-
-
-
-
-
-
@@ -75,6 +68,13 @@
+
+
+
+
+
+
+
@@ -96,13 +96,6 @@
-
-
-
-
-
-
-
@@ -110,6 +103,13 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java b/app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java
index 3c910b3a..ed245b74 100644
--- a/app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java
+++ b/app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java
@@ -969,54 +969,47 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
builder.addDnsServer(dns);
}
- // Routing
+ // Exclude IP ranges
+ List listExclude = new ArrayList<>();
+ listExclude.add(new IPUtil.CIDR("127.0.0.0", 8)); // localhost
+ if (tethering) {
+ // USB Tethering 192.168.42.x
+ // Wi-Fi Tethering 192.168.43.x
+ listExclude.add(new IPUtil.CIDR("192.168.42.0", 23));
+ }
Configuration config = getResources().getConfiguration();
- if (tethering || (config.mcc == 310 && config.mnc == 260)) {
- // Exclude IP ranges
- List listExclude = new ArrayList<>();
- listExclude.add(new IPUtil.CIDR("127.0.0.0", 8)); // localhost
+ if (config.mcc == 310 && config.mnc == 260) {
+ // T-Mobile Wi-Fi calling
+ listExclude.add(new IPUtil.CIDR("66.94.2.0", 24));
+ listExclude.add(new IPUtil.CIDR("66.94.6.0", 23));
+ 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("224.0.0.0", 3)); // broadcast
- if (tethering) {
- // USB Tethering 192.168.42.x
- // Wi-Fi Tethering 192.168.43.x
- listExclude.add(new IPUtil.CIDR("192.168.42.0", 23));
- }
+ Collections.sort(listExclude);
- if (config.mcc == 310 && config.mnc == 260) {
- // T-Mobile Wi-Fi calling
- listExclude.add(new IPUtil.CIDR("66.94.2.0", 24));
- listExclude.add(new IPUtil.CIDR("66.94.6.0", 23));
- 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("224.0.0.0", 3)); // broadcast
-
- Collections.sort(listExclude);
-
- try {
- InetAddress start = InetAddress.getByName("0.0.0.0");
- for (IPUtil.CIDR exclude : listExclude) {
- Log.i(TAG, "Exclude " + exclude.getStart().getHostAddress() + "..." + exclude.getEnd().getHostAddress());
- for (IPUtil.CIDR include : IPUtil.toCIDR(start, IPUtil.minus1(exclude.getStart())))
- try {
- builder.addRoute(include.address, include.prefix);
- } catch (Throwable ex) {
- Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
- }
- start = IPUtil.plus1(exclude.getEnd());
- }
- for (IPUtil.CIDR include : IPUtil.toCIDR("224.0.0.0", "255.255.255.255"))
+ try {
+ InetAddress start = InetAddress.getByName("0.0.0.0");
+ for (IPUtil.CIDR exclude : listExclude) {
+ Log.i(TAG, "Exclude " + exclude.getStart().getHostAddress() + "..." + exclude.getEnd().getHostAddress());
+ for (IPUtil.CIDR include : IPUtil.toCIDR(start, IPUtil.minus1(exclude.getStart())))
try {
builder.addRoute(include.address, include.prefix);
} catch (Throwable ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
- } catch (UnknownHostException ex) {
- Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
+ start = IPUtil.plus1(exclude.getEnd());
}
- } else
- builder.addRoute("0.0.0.0", 0);
+ for (IPUtil.CIDR include : IPUtil.toCIDR("224.0.0.0", "255.255.255.255"))
+ try {
+ builder.addRoute(include.address, include.prefix);
+ } catch (Throwable ex) {
+ Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
+ }
+ } catch (UnknownHostException ex) {
+ Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
+ }
builder.addRoute("0:0:0:0:0:0:0:0", 0);