mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-01-07 01:04:02 +00:00
DhcpServer: added support to shift an allocation from dynamic to another reserved lease address and vice versa.
This commit is contained in:
@@ -347,6 +347,26 @@ namespace DnsServerCore.Dhcp
|
||||
//send nak
|
||||
return new DhcpMessage(request, IPAddress.Any, IPAddress.Any, new DhcpOption[] { new DhcpMessageTypeOption(DhcpMessageType.Nak), new ServerIdentifierOption(scope.InterfaceAddress), DhcpOption.CreateEndOption() });
|
||||
}
|
||||
|
||||
Lease reservedLease = scope.GetReservedLease(request);
|
||||
if (reservedLease == null)
|
||||
{
|
||||
if (leaseOffer.Type == LeaseType.Reserved)
|
||||
{
|
||||
//client's reserved has been removed so release the current lease and send NAK to allow it to get new allocation
|
||||
scope.ReleaseLease(leaseOffer);
|
||||
return new DhcpMessage(request, IPAddress.Any, IPAddress.Any, new DhcpOption[] { new DhcpMessageTypeOption(DhcpMessageType.Nak), new ServerIdentifierOption(scope.InterfaceAddress), DhcpOption.CreateEndOption() });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!reservedLease.Address.Equals(leaseOffer.Address))
|
||||
{
|
||||
//client has a new reserved lease so release the current lease and send NAK to allow it to get new allocation
|
||||
scope.ReleaseLease(leaseOffer);
|
||||
return new DhcpMessage(request, IPAddress.Any, IPAddress.Any, new DhcpOption[] { new DhcpMessageTypeOption(DhcpMessageType.Nak), new ServerIdentifierOption(scope.InterfaceAddress), DhcpOption.CreateEndOption() });
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user