diff options
author | Tomek Mrugalski <tomasz@isc.org> | 2013-02-07 15:28:36 +0100 |
---|---|---|
committer | Tomek Mrugalski <tomasz@isc.org> | 2013-02-07 15:28:36 +0100 |
commit | 1d6a2e3fb2715b445ce835847d7d353886495fea (patch) | |
tree | c122807bd4eb5309bc1d24b0490233b42ea83110 /src/lib/dhcpsrv/lease_mgr.cc | |
parent | [master] Merge branch 'trac2145' (diff) | |
download | kea-1d6a2e3fb2715b445ce835847d7d353886495fea.tar.xz kea-1d6a2e3fb2715b445ce835847d7d353886495fea.zip |
[2697] Lease4::operator== is now safe to use for leases without client-id
Diffstat (limited to 'src/lib/dhcpsrv/lease_mgr.cc')
-rw-r--r-- | src/lib/dhcpsrv/lease_mgr.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/dhcpsrv/lease_mgr.cc b/src/lib/dhcpsrv/lease_mgr.cc index 6608b14ddd..2310dd4cd5 100644 --- a/src/lib/dhcpsrv/lease_mgr.cc +++ b/src/lib/dhcpsrv/lease_mgr.cc @@ -113,11 +113,22 @@ Lease4::toText() const { bool Lease4::operator==(const Lease4& other) const { + if ( (client_id_ && !other.client_id_) || + (!client_id_ && other.client_id_) ) { + // One lease has client-id, but the other doesn't + return false; + } + + if (client_id_ && other.client_id_ && + *client_id_ != *other.client_id_) { + // Different client-ids + return false; + } + return ( addr_ == other.addr_ && ext_ == other.ext_ && hwaddr_ == other.hwaddr_ && - *client_id_ == *other.client_id_ && t1_ == other.t1_ && t2_ == other.t2_ && valid_lft_ == other.valid_lft_ && |