summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/lease_mgr.cc
diff options
context:
space:
mode:
authorTomek Mrugalski <tomasz@isc.org>2013-02-07 15:28:36 +0100
committerTomek Mrugalski <tomasz@isc.org>2013-02-07 15:28:36 +0100
commit1d6a2e3fb2715b445ce835847d7d353886495fea (patch)
treec122807bd4eb5309bc1d24b0490233b42ea83110 /src/lib/dhcpsrv/lease_mgr.cc
parent[master] Merge branch 'trac2145' (diff)
downloadkea-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.cc13
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_ &&