if (ctx.pd_exclude_requested_) {
// PD exclude option has been requested via ORO, thus we need to
// include it if the pool configuration specifies this option.
- Pool6Ptr pool = ctx.currentIA().pool_;
+ Pool6Ptr pool = boost::dynamic_pointer_cast<
+ Pool6>(subnet->getPool(Lease::TYPE_PD, (*l)->addr_));
if (pool && pool->getExcludedPrefixLength() > 0) {
OptionPtr opt(new Option6PDExclude((*l)->addr_,
(*l)->prefixlen_,
if (ctx.pd_exclude_requested_) {
// PD exclude option has been requested via ORO, thus we need to
// include it if the pool configuration specifies this option.
- Pool6Ptr pool = ctx.currentIA().pool_;
+ Pool6Ptr pool = boost::dynamic_pointer_cast<
+ Pool6>(subnet->getPool(Lease::TYPE_PD, (*l)->addr_));
+
if (pool && pool->getExcludedPrefixLength() > 0) {
OptionPtr opt(new Option6PDExclude((*l)->addr_,
(*l)->prefixlen_,
AllocEngine::ClientContext6::IAContext::IAContext()
: iaid_(0), type_(Lease::TYPE_NA), hints_(), old_leases_(),
- changed_leases_(), ia_rsp_(), pool_() {
+ changed_leases_(), ia_rsp_() {
}
void
// check if the hint is in pool and is available
// This is equivalent of subnet->inPool(hint), but returns the pool
- ctx.currentIA().pool_ = boost::dynamic_pointer_cast<
+ Pool6Ptr pool = boost::dynamic_pointer_cast<
Pool6>(ctx.subnet_->getPool(ctx.currentIA().type_, hint, false));
- if (ctx.currentIA().pool_) {
+ if (pool) {
/// @todo: We support only one hint for now
Lease6Ptr lease =
// The hint is valid and not currently used, let's create a
// lease for it
- lease = createLease6(ctx, hint, ctx.currentIA().pool_->getLength());
+ lease = createLease6(ctx, hint, pool->getLength());
// It can happen that the lease allocation failed (we could
// have lost the race condition. That means that the hint is
ctx.currentIA().old_leases_.push_back(old_lease);
/// We found a lease and it is expired, so we can reuse it
- lease = reuseExpiredLease(lease, ctx,
- ctx.currentIA().pool_->getLength());
+ lease = reuseExpiredLease(lease, ctx, pool->getLength());
/// @todo: We support only one lease per ia for now
leases.push_back(lease);
}
}
- ctx.currentIA().pool_.reset();
-
// The hint was useless (it was not provided at all, was used by someone else,
// was out of pool or reserved for someone else). Search the pool until first
// of the following occurs:
// non-PD leases.
uint8_t prefix_len = 128;
if (ctx.currentIA().type_ == Lease::TYPE_PD) {
- ctx.currentIA().pool_ = boost::dynamic_pointer_cast<Pool6>(
+ pool = boost::dynamic_pointer_cast<Pool6>(
ctx.subnet_->getPool(ctx.currentIA().type_, candidate, false));
/// @todo: verify that the pool is non-null
- prefix_len = ctx.currentIA().pool_->getLength();
+ prefix_len = pool->getLength();
}
Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(ctx.currentIA().type_,