From 89a34eef903fb30cf20e19ade34e9a795bc0d6de Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Wed, 17 Jan 2024 09:47:47 +0100 Subject: [PATCH] [#2022] Finished RADIUS v6 server code --- src/bin/dhcp6/dhcp6_srv.cc | 82 +++++++++----- src/bin/dhcp6/dhcp6_srv.h | 41 +++++-- src/bin/dhcp6/tests/classify_unittests.cc | 88 +++++++-------- src/bin/dhcp6/tests/dhcp6_srv_unittest.cc | 112 ++++++++++---------- src/bin/dhcp6/tests/dhcp6_test_utils.h | 24 ++--- src/bin/dhcp6/tests/fqdn_unittest.cc | 8 +- src/bin/dhcp6/tests/hooks_unittest.cc | 16 +-- src/bin/dhcp6/tests/vendor_opts_unittest.cc | 24 ++--- 8 files changed, 224 insertions(+), 171 deletions(-) diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 3a97f51cff..c7050038a1 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -421,9 +421,9 @@ Dhcpv6Srv::setHostIdentifiers(AllocEngine::ClientContext6& ctx) { } } -bool -Dhcpv6Srv::earlyGHRLookup(const Pkt6Ptr& query, - AllocEngine::ClientContext6& ctx) { +void +Dhcpv6Srv::initContext0(const Pkt6Ptr& query, + AllocEngine::ClientContext6& ctx) { // Pointer to client's query. ctx.query_ = query; @@ -432,6 +432,13 @@ Dhcpv6Srv::earlyGHRLookup(const Pkt6Ptr& query, // Hardware address. ctx.hwaddr_ = getMAC(query); +} + +bool +Dhcpv6Srv::earlyGHRLookup(const Pkt6Ptr& query, + AllocEngine::ClientContext6& ctx) { + // First part of context initialization. + initContext0(query, ctx); // Get the early-global-reservations-lookup flag value. data::ConstElementPtr egrl = CfgMgr::instance().getCurrentCfg()-> @@ -492,15 +499,16 @@ Dhcpv6Srv::earlyGHRLookup(const Pkt6Ptr& query, } void -Dhcpv6Srv::initContext(const Subnet6Ptr& subnet, - const Pkt6Ptr& pkt, - AllocEngine::ClientContext6& ctx, - bool& drop) { - ctx.subnet_ = subnet; +Dhcpv6Srv::initContext(AllocEngine::ClientContext6& ctx, bool& drop) { + // Sanity check. + if (!ctx.query_) { + drop = true; + return; + } ctx.fwd_dns_update_ = false; ctx.rev_dns_update_ = false; ctx.hostname_ = ""; - ctx.callout_handle_ = getCalloutHandle(pkt); + ctx.callout_handle_ = getCalloutHandle(ctx.query_); // Collect host identifiers if host reservations enabled. The identifiers // are stored in order of preference. The server will use them in that @@ -545,37 +553,37 @@ Dhcpv6Srv::initContext(const Subnet6Ptr& subnet, // a result, the first_class set via the host reservation will // replace the second_class because the second_class will this // time evaluate to false as desired. - removeDependentEvaluatedClasses(pkt); - setReservedClientClasses(pkt, ctx); - evaluateClasses(pkt, false); + removeDependentEvaluatedClasses(ctx.query_); + setReservedClientClasses(ctx.query_, ctx); + evaluateClasses(ctx.query_, false); } // Set KNOWN builtin class if something was found, UNKNOWN if not. if (!ctx.hosts_.empty()) { - pkt->addClass("KNOWN"); + ctx.query_->addClass("KNOWN"); LOG_DEBUG(dhcp6_logger, DBG_DHCP6_BASIC, DHCP6_CLASS_ASSIGNED) - .arg(pkt->getLabel()) + .arg(ctx.query_->getLabel()) .arg("KNOWN"); } else { - pkt->addClass("UNKNOWN"); + ctx.query_->addClass("UNKNOWN"); LOG_DEBUG(dhcp6_logger, DBG_DHCP6_BASIC, DHCP6_CLASS_ASSIGNED) - .arg(pkt->getLabel()) + .arg(ctx.query_->getLabel()) .arg("UNKNOWN"); } // Perform second pass of classification. - evaluateClasses(pkt, true); + evaluateClasses(ctx.query_, true); - const ClientClasses& classes = pkt->getClasses(); + const ClientClasses& classes = ctx.query_->getClasses(); LOG_DEBUG(dhcp6_logger, DBG_DHCP6_BASIC, DHCP6_CLASSES_ASSIGNED_AFTER_SUBNET_SELECTION) - .arg(pkt->getLabel()) + .arg(ctx.query_->getLabel()) .arg(classes.toText()); // Check the DROP special class. - if (pkt->inClass("DROP")) { + if (ctx.query_->inClass("DROP")) { LOG_DEBUG(packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_DROP_CLASS2) - .arg(pkt->makeLabel(pkt->getClientId(), nullptr)) - .arg(pkt->toText()); + .arg(ctx.query_->makeLabel(ctx.query_->getClientId(), 0)) + .arg(ctx.query_->toText()); StatsMgr::instance().addValue("pkt6-receive-drop", static_cast(1)); drop = true; @@ -968,15 +976,39 @@ Dhcpv6Srv::processDhcp6Query(Pkt6Ptr query) { // Complete the client context initialization. bool drop = false; - Subnet6Ptr subnet = selectSubnet(query, drop); + ctx.subnet_ = selectSubnet(query, drop); if (drop) { // Caller will immediately drop the packet so simply return now. return (Pkt6Ptr()); } - // Park point here. + return (processLocalizedQuery6(ctx)); +} + +void +Dhcpv6Srv::processLocalizedQuery6AndSendResponse(Pkt6Ptr query, + AllocEngine::ClientContext6& ctx) { + try { + Pkt6Ptr rsp = processLocalizedQuery6(ctx); + if (!rsp) { + return; + } + + CalloutHandlePtr callout_handle = getCalloutHandle(query); + processPacketBufferSend(callout_handle, rsp); + } catch (const std::exception& e) { + LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_STD_EXCEPTION) + .arg(e.what()); + } catch (...) { + LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION); + } +} - initContext(subnet, query, ctx, drop); +Pkt6Ptr +Dhcpv6Srv::processLocalizedQuery6(AllocEngine::ClientContext6& ctx) { + Pkt6Ptr query = ctx.query_; + bool drop = false; + initContext(ctx, drop); // Stop here if initContext decided to drop the packet. if (drop) { return (Pkt6Ptr()); diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h index e44f4ad6cd..9579804490 100644 --- a/src/bin/dhcp6/dhcp6_srv.h +++ b/src/bin/dhcp6/dhcp6_srv.h @@ -175,8 +175,8 @@ class Dhcpv6Srv : public process::Daemon { /// @brief Process a single incoming DHCPv6 packet. /// - /// It verifies correctness of the passed packet, calls per-type processXXX - /// methods, generates appropriate answer. + /// It verifies correctness of the passed packet, localizes it, + /// calls per-type processXXX methods, generates appropriate answer. /// /// @param query A pointer to the packet to be processed. /// @return A pointer to the response. @@ -184,7 +184,8 @@ class Dhcpv6Srv : public process::Daemon { /// @brief Process a single incoming DHCPv6 query. /// - /// It calls per-type processXXX methods, generates appropriate answer. + /// It localizes the query, calls per-type processXXX methods, + /// generates appropriate answer. /// /// @param query A pointer to the packet to be processed. /// @return A pointer to the response. @@ -192,11 +193,29 @@ class Dhcpv6Srv : public process::Daemon { /// @brief Process a single incoming DHCPv6 query. /// + /// It localizes the query, calls per-type processXXX methods, + /// generates appropriate answer, sends the answer to the client. + /// + /// @param query A pointer to the packet to be processed. + void processDhcp6QueryAndSendResponse(Pkt6Ptr query); + + /// @brief Process a localized incoming DHCPv6 query. + /// + /// It calls per-type processXXX methods, generates appropriate answer. + /// + /// @param ctx Pointer to The client context. + /// @return A pointer to the response. + Pkt6Ptr processLocalizedQuery6(AllocEngine::ClientContext6& ctx); + + /// @brief Process a localized incoming DHCPv6 query. + /// /// It calls per-type processXXX methods, generates appropriate answer, /// sends the answer to the client. /// /// @param query A pointer to the packet to be processed. - void processDhcp6QueryAndSendResponse(Pkt6Ptr query); + /// @param ctx Pointer to The client context. + void processLocalizedQuery6AndSendResponse(Pkt6Ptr query, + AllocEngine::ClientContext6& ctx); /// @brief Instructs the server to shut down. void shutdown() override; @@ -254,6 +273,13 @@ class Dhcpv6Srv : public process::Daemon { /// Called during reconfigure and shutdown. void discardPackets(); + /// @brief Initialize client context (first part). + /// + /// @param query The query message. + /// @param ctx Reference to client context. + void initContext0(const Pkt6Ptr& query, + AllocEngine::ClientContext6& ctx); + /// @brief Initialize client context and perform early global /// reservations lookup. /// @@ -917,14 +943,9 @@ class Dhcpv6Srv : public process::Daemon { /// the Rapid Commit option was included and that the server respects /// it. /// - /// @param subnet Selected subnet. - /// @param pkt pointer to a packet for which context will be created. /// @param [out] ctx reference to context object to be initialized. /// @param [out] drop if it is true the packet will be dropped. - void initContext(const Subnet6Ptr& subnet, - const Pkt6Ptr& pkt, - AllocEngine::ClientContext6& ctx, - bool& drop); + void initContext(AllocEngine::ClientContext6& ctx, bool& drop); /// @brief this is a prefix added to the content of vendor-class option /// diff --git a/src/bin/dhcp6/tests/classify_unittests.cc b/src/bin/dhcp6/tests/classify_unittests.cc index 6d8c865142..5dbe5cb55f 100644 --- a/src/bin/dhcp6/tests/classify_unittests.cc +++ b/src/bin/dhcp6/tests/classify_unittests.cc @@ -657,25 +657,25 @@ TEST_F(ClassifyTest, matchClassification) { AllocEngine::ClientContext6 ctx1; bool drop = !srv.earlyGHRLookup(query1, ctx1); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query1, drop); + ctx1.subnet_ = srv_.selectSubnet(query1, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query1, ctx1, drop); + srv.initContext(ctx1, drop); ASSERT_FALSE(drop); Pkt6Ptr response1 = srv.processSolicit(ctx1); AllocEngine::ClientContext6 ctx2; drop = !srv.earlyGHRLookup(query2, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query2, drop); + ctx2.subnet_ = srv_.selectSubnet(query2, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query2, ctx2, drop); + srv.initContext(ctx2, drop); ASSERT_FALSE(drop); Pkt6Ptr response2 = srv.processSolicit(ctx2); AllocEngine::ClientContext6 ctx3; drop = !srv.earlyGHRLookup(query3, ctx3); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query3, drop); + ctx3.subnet_ = srv_.selectSubnet(query3, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query3, ctx3, drop); + srv.initContext(ctx3, drop); ASSERT_FALSE(drop); Pkt6Ptr response3 = srv.processSolicit(ctx3); @@ -775,25 +775,25 @@ TEST_F(ClassifyTest, required) { AllocEngine::ClientContext6 ctx1; bool drop = !srv.earlyGHRLookup(query1, ctx1); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query1, drop); + ctx1.subnet_ = srv_.selectSubnet(query1, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query1, ctx1, drop); + srv.initContext(ctx1, drop); ASSERT_FALSE(drop); Pkt6Ptr response1 = srv.processSolicit(ctx1); AllocEngine::ClientContext6 ctx2; drop = !srv.earlyGHRLookup(query2, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query2, drop); + ctx2.subnet_ = srv_.selectSubnet(query2, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query2, ctx2, drop); + srv.initContext(ctx2, drop); ASSERT_FALSE(drop); Pkt6Ptr response2 = srv.processSolicit(ctx2); AllocEngine::ClientContext6 ctx3; drop = !srv.earlyGHRLookup(query3, ctx3); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query3, drop); + ctx3.subnet_ = srv_.selectSubnet(query3, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query3, ctx3, drop); + srv.initContext(ctx3, drop); ASSERT_FALSE(drop); Pkt6Ptr response3 = srv.processSolicit(ctx3); @@ -890,25 +890,25 @@ TEST_F(ClassifyTest, requiredClassification) { AllocEngine::ClientContext6 ctx1; bool drop = !srv.earlyGHRLookup(query1, ctx1); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query1, drop); + ctx1.subnet_ = srv_.selectSubnet(query1, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query1, ctx1, drop); + srv.initContext(ctx1, drop); ASSERT_FALSE(drop); Pkt6Ptr response1 = srv.processSolicit(ctx1); AllocEngine::ClientContext6 ctx2; drop = !srv.earlyGHRLookup(query2, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query2, drop); + ctx2.subnet_ = srv_.selectSubnet(query2, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query2, ctx2, drop); + srv.initContext(ctx2, drop); ASSERT_FALSE(drop); Pkt6Ptr response2 = srv.processSolicit(ctx2); AllocEngine::ClientContext6 ctx3; drop = !srv.earlyGHRLookup(query3, ctx3); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query3, drop); + ctx3.subnet_ = srv_.selectSubnet(query3, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query3, ctx3, drop); + srv.initContext(ctx3, drop); ASSERT_FALSE(drop); Pkt6Ptr response3 = srv.processSolicit(ctx3); @@ -988,9 +988,9 @@ TEST_F(ClassifyTest, subnetClassPriority) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(query, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query, drop); + ctx.subnet_ = srv_.selectSubnet(query, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr response = srv.processSolicit(ctx); @@ -1057,9 +1057,9 @@ TEST_F(ClassifyTest, subnetGlobalPriority) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(query, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query, drop); + ctx.subnet_ = srv_.selectSubnet(query, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr response = srv.processSolicit(ctx); @@ -1135,9 +1135,9 @@ TEST_F(ClassifyTest, classGlobalPriority) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(query, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query, drop); + ctx.subnet_ = srv_.selectSubnet(query, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr response = srv.processSolicit(ctx); @@ -1208,9 +1208,9 @@ TEST_F(ClassifyTest, classGlobalPersistency) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(query, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query, drop); + ctx.subnet_ = srv_.selectSubnet(query, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr response = srv.processSolicit(ctx); @@ -1280,9 +1280,9 @@ TEST_F(ClassifyTest, classNeverSend) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(query, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query, drop); + ctx.subnet_ = srv_.selectSubnet(query, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr response = srv.processSolicit(ctx); @@ -1402,9 +1402,9 @@ TEST_F(ClassifyTest, clientClassifyPool) { AllocEngine::ClientContext6 ctx1; bool drop = !srv.earlyGHRLookup(query1, ctx1); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query1, drop); + ctx1.subnet_ = srv_.selectSubnet(query1, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query1, ctx1, drop); + srv.initContext(ctx1, drop); ASSERT_FALSE(drop); Pkt6Ptr response1 = srv.processSolicit(ctx1); ASSERT_TRUE(response1); @@ -1420,9 +1420,9 @@ TEST_F(ClassifyTest, clientClassifyPool) { AllocEngine::ClientContext6 ctx2; drop = !srv.earlyGHRLookup(query2, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query2, drop); + ctx2.subnet_ = srv_.selectSubnet(query2, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query2, ctx2, drop); + srv.initContext(ctx2, drop); ASSERT_FALSE(drop); Pkt6Ptr response2 = srv.processSolicit(ctx2); ASSERT_TRUE(response2); @@ -1438,9 +1438,9 @@ TEST_F(ClassifyTest, clientClassifyPool) { AllocEngine::ClientContext6 ctx3; drop = !srv.earlyGHRLookup(query3, ctx3); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query3, drop); + ctx3.subnet_ = srv_.selectSubnet(query3, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query3, ctx3, drop); + srv.initContext(ctx3, drop); ASSERT_FALSE(drop); Pkt6Ptr response3 = srv.processSolicit(ctx3); ASSERT_TRUE(response3); @@ -1498,9 +1498,9 @@ TEST_F(ClassifyTest, clientClassifyPoolKnown) { AllocEngine::ClientContext6 ctx1; bool drop = !srv.earlyGHRLookup(query1, ctx1); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query1, drop); + ctx1.subnet_ = srv_.selectSubnet(query1, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query1, ctx1, drop); + srv.initContext(ctx1, drop); ASSERT_FALSE(drop); Pkt6Ptr response1 = srv.processSolicit(ctx1); ASSERT_TRUE(response1); @@ -1530,9 +1530,9 @@ TEST_F(ClassifyTest, clientClassifyPoolKnown) { AllocEngine::ClientContext6 ctx2; drop = !srv.earlyGHRLookup(query2, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query2, drop); + ctx2.subnet_ = srv_.selectSubnet(query2, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query2, ctx2, drop); + srv.initContext(ctx2, drop); ASSERT_FALSE(drop); Pkt6Ptr response2 = srv.processSolicit(ctx2); ASSERT_TRUE(response2); @@ -1833,25 +1833,25 @@ TEST_F(ClassifyTest, member) { AllocEngine::ClientContext6 ctx1; bool drop = !srv.earlyGHRLookup(query1, ctx1); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(query1, drop); + ctx1.subnet_ = srv_.selectSubnet(query1, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query1, ctx1, drop); + srv.initContext(ctx1, drop); ASSERT_FALSE(drop); Pkt6Ptr response1 = srv.processSolicit(ctx1); AllocEngine::ClientContext6 ctx2; drop = !srv.earlyGHRLookup(query2, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query2, drop); + ctx2.subnet_ = srv_.selectSubnet(query2, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query2, ctx2, drop); + srv.initContext(ctx2, drop); ASSERT_FALSE(drop); Pkt6Ptr response2 = srv.processSolicit(ctx2); AllocEngine::ClientContext6 ctx3; drop = !srv.earlyGHRLookup(query3, ctx3); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(query3, drop); + ctx3.subnet_ = srv_.selectSubnet(query3, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, query3, ctx3, drop); + srv.initContext(ctx3, drop); ASSERT_FALSE(drop); Pkt6Ptr response3 = srv.processSolicit(ctx3); diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index a0bac4688a..1e0d43e4b8 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc @@ -399,9 +399,9 @@ TEST_F(NakedDhcpv6SrvTest, SolicitNoSubnet) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -628,9 +628,9 @@ TEST_F(Dhcpv6SrvTest, advertiseOptions) { AllocEngine::ClientContext6 ctx; bool drop = !srv_.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(sol, drop); + ctx.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx, drop); + srv_.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_.processSolicit(ctx); @@ -659,9 +659,9 @@ TEST_F(Dhcpv6SrvTest, advertiseOptions) { AllocEngine::ClientContext6 ctx2; drop = !srv_.earlyGHRLookup(sol, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(sol, drop); + ctx2.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx2, drop); + srv_.initContext(ctx2, drop); ASSERT_FALSE(drop); adv = srv_.processSolicit(ctx2); ASSERT_TRUE(adv); @@ -727,9 +727,9 @@ TEST_F(Dhcpv6SrvTest, SolicitBasic) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -778,9 +778,9 @@ TEST_F(Dhcpv6SrvTest, pdSolicitBasic) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -823,9 +823,9 @@ TEST_F(Dhcpv6SrvTest, defaultLifetimeSolicit) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -873,9 +873,9 @@ TEST_F(Dhcpv6SrvTest, hintZeroLifetimeSolicit) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -925,9 +925,9 @@ TEST_F(Dhcpv6SrvTest, hintLifetimeSolicit) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -975,9 +975,9 @@ TEST_F(Dhcpv6SrvTest, minLifetimeSolicit) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -1027,9 +1027,9 @@ TEST_F(Dhcpv6SrvTest, maxLifetimeSolicit) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -1089,9 +1089,9 @@ TEST_F(Dhcpv6SrvTest, SolicitHint) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -1150,9 +1150,9 @@ TEST_F(Dhcpv6SrvTest, SolicitInvalidHint) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -1218,25 +1218,25 @@ TEST_F(Dhcpv6SrvTest, ManySolicits) { AllocEngine::ClientContext6 ctx1; bool drop = !srv.earlyGHRLookup(sol1, ctx1); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol1, drop); + ctx1.subnet_ = srv.selectSubnet(sol1, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol1, ctx1, drop); + srv.initContext(ctx1, drop); ASSERT_FALSE(drop); Pkt6Ptr reply1 = srv.processSolicit(ctx1); AllocEngine::ClientContext6 ctx2; drop = !srv.earlyGHRLookup(sol2, ctx2); ASSERT_FALSE(drop); - subnet = srv.selectSubnet(sol2, drop); + ctx2.subnet_ = srv.selectSubnet(sol2, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol2, ctx2, drop); + srv.initContext(ctx2, drop); ASSERT_FALSE(drop); Pkt6Ptr reply2 = srv.processSolicit(ctx2); AllocEngine::ClientContext6 ctx3; drop = !srv.earlyGHRLookup(sol3, ctx3); ASSERT_FALSE(drop); - subnet = srv.selectSubnet(sol3, drop); + ctx3.subnet_ = srv.selectSubnet(sol3, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol3, ctx3, drop); + srv.initContext(ctx3, drop); ASSERT_FALSE(drop); Pkt6Ptr reply3 = srv.processSolicit(ctx3); @@ -1326,9 +1326,9 @@ TEST_F(Dhcpv6SrvTest, SolicitCache) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -1400,9 +1400,9 @@ TEST_F(Dhcpv6SrvTest, pdSolicitCache) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); @@ -1697,9 +1697,9 @@ TEST_F(Dhcpv6SrvTest, RequestCache) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(req, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(req, drop); + ctx.subnet_ = srv.selectSubnet(req, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, req, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processRequest(ctx); @@ -1771,9 +1771,9 @@ TEST_F(Dhcpv6SrvTest, pdRequestCache) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(req, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(req, drop); + ctx.subnet_ = srv.selectSubnet(req, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, req, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processRequest(ctx); @@ -1987,9 +1987,9 @@ TEST_F(Dhcpv6SrvTest, RenewCache) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(req, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(req, drop); + ctx.subnet_ = srv.selectSubnet(req, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, req, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processRenew(ctx); @@ -2061,9 +2061,9 @@ TEST_F(Dhcpv6SrvTest, pdRenewCache) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(req, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(req, drop); + ctx.subnet_ = srv.selectSubnet(req, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, req, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processRenew(ctx); @@ -3005,9 +3005,9 @@ TEST_F(Dhcpv6SrvTest, prlPersistency) { AllocEngine::ClientContext6 ctx; bool drop = !srv_.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(sol, drop); + ctx.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx, drop); + srv_.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr response = srv_.processSolicit(ctx); @@ -3028,9 +3028,9 @@ TEST_F(Dhcpv6SrvTest, prlPersistency) { AllocEngine::ClientContext6 ctx2; drop = !srv_.earlyGHRLookup(sol, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(sol, drop); + ctx2.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx2, drop); + srv_.initContext(ctx2, drop); ASSERT_FALSE(drop); response = srv_.processSolicit(ctx2); @@ -3052,9 +3052,9 @@ TEST_F(Dhcpv6SrvTest, prlPersistency) { AllocEngine::ClientContext6 ctx3; drop = !srv_.earlyGHRLookup(sol, ctx3); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(sol, drop); + ctx3.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx3, drop); + srv_.initContext(ctx3, drop); ASSERT_FALSE(drop); response = srv_.processSolicit(ctx3); @@ -3094,9 +3094,9 @@ TEST_F(Dhcpv6SrvTest, neverSend) { AllocEngine::ClientContext6 ctx; bool drop = !srv_.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(sol, drop); + ctx.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx, drop); + srv_.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr response = srv_.processSolicit(ctx); @@ -3117,9 +3117,9 @@ TEST_F(Dhcpv6SrvTest, neverSend) { AllocEngine::ClientContext6 ctx2; drop = !srv_.earlyGHRLookup(sol, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(sol, drop); + ctx2.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx2, drop); + srv_.initContext(ctx2, drop); ASSERT_FALSE(drop); response = srv_.processSolicit(ctx2); @@ -3141,9 +3141,9 @@ TEST_F(Dhcpv6SrvTest, neverSend) { AllocEngine::ClientContext6 ctx3; drop = !srv_.earlyGHRLookup(sol, ctx3); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(sol, drop); + ctx3.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx3, drop); + srv_.initContext(ctx3, drop); ASSERT_FALSE(drop); response = srv_.processSolicit(ctx3); @@ -3924,9 +3924,9 @@ TEST_F(Dhcpv6SrvTest, calculateTeeTimers) { AllocEngine::ClientContext6 ctx; bool drop = !srv.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv.selectSubnet(sol, drop); + ctx.subnet_ = srv.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv.initContext(subnet, sol, ctx, drop); + srv.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr reply = srv.processSolicit(ctx); diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.h b/src/bin/dhcp6/tests/dhcp6_test_utils.h index 51965255eb..68b6645623 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.h +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.h @@ -218,11 +218,11 @@ class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { if (drop) { return (Pkt6Ptr()); } - Subnet6Ptr subnet = selectSubnet(solicit, drop); + ctx.subnet_ = selectSubnet(solicit, drop); if (drop) { return (Pkt6Ptr()); } - initContext(subnet, solicit, ctx, drop); + initContext(ctx, drop); if (drop) { return (Pkt6Ptr()); } @@ -239,11 +239,11 @@ class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { if (drop) { return (Pkt6Ptr()); } - Subnet6Ptr subnet = selectSubnet(request, drop); + ctx.subnet_ = selectSubnet(request, drop); if (drop) { return (Pkt6Ptr()); } - initContext(subnet, request, ctx, drop); + initContext(ctx, drop); if (drop) { return (Pkt6Ptr()); } @@ -260,11 +260,11 @@ class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { if (drop) { return (Pkt6Ptr()); } - Subnet6Ptr subnet = selectSubnet(renew, drop); + ctx.subnet_ = selectSubnet(renew, drop); if (drop) { return (Pkt6Ptr()); } - initContext(subnet, renew, ctx, drop); + initContext(ctx, drop); if (drop) { return (Pkt6Ptr()); } @@ -281,11 +281,11 @@ class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { if (drop) { return (Pkt6Ptr()); } - Subnet6Ptr subnet = selectSubnet(rebind, drop); + ctx.subnet_ = selectSubnet(rebind, drop); if (drop) { return (Pkt6Ptr()); } - initContext(subnet, rebind, ctx, drop); + initContext(ctx, drop); if (drop) { return (Pkt6Ptr()); } @@ -302,11 +302,11 @@ class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { if (drop) { return (Pkt6Ptr()); } - Subnet6Ptr subnet = selectSubnet(release, drop); + ctx.subnet_ = selectSubnet(release, drop); if (drop) { return (Pkt6Ptr()); } - initContext(subnet, release, ctx, drop); + initContext(ctx, drop); if (drop) { return (Pkt6Ptr()); } @@ -323,11 +323,11 @@ class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { if (drop) { return (Pkt6Ptr()); } - Subnet6Ptr subnet = selectSubnet(decline, drop); + ctx.subnet_ = selectSubnet(decline, drop); if (drop) { return (Pkt6Ptr()); } - initContext(subnet, decline, ctx, drop); + initContext(ctx, drop); if (drop) { return (Pkt6Ptr()); } diff --git a/src/bin/dhcp6/tests/fqdn_unittest.cc b/src/bin/dhcp6/tests/fqdn_unittest.cc index 18054a4d0b..5dc089277d 100644 --- a/src/bin/dhcp6/tests/fqdn_unittest.cc +++ b/src/bin/dhcp6/tests/fqdn_unittest.cc @@ -458,9 +458,9 @@ class FqdnDhcpv6SrvTest : public Dhcpv6SrvTest { AllocEngine::ClientContext6 ctx; bool drop = !srv_->earlyGHRLookup(query, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_->selectSubnet(query, drop); + ctx.subnet_ = srv_->selectSubnet(query, drop); ASSERT_FALSE(drop); - srv_->initContext(subnet, query, ctx, drop); + srv_->initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr answer = generateMessageWithIds(DHCPV6_ADVERTISE); @@ -522,9 +522,9 @@ class FqdnDhcpv6SrvTest : public Dhcpv6SrvTest { AllocEngine::ClientContext6 ctx; bool drop = !srv_->earlyGHRLookup(req, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_->selectSubnet(req, drop); + ctx.subnet_ = srv_->selectSubnet(req, drop); ASSERT_FALSE(drop); - srv_->initContext(subnet, req, ctx, drop); + srv_->initContext(ctx, drop); ASSERT_FALSE(drop); if (msg_type == DHCPV6_SOLICIT) { diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index b8fed7db3f..20ef2abcb8 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/src/bin/dhcp6/tests/hooks_unittest.cc @@ -1745,9 +1745,9 @@ TEST_F(HooksDhcpv6SrvTest, subnet6SelectSimple) { AllocEngine::ClientContext6 ctx; bool drop = !srv_->earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_->selectSubnet(sol, drop); + ctx.subnet_ = srv_->selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_->initContext(subnet, sol, ctx, drop); + srv_->initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_->processSolicit(ctx); @@ -1836,9 +1836,9 @@ TEST_F(HooksDhcpv6SrvTest, subnet6SelectChange) { AllocEngine::ClientContext6 ctx; bool drop = !srv_->earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_->selectSubnet(sol, drop); + ctx.subnet_ = srv_->selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_->initContext(subnet, sol, ctx, drop); + srv_->initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_->processSolicit(ctx); @@ -5395,9 +5395,9 @@ TEST_F(HooksDhcpv6SrvTest, host6Identifier) { AllocEngine::ClientContext6 ctx; bool drop = !srv_->earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_->selectSubnet(sol, drop); + ctx.subnet_ = srv_->selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_->initContext(subnet, sol, ctx, drop); + srv_->initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_->processSolicit(ctx); @@ -5481,9 +5481,9 @@ TEST_F(HooksDhcpv6SrvTest, host6IdentifierHWAddr) { AllocEngine::ClientContext6 ctx; bool drop = !srv_->earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_->selectSubnet(sol, drop); + ctx.subnet_ = srv_->selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_->initContext(subnet, sol, ctx, drop); + srv_->initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_->processSolicit(ctx); diff --git a/src/bin/dhcp6/tests/vendor_opts_unittest.cc b/src/bin/dhcp6/tests/vendor_opts_unittest.cc index 664e5e1d20..4bdb5b9bcb 100644 --- a/src/bin/dhcp6/tests/vendor_opts_unittest.cc +++ b/src/bin/dhcp6/tests/vendor_opts_unittest.cc @@ -178,9 +178,9 @@ class VendorOptsTest : public Dhcpv6SrvTest { AllocEngine::ClientContext6 ctx; bool drop = !srv_.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(sol, drop); + ctx.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx, drop); + srv_.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_.processSolicit(ctx); @@ -208,9 +208,9 @@ class VendorOptsTest : public Dhcpv6SrvTest { AllocEngine::ClientContext6 ctx2; drop = !srv_.earlyGHRLookup(sol, ctx2); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(sol, drop); + ctx2.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx2, drop); + srv_.initContext(ctx2, drop); ASSERT_FALSE(drop); adv = srv_.processSolicit(ctx2); ASSERT_TRUE(adv); @@ -448,9 +448,9 @@ class VendorOptsTest : public Dhcpv6SrvTest { AllocEngine::ClientContext6 ctx; bool drop = !srv_.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(sol, drop); + ctx.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx, drop); + srv_.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_.processSolicit(ctx); @@ -686,9 +686,9 @@ class VendorOptsTest : public Dhcpv6SrvTest { AllocEngine::ClientContext6 ctx; bool drop = !srv_.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(sol, drop); + ctx.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx, drop); + srv_.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_.processSolicit(ctx); @@ -1391,9 +1391,9 @@ TEST_F(VendorOptsTest, vendorNeverSend) { AllocEngine::ClientContext6 ctx; bool drop = !srv_.earlyGHRLookup(sol, ctx); ASSERT_FALSE(drop); - Subnet6Ptr subnet = srv_.selectSubnet(sol, drop); + ctx.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx, drop); + srv_.initContext(ctx, drop); ASSERT_FALSE(drop); Pkt6Ptr adv = srv_.processSolicit(ctx); @@ -1417,9 +1417,9 @@ TEST_F(VendorOptsTest, vendorNeverSend) { AllocEngine::ClientContext6 ctx3; drop = !srv_.earlyGHRLookup(sol, ctx3); ASSERT_FALSE(drop); - subnet = srv_.selectSubnet(sol, drop); + ctx3.subnet_ = srv_.selectSubnet(sol, drop); ASSERT_FALSE(drop); - srv_.initContext(subnet, sol, ctx3, drop); + srv_.initContext(ctx3, drop); ASSERT_FALSE(drop); adv = srv_.processSolicit(ctx3); ASSERT_TRUE(adv);