diff options
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt index c688742..af5966e 100644 --- a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt +++ b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon | 2 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon |
3 | * Copyright (C) 2017-2020 Pacien TRAN-GIRARD | 3 | * Copyright (C) 2017-2023 Pacien TRAN-GIRARD |
4 | * | 4 | * |
5 | * This program is free software: you can redistribute it and/or modify | 5 | * This program is free software: you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -23,6 +23,7 @@ import android.content.Context | |||
23 | import android.content.Intent | 23 | import android.content.Intent |
24 | import android.net.LocalServerSocket | 24 | import android.net.LocalServerSocket |
25 | import android.net.VpnService | 25 | import android.net.VpnService |
26 | import android.os.Build | ||
26 | import android.os.ParcelFileDescriptor | 27 | import android.os.ParcelFileDescriptor |
27 | import androidx.localbroadcastmanager.content.LocalBroadcastManager | 28 | import androidx.localbroadcastmanager.content.LocalBroadcastManager |
28 | import java8.util.concurrent.CompletableFuture | 29 | import java8.util.concurrent.CompletableFuture |
@@ -93,9 +94,6 @@ class TincVpnService : VpnService() { | |||
93 | if (TincKeyring.needsPassphrase(netName) && passphrase == null) | 94 | if (TincKeyring.needsPassphrase(netName) && passphrase == null) |
94 | return reportError(resources.getString(R.string.notification_error_message_passphrase_not_provided)) | 95 | return reportError(resources.getString(R.string.notification_error_message_passphrase_not_provided)) |
95 | 96 | ||
96 | if (!AppPaths.storageAvailable()) | ||
97 | return reportError(resources.getString(R.string.start_network_list_empty_storage_not_available)) | ||
98 | |||
99 | if (!AppPaths.confDir(netName).exists()) | 97 | if (!AppPaths.confDir(netName).exists()) |
100 | return reportError(resources.getString(R.string.notification_error_message_no_configuration_for_network_format, netName), docTopic = "configuration") | 98 | return reportError(resources.getString(R.string.notification_error_message_no_configuration_for_network_format, netName), docTopic = "configuration") |
101 | 99 | ||
@@ -136,6 +134,8 @@ class TincVpnService : VpnService() { | |||
136 | Builder().setSession(netName) | 134 | Builder().setSession(netName) |
137 | .applyCfg(interfaceCfg) | 135 | .applyCfg(interfaceCfg) |
138 | .also { applyIgnoringException(it::addDisallowedApplication, BuildConfig.APPLICATION_ID) } | 136 | .also { applyIgnoringException(it::addDisallowedApplication, BuildConfig.APPLICATION_ID) } |
137 | // inherit metered property from underlying network | ||
138 | .also { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) it.setMetered(false) } | ||
139 | .establish()!! | 139 | .establish()!! |
140 | } catch (e: IllegalArgumentException) { | 140 | } catch (e: IllegalArgumentException) { |
141 | return reportError(resources.getString(R.string.notification_error_message_network_config_invalid_format, e.defaultMessage()), e, "network-interface") | 141 | return reportError(resources.getString(R.string.notification_error_message_network_config_invalid_format, e.defaultMessage()), e, "network-interface") |