1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
This commit is contained in:
Ben 2018-01-22 18:25:08 -06:00 committed by Jordan Borean
parent 390f65bd6a
commit 9fdaa86c9f

View file

@ -135,7 +135,11 @@ Function Get-DnsClientMatch {
$current_dns_v4 = ($current_dns_all | Where-Object AddressFamily -eq 2 <# IPv4 #>).ServerAddresses $current_dns_v4 = ($current_dns_all | Where-Object AddressFamily -eq 2 <# IPv4 #>).ServerAddresses
If ($current_dns_v4 -eq $null) { If (($current_dns_v4 -eq $null) -and ($ipv4_addresses -eq $null)) {
$v4_match = $True
}
ElseIf (($current_dns_v4 -eq $null) -or ($ipv4_addresses -eq $null)) {
$v4_match = $False $v4_match = $False
} }
@ -167,8 +171,14 @@ Function Set-DnsClientAddresses
Write-DebugLog ("Setting DNS addresses for adapter {0} to ({1})" -f $adapter_name, ($ipv4_addresses -join ", ")) Write-DebugLog ("Setting DNS addresses for adapter {0} to ({1})" -f $adapter_name, ($ipv4_addresses -join ", "))
If ($ipv4_addresses -eq $null) {
Set-DnsClientServerAddress -InterfaceAlias $adapter_name -ResetServerAddress
}
Else {
# this silently ignores invalid IPs, so we validate parseability ourselves up front... # this silently ignores invalid IPs, so we validate parseability ourselves up front...
Set-DnsClientServerAddress -InterfaceAlias $adapter_name -ServerAddresses $ipv4_addresses Set-DnsClientServerAddress -InterfaceAlias $adapter_name -ServerAddresses $ipv4_addresses
}
# TODO: implement IPv6 # TODO: implement IPv6
} }