diff options
author | cyberta <cyberta@riseup.net> | 2020-01-31 12:08:09 -0600 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2020-01-31 12:08:09 -0600 |
commit | 0c80399b8708027770b591764d70c1cc5853b70f (patch) | |
tree | d3416a82b6d33c0f3111d80e463d3a18856fe09d /app/src/main/java/se/leap/bitmaskclient/firewall | |
parent | d1ced827e19a344cedb84c1aaa530fd613accfec (diff) |
ensure firewall is started after vpn tun interface is up, fix indent
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/firewall')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java b/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java index 67cc4625..30ecebea 100644 --- a/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java @@ -31,6 +31,7 @@ public class FirewallManager implements FirewallCallback, Observer { public static String BITMASK_FORWARD = "bitmask_forward"; public static String BITMASK_POSTROUTING = "bitmask_postrouting"; static final String TAG = FirewallManager.class.getSimpleName(); + private boolean isRunning = false; private Context context; @@ -91,14 +92,19 @@ public class FirewallManager implements FirewallCallback, Observer { public void start() { - startIPv6Firewall(); - TetheringState tetheringState = TetheringObservable.getInstance().getTetheringState(); - if (tetheringState.hasAnyDeviceTetheringEnabled() && tetheringState.hasAnyVpnTetheringAllowed()) { - startTethering(); + if (!isRunning) { + isRunning = true; + startIPv6Firewall(); + TetheringState tetheringState = TetheringObservable.getInstance().getTetheringState(); + if (tetheringState.hasAnyDeviceTetheringEnabled() && tetheringState.hasAnyVpnTetheringAllowed()) { + startTethering(); + } } + } public void stop() { + isRunning = false; stopIPv6Firewall(); stopTethering(); } |