diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-11-17 01:02:06 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-12-10 12:55:06 +0000 |
| commit | 1eb16a48eea0d7f66883b1eb678400481887370a (patch) | |
| tree | 94f1b635fa90bf1341258e8626e37afdf6f88b8b /android/src | |
| parent | a1e567295c218e48dc2ed46340709cfa460cdafb (diff) | |
| download | mullvadvpn-1eb16a48eea0d7f66883b1eb678400481887370a.tar.xz mullvadvpn-1eb16a48eea0d7f66883b1eb678400481887370a.zip | |
Prevent loopback addresses from being added
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt index 2993bd71c3..4ffdebe0ec 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/customdns/CustomDnsAdapter.kt @@ -230,9 +230,11 @@ class CustomDnsAdapter(val customDns: CustomDns) : Adapter<CustomDnsItemHolder>( if (inetAddressValidator.isValid(addressText)) { val address = InetAddress.getByName(addressText) - if (customDns.addDnsServer(address)) { - cachedCustomDnsServers.add(address) - added = true + if (!address.isLoopbackAddress()) { + if (customDns.addDnsServer(address)) { + cachedCustomDnsServers.add(address) + added = true + } } } } @@ -257,9 +259,11 @@ class CustomDnsAdapter(val customDns: CustomDns) : Adapter<CustomDnsItemHolder>( val newAddress = InetAddress.getByName(address) val oldAddress = cachedCustomDnsServers[position] - if (customDns.replaceDnsServer(oldAddress, newAddress)) { - cachedCustomDnsServers[position] = newAddress - replaced = true + if (!newAddress.isLoopbackAddress()) { + if (customDns.replaceDnsServer(oldAddress, newAddress)) { + cachedCustomDnsServers[position] = newAddress + replaced = true + } } } } |
