From 6148e6ef60c8d7ba628b42782a7c8772e644a28f Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 18 Sep 2021 19:23:34 +0530 Subject: [PATCH] DhcpServer: Implemented RemoveLease() method to remove lease and update DNS auth zone. --- DnsServerCore/Dhcp/DhcpServer.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DnsServerCore/Dhcp/DhcpServer.cs b/DnsServerCore/Dhcp/DhcpServer.cs index d1c1d536..9130448a 100644 --- a/DnsServerCore/Dhcp/DhcpServer.cs +++ b/DnsServerCore/Dhcp/DhcpServer.cs @@ -1334,6 +1334,16 @@ namespace DnsServerCore.Dhcp SaveScopeFile(scope); } + public void RemoveLease(string scopeName, string hardwareAddress) + { + Scope scope = GetScope(scopeName); + if (scope == null) + throw new DhcpServerException("DHCP scope does not exists: " + scopeName); + + Lease removedLease = scope.RemoveLease(hardwareAddress); + UpdateDnsAuthZone(false, scope, removedLease); + } + public IDictionary GetAddressHostNameMap() { Dictionary map = new Dictionary();