summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-12-30 07:09:31 +0100
committercyBerta <cyberta@riseup.net>2019-12-30 07:09:31 +0100
commit22eb43939a8bcae2ed7f89d37abf023fc33c485f (patch)
tree90afb411cca188325a161da034011caeef93b51c /app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
parent59f7679c633284d772a91a9ee057034a8223e73a (diff)
initial firewall implementation to fix #8939
Diffstat (limited to 'app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index 0863cc8e..724fd0fd 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -47,6 +47,7 @@ import de.blinkt.openvpn.core.connection.Obfs4Connection;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.VpnNotificationManager;
import se.leap.bitmaskclient.pluggableTransports.Shapeshifter;
+import se.leap.bitmaskclient.utils.FirewallHelper;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTED;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT;
@@ -89,6 +90,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
private Runnable mOpenVPNThread;
private VpnNotificationManager notificationManager;
private Shapeshifter shapeshifter;
+ private FirewallHelper firewallHelper;
private static final int PRIORITY_MIN = -2;
private static final int PRIORITY_DEFAULT = 0;
@@ -192,6 +194,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
VpnStatus.removeStateListener(this);
}
}
+ firewallHelper.shutdownFirewall();
}
private boolean runningOnAndroidTV() {
@@ -446,6 +449,8 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
mProcessThread.start();
}
+ firewallHelper.startFirewall();
+
new Handler(getMainLooper()).post(() -> {
if (mDeviceStateReceiver != null) {
unregisterDeviceStateReceiver();
@@ -513,6 +518,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
super.onCreate();
notificationManager = new VpnNotificationManager(this, this);
notificationManager.createOpenVpnNotificationChannel();
+ firewallHelper = new FirewallHelper();
}
@Override