ctx.duid_ = pkt->getClientId(),
ctx.fwd_dns_update_ = false;
ctx.rev_dns_update_ = false;
- ctx.fake_allocation_ = false;
ctx.hostname_ = "";
ctx.query_ = pkt;
ctx.callout_handle_ = getCalloutHandle(pkt);
do_rev);
}
- // Use allocation engine to pick a lease for this client. Allocation engine
- // will try to honor the hint, but it is just a hint - some other address
- // may be used instead. If fake_allocation is set to false, the lease will
- // be inserted into the LeaseMgr as well.
- ctx.createIAContext();
+ // Update per-packet context values.
ctx.fwd_dns_update_ = do_fwd;
ctx.rev_dns_update_ = do_rev;
ctx.fake_allocation_ = fake_allocation;
+
+ // Set per-IA context values.
+ ctx.createIAContext();
ctx.currentIA().iaid_ = ia->getIAID();
ctx.currentIA().addHint(hint);
ctx.currentIA().type_ = Lease::TYPE_NA;
+ // Use allocation engine to pick a lease for this client. Allocation engine
+ // will try to honor the hint, but it is just a hint - some other address
+ // may be used instead. If fake_allocation is set to false, the lease will
+ // be inserted into the LeaseMgr as well.
Lease6Collection leases = alloc_engine_->allocateLeases6(ctx);
/// @todo: Handle more than one lease
// Reply message it means that it is committing leases. Other message
// type (Advertise) means that server is not committing leases (fake
// allocation).
- bool fake_allocation = (answer->getType() != DHCPV6_REPLY);
-
- // Use allocation engine to pick a lease for this client. Allocation engine
- // will try to honor the hint, but it is just a hint - some other address
- // may be used instead. If fake_allocation is set to false, the lease will
- // be inserted into the LeaseMgr as well.
+ ctx.fake_allocation_ = (answer->getType() != DHCPV6_REPLY);
+ // Set per-IA context values.
ctx.createIAContext();
- ctx.fake_allocation_ = fake_allocation;
ctx.currentIA().iaid_ = ia->getIAID();
ctx.currentIA().addHint(hint);
ctx.currentIA().type_ = Lease::TYPE_PD;
-
+ // Use allocation engine to pick a lease for this client. Allocation engine
+ // will try to honor the hint, but it is just a hint - some other address
+ // may be used instead. If fake_allocation is set to false, the lease will
+ // be inserted into the LeaseMgr as well.
Lease6Collection leases = alloc_engine_->allocateLeases6(ctx);
if (!leases.empty()) {
// We have a lease! Let's wrap its content into IA_PD option
// with IAADDR suboption.
- LOG_INFO(lease6_logger, fake_allocation ?
+ LOG_INFO(lease6_logger, ctx.fake_allocation ?
DHCP6_PD_LEASE_ADVERT : DHCP6_PD_LEASE_ALLOC)
.arg(query->getLabel())
.arg((*l)->addr_.toText())
// cause of that failure. The only thing left is to insert
// status code to pass the sad news to the client.
- LOG_DEBUG(lease6_logger, DBG_DHCP6_DETAIL, fake_allocation ?
+ LOG_DEBUG(lease6_logger, DBG_DHCP6_DETAIL, ctx.fake_allocation ?
DHCP6_PD_LEASE_ADVERT_FAIL : DHCP6_PD_LEASE_ALLOC_FAIL)
.arg(query->getLabel())
.arg(ia->getIAID());
do_fwd, do_rev);
}
- ctx.createIAContext();
+ // Set per-packet context values.
ctx.fwd_dns_update_ = do_fwd;
ctx.rev_dns_update_ = do_rev;
+
+ // Set per-IA context values.
+ ctx.createIAContext();
ctx.currentIA().iaid_ = ia->getIAID();
ctx.currentIA().type_ = Lease::TYPE_NA;
ctx.currentIA().ia_rsp_ = ia_rsp;
// - what we actually assigned in leases
// - old leases that are no longer valid in ctx.old_leases_
+ // For each IA inserted by the client we have to determine what to do
+ // about included addresses and notify the client. We will iterate over
+ // those prefixes and remove those that we have already processed. We
+ // don't want to remove them from the context, so we need to copy them
+ // into temporary container.
AllocEngine::HintContainer hints = ctx.currentIA().hints_;
// For all leases we have now, add the IAADDR with non-zero lifetimes.
ia_rsp->setT1(subnet->getT1());
ia_rsp->setT2(subnet->getT2());
+ // Set per-IA context values.
ctx.createIAContext();
ctx.currentIA().iaid_ = ia->getIAID();
ctx.currentIA().type_ = Lease::TYPE_PD;
// in PD context)
Lease6Collection leases = alloc_engine_->renewLeases6(ctx);
+ // For each IA inserted by the client we have to determine what to do
+ // about included prefixes and notify the client. We will iterate over
+ // those prefixes and remove those that we have already processed. We
+ // don't want to remove them from the context, so we need to copy them
+ // into temporary container.
AllocEngine::HintContainer hints = ctx.currentIA().hints_;
// For all the leases we have now, add the IAPPREFIX with non-zero lifetimes