aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-03-14 13:30:11 +0100
committerpacien2018-03-14 13:30:11 +0100
commit2c5d24f024e4972fe20670594b3ed5ab38eeac4e (patch)
tree719680afc62a188ecfbc92ef76cb5843645879d4
parent05857ad7d85ba73b3f67571f89e12f114874bc98 (diff)
downloadtincapp-2c5d24f024e4972fe20670594b3ed5ab38eeac4e.tar.gz
Handle network interface binding errors
-rw-r--r--app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt4
-rw-r--r--app/src/main/res/values/strings.xml2
2 files changed, 6 insertions, 0 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 b59be80..0bf72a1 100644
--- a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
+++ b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
@@ -79,6 +79,10 @@ class TincVpnService : VpnService() {
79 .establish()!! 79 .establish()!!
80 } catch (e: IllegalArgumentException) { 80 } catch (e: IllegalArgumentException) {
81 return reportError(resources.getString(R.string.message_network_config_invalid_format, e.message!!), e, "network-interface") 81 return reportError(resources.getString(R.string.message_network_config_invalid_format, e.message!!), e, "network-interface")
82 } catch (e: IllegalStateException) {
83 return reportError(resources.getString(R.string.message_could_not_configure_iface, e.message!!), e)
84 } catch (e: NullPointerException) {
85 return reportError(resources.getString(R.string.message_could_not_bind_iface), e)
82 } 86 }
83 87
84 val privateKeys = try { 88 val privateKeys = try {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6dfcfb7..25bee44 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -86,6 +86,8 @@
86 <string name="message_loading">Loading…</string> 86 <string name="message_loading">Loading…</string>
87 <string name="message_log_level_set">Log level set to %1$d.</string> 87 <string name="message_log_level_set">Log level set to %1$d.</string>
88 <string name="message_log_paused">Logging paused.</string> 88 <string name="message_log_paused">Logging paused.</string>
89 <string name="message_could_not_configure_iface">Could not apply network interface configuration:\n\n%1$s</string>
90 <string name="message_could_not_bind_iface">Could not bind network interface. Is another VPN running?</string>
89 91
90 <string name="value_none">none</string> 92 <string name="value_none">none</string>
91 <string name="value_yes">yes</string> 93 <string name="value_yes">yes</string>