Skip DNS settings if no servers are provided

This commit is contained in:
Davide De Rosa 2019-04-05 12:58:05 +02:00
parent 4ce2d78c5a
commit 82394e0433
1 changed files with 11 additions and 8 deletions

View File

@ -571,16 +571,19 @@ extension TunnelKitProvider: SessionProxyDelegate {
ipv6Settings?.includedRoutes = routes ipv6Settings?.includedRoutes = routes
ipv6Settings?.excludedRoutes = [] ipv6Settings?.excludedRoutes = []
} }
var dnsServers = cfg.sessionConfiguration.dnsServers var dnsSettings: NEDNSSettings?
if dnsServers?.isEmpty ?? true { var cfgDNSServers = cfg.sessionConfiguration.dnsServers
dnsServers = reply.options.dnsServers if cfgDNSServers?.isEmpty ?? true {
cfgDNSServers = reply.options.dnsServers
} }
// FIXME: default to DNS servers from current network instead // FIXME: default to DNS servers from current network instead
let dnsSettings = NEDNSSettings(servers: dnsServers ?? []) if let dnsServers = cfgDNSServers, !dnsServers.isEmpty {
if let searchDomain = cfg.sessionConfiguration.searchDomain ?? reply.options.searchDomain { dnsSettings = NEDNSSettings(servers: dnsServers)
dnsSettings.domainName = searchDomain if let searchDomain = cfg.sessionConfiguration.searchDomain ?? reply.options.searchDomain {
dnsSettings.searchDomains = [searchDomain] dnsSettings?.domainName = searchDomain
dnsSettings?.searchDomains = [searchDomain]
}
} }
var proxySettings: NEProxySettings? var proxySettings: NEProxySettings?