mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-02-07 00:13:58 +00:00
Scope: updated static ip validation in FindInterface() with explicit check for ipv4 dhcp server and with detailed error message.
This commit is contained in:
@@ -438,9 +438,12 @@ namespace DnsServerCore.Dhcp
|
||||
{
|
||||
//found interface for this scope range
|
||||
|
||||
//check if address is static
|
||||
if (ipInterface.DhcpServerAddresses.Count > 0)
|
||||
throw new DhcpServerException("DHCP Server requires static IP address to work correctly but the network interface was found to have DHCP configured.");
|
||||
//check if interface has dynamic ipv4 address assigned via dhcp
|
||||
foreach (IPAddress dhcpServerAddress in ipInterface.DhcpServerAddresses)
|
||||
{
|
||||
if (dhcpServerAddress.AddressFamily == AddressFamily.InterNetwork)
|
||||
throw new DhcpServerException("DHCP Server requires static IP address to work correctly but the network interface was found to have a dynamic IP address [" + ip.Address.ToString() + "] assigned by another DHCP server: " + dhcpServerAddress.ToString());
|
||||
}
|
||||
|
||||
_interfaceAddress = ip.Address;
|
||||
_interfaceIndex = ipInterface.GetIPv4Properties().Index;
|
||||
|
||||
Reference in New Issue
Block a user