diff options
Diffstat (limited to 'app/src/main/java/se/leap')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java | 4 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java b/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java index 93054099..8bb197b1 100644 --- a/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java +++ b/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java @@ -155,8 +155,8 @@ public class SetupTetheringTask extends AsyncTask<Void, Boolean, Boolean> { "ip route delete broadcast 255.255.255.255 dev " + state.wifiInterface +" scope link table 61", "ip route delete " + state.lastWifiAddress + " dev " + state.wifiInterface +" scope link table 61", "ip route delete default dev " + getTunName() + " scope link table 61", - "if [[ `ip rule show from " + state.wifiAddress+ " lookup 61` ]]; " + - "then ip rule del from " + state.wifiAddress + " lookup 61; " + + "if [[ `ip rule show from " + state.lastWifiAddress+ " lookup 61` ]]; " + + "then ip rule del from " + state.lastWifiAddress + " lookup 61; " + "fi", }; return runBlockingCmd(removeRules, log) == 0; diff --git a/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java b/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java index 58d67872..11e1a83d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java @@ -18,6 +18,7 @@ package se.leap.bitmaskclient.tethering; import android.content.Context; import android.content.IntentFilter; +import android.support.annotation.VisibleForTesting; import android.util.Log; import java.net.Inet4Address; @@ -94,13 +95,13 @@ public class TetheringStateManager { if (interfaceAddress.split("\\.").length == 4) { String result = interfaceAddress.substring(0, interfaceAddress.lastIndexOf(".")); result = result + ".0/24"; - Log.d(TAG, "wifiAddressRange = " + result); return result; } return ""; } - private static String getWifiInterfaceAddress() { + @VisibleForTesting + static String getWifiInterfaceAddress() { NetworkInterface networkInterface = getWlanInterface(); if (networkInterface != null) { List<InterfaceAddress> ifaceAddresses = networkInterface.getInterfaceAddresses(); @@ -113,7 +114,7 @@ public class TetheringStateManager { return ""; } - public static String getWifiInterfaceName() { + private static String getWifiInterfaceName() { NetworkInterface networkInterface = getWlanInterface(); if (networkInterface != null) { return networkInterface.getName(); |