diff --git a/DnsServerCore/Dhcp/Lease.cs b/DnsServerCore/Dhcp/Lease.cs index f91250c3..e2c9db10 100644 --- a/DnsServerCore/Dhcp/Lease.cs +++ b/DnsServerCore/Dhcp/Lease.cs @@ -27,7 +27,7 @@ using TechnitiumLibrary.Net; namespace DnsServerCore.Dhcp { - public class Lease + public class Lease : IComparable { #region variables @@ -89,7 +89,7 @@ namespace DnsServerCore.Dhcp private static byte[] ParseHardwareAddress(string hardwareAddress) { - string[] parts = hardwareAddress.Split('-'); + string[] parts = hardwareAddress.Split(new char[] { '-', ':' }); byte[] address = new byte[parts.Length]; for (int i = 0; i < parts.Length; i++) @@ -140,6 +140,11 @@ namespace DnsServerCore.Dhcp return _hostName + " [" + hardwareAddress + "]"; } + public int CompareTo(Lease other) + { + return _address.ConvertIpToNumber().CompareTo(other._address.ConvertIpToNumber()); + } + #endregion #region properties