diff options
author | Thomas Markwalder <tmark@isc.org> | 2015-03-18 20:16:09 +0100 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2015-03-18 20:16:09 +0100 |
commit | 3e09b74567d827942a1e81777fce39b9dd7593bb (patch) | |
tree | 0c76140b14216f80559d3f9257b02c0e24f77ea3 /src/lib | |
parent | [3689] Fixed outdated documentation for DHCPv6 messages processing functions (diff) | |
download | kea-3e09b74567d827942a1e81777fce39b9dd7593bb.tar.xz kea-3e09b74567d827942a1e81777fce39b9dd7593bb.zip |
[3689] Addressed primary review comments
doc/guide/dhcp6-srv.xml
Updated "Reserving a hostname" section
(also removed trailing spaces)
src/bin/dhcp6/dhcp6_srv.cc
corrected test and commentary typo in assignIA_NA
removed second parameter to renewLeases6() calls
src/bin/dhcp6/dhcp6_srv.h
updated commentary for createContext()
src/lib/dhcpsrv/alloc_engine.cc
src/lib/dhcpsrv/alloc_engine.h
AllocEngine::createLease6()
removed find_host parameter and logic which calls
findReservation and/or alters context hostname
src/lib/dhcpsrv/tests/alloc_engine_utils.cc
AllocEngine6Test::renewTest() - added call to
AllocEngine6Test::findReservation()
src/lib/dhcpsrv/tests/alloc_engine_utils.h
fixed typo
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/dhcpsrv/alloc_engine.cc | 17 | ||||
-rw-r--r-- | src/lib/dhcpsrv/alloc_engine.h | 10 | ||||
-rw-r--r-- | src/lib/dhcpsrv/tests/alloc_engine_utils.cc | 1 | ||||
-rw-r--r-- | src/lib/dhcpsrv/tests/alloc_engine_utils.h | 2 |
4 files changed, 4 insertions, 26 deletions
diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index dc5f7a70f1..a58eed28e2 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -1006,7 +1006,7 @@ Lease6Ptr AllocEngine::createLease6(ClientContext6& ctx, } Lease6Collection -AllocEngine::renewLeases6(ClientContext6& ctx, bool find_host) { +AllocEngine::renewLeases6(ClientContext6& ctx) { try { if (!ctx.subnet_) { isc_throw(InvalidOperation, "Subnet is required for allocation"); @@ -1016,21 +1016,6 @@ AllocEngine::renewLeases6(ClientContext6& ctx, bool find_host) { isc_throw(InvalidOperation, "DUID is mandatory for allocation"); } - // We can attempt to find appropriate reservation - if (find_host) { - findReservation(ctx); - } - - // Let's check whether there's a hostname specified in the reservation - if (ctx.host_) { - std::string hostname = ctx.host_->getHostname(); - // If there is, let's use it - if (!hostname.empty()) { - ctx.hostname_ = hostname; - } - } - - // Check if there are any leases for this client. Lease6Collection leases = LeaseMgrFactory::instance() .getLeases6(ctx.type_, *ctx.duid_, ctx.iaid_, ctx.subnet_->getID()); diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h index bb6835b575..bdda4b8c5f 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -498,16 +498,8 @@ public: /// prefixes the client had sent. @ref ClientContext6::old_leases_ will /// contain removed leases in this case. /// - /// @param find_resrv specifies whether the code should search for host - /// reservation. true means that the code will consult HostMgr, false means - /// to skip this check. That is easier to use, but is redundant if the - /// ctx.host_ field is already set. We can't use ctx.host_ == NULL as - /// check, because for cases whithout reservations, the reservation - /// search would be repeated. - /// - /// /// @return Returns renewed lease. - Lease6Collection renewLeases6(ClientContext6& ctx, bool find_resrv = true); + Lease6Collection renewLeases6(ClientContext6& ctx); /// @brief Attempts to find appropriate host reservation. /// diff --git a/src/lib/dhcpsrv/tests/alloc_engine_utils.cc b/src/lib/dhcpsrv/tests/alloc_engine_utils.cc index 38b07611a2..f0ff369ab6 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_utils.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine_utils.cc @@ -230,6 +230,7 @@ AllocEngine6Test::renewTest(AllocEngine& engine, const Pool6Ptr& pool, ctx.query_.reset(new Pkt6(DHCPV6_RENEW, 123)); ctx.allow_new_leases_in_renewals_ = allow_new_leases_in_renewal; + findReservation(engine, ctx); Lease6Collection leases = engine.renewLeases6(ctx); for (Lease6Collection::iterator it = leases.begin(); it != leases.end(); ++it) { diff --git a/src/lib/dhcpsrv/tests/alloc_engine_utils.h b/src/lib/dhcpsrv/tests/alloc_engine_utils.h index 0c2a6f82aa..80f159dad5 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_utils.h +++ b/src/lib/dhcpsrv/tests/alloc_engine_utils.h @@ -113,7 +113,7 @@ public: /// @brief Wrapper around call to AllocEngine6::findRervation /// - /// If a reservation is found bg the engine, the function sets + /// If a reservation is found by the engine, the function sets /// ctx.hostname_ accordingly. /// /// @param engine allocation engine to use |