fix(android): on full route dont allow bypass vpn (#6133)

If blocking non-vpn connections `allowBypass` breaks the VPN.

To fix this, we disable `allowBypass` when full-route is enable.

Fixes #4834 (hopefully)
This commit is contained in:
Gabi
2024-08-02 02:06:36 -03:00
committed by GitHub
parent 5a1813a421
commit 6ce4b6f171

View File

@@ -314,8 +314,10 @@ class TunnelService : VpnService() {
private fun buildVpnService(): Int {
Builder().apply {
// Allow traffic to bypass the VPN interface when Always-on VPN is enabled.
allowBypass()
if (tunnelRoutes.all { it.prefix != 0 }) {
// Allow traffic to bypass the VPN interface when Always-on VPN is enabled.
allowBypass()
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
setMetered(false) // Inherit the metered status from the underlying networks.