aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt5
1 files changed, 4 insertions, 1 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 18388f6..263fea4 100644
--- a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
+++ b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
@@ -125,10 +125,13 @@ class TincVpnService : VpnService() {
125 } 125 }
126 126
127 val deviceFd = try { 127 val deviceFd = try {
128 Builder().setSession(netName) 128 val appContextFd = Builder().setSession(netName)
129 .applyCfg(interfaceCfg) 129 .applyCfg(interfaceCfg)
130 .also { applyIgnoringException(it::addDisallowedApplication, BuildConfig.APPLICATION_ID) } 130 .also { applyIgnoringException(it::addDisallowedApplication, BuildConfig.APPLICATION_ID) }
131 .establish()!! 131 .establish()!!
132 val daemonContextFd = appContextFd.dup() // necessary since Android 10
133 appContextFd.close()
134 daemonContextFd
132 } catch (e: IllegalArgumentException) { 135 } catch (e: IllegalArgumentException) {
133 return reportError(resources.getString(R.string.notification_error_message_network_config_invalid_format, e.defaultMessage()), e, "network-interface") 136 return reportError(resources.getString(R.string.notification_error_message_network_config_invalid_format, e.defaultMessage()), e, "network-interface")
134 } catch (e: NullPointerException) { 137 } catch (e: NullPointerException) {