DhcpServer: changed sequence of FindThisDnsServerAddress() call in ActivateScopeAsync() after the FindInterface() so that the DNS address is correctly read.

This commit is contained in:
Shreyas Zare
2020-10-17 18:30:04 +05:30
parent 1ec3ed2154
commit 4bde5b0871
2 changed files with 5 additions and 5 deletions

View File

@@ -795,10 +795,6 @@ namespace DnsServerCore.Dhcp
try
{
//find this dns server address in case the network config has changed
if (scope.UseThisDnsServer)
scope.FindThisDnsServerAddress();
//find scope interface for binding socket
if (waitForInterface)
{
@@ -821,6 +817,10 @@ namespace DnsServerCore.Dhcp
throw new DhcpServerException("DHCP Server requires static IP address to work correctly but no network interface was found to have any static IP address configured.");
}
//find this dns server address in case the network config has changed
if (scope.UseThisDnsServer)
scope.FindThisDnsServerAddress();
IPAddress interfaceAddress = scope.InterfaceAddress;
dhcpEP = new IPEndPoint(interfaceAddress, 67);

View File

@@ -448,7 +448,7 @@ namespace DnsServerCore.Dhcp
{
NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
//find interface in current scope range
//find interface in current scope network range
uint networkAddressNumber = _networkAddress.ConvertIpToNumber();
uint subnetMaskNumber = _subnetMask.ConvertIpToNumber();