Check if cfg.sessionConfiguration.dnsServers is empty (#198)

This commit is contained in:
Jose Blaya 2021-01-26 16:31:57 +01:00 committed by GitHub
parent 790ec276db
commit 4b3f3dee5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -718,7 +718,13 @@ extension OpenVPNTunnelProvider: OpenVPNSessionDelegate {
// fall back
if dnsSettings == nil {
dnsServers = cfg.sessionConfiguration.dnsServers ?? options.dnsServers ?? []
dnsServers = []
if let servers = cfg.sessionConfiguration.dnsServers,
!servers.isEmpty {
dnsServers = servers
} else if let servers = options.dnsServers {
dnsServers = servers
}
if !dnsServers.isEmpty {
log.info("DNS: Using servers \(dnsServers.maskedDescription)")
dnsSettings = NEDNSSettings(servers: dnsServers)