]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5307] DHCPv6 server uses reserved client classes in shared network case.
authorMarcin Siodelski <marcin@isc.org>
Thu, 21 Sep 2017 07:39:19 +0000 (09:39 +0200)
committerMarcin Siodelski <marcin@isc.org>
Thu, 21 Sep 2017 08:59:21 +0000 (10:59 +0200)
src/bin/dhcp6/dhcp6_srv.cc
src/bin/dhcp6/tests/shared_network_unittest.cc

index c15c87c2f851cf37c43ba310047cab36e53f30fa..9c90bc92d306f1b632ec55c9a56363adcc6fb6df 100644 (file)
@@ -912,10 +912,12 @@ Dhcpv6Srv::buildCfgOptionList(const Pkt6Ptr& question,
             // Skip it
             continue;
         }
+
         if (ccdef->getCfgOption()->empty()) {
             // Skip classes which don't configure options
             continue;
         }
+
         co_list.push_back(ccdef->getCfgOption());
     }
 
@@ -2441,7 +2443,6 @@ Dhcpv6Srv::processSolicit(const Pkt6Ptr& solicit) {
     // Let's create a simplified client context here.
     AllocEngine::ClientContext6 ctx;
     initContext(solicit, ctx);
-    setReservedClientClasses(solicit, ctx);
 
     Pkt6Ptr response(new Pkt6(DHCPV6_ADVERTISE, solicit->getTransid()));
 
@@ -2463,6 +2464,8 @@ Dhcpv6Srv::processSolicit(const Pkt6Ptr& solicit) {
     processClientFqdn(solicit, response, ctx);
     assignLeases(solicit, response, ctx);
 
+    setReservedClientClasses(solicit, ctx);
+
     copyClientOptions(solicit, response);
     CfgOptionList co_list;
     buildCfgOptionList(solicit, ctx, co_list);
@@ -2489,13 +2492,14 @@ Dhcpv6Srv::processRequest(const Pkt6Ptr& request) {
     // Let's create a simplified client context here.
     AllocEngine::ClientContext6 ctx;
     initContext(request, ctx);
-    setReservedClientClasses(request, ctx);
 
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, request->getTransid()));
 
     processClientFqdn(request, reply, ctx);
     assignLeases(request, reply, ctx);
 
+    setReservedClientClasses(request, ctx);
+
     copyClientOptions(request, reply);
     CfgOptionList co_list;
     buildCfgOptionList(request, ctx, co_list);
@@ -2518,13 +2522,14 @@ Dhcpv6Srv::processRenew(const Pkt6Ptr& renew) {
     // Let's create a simplified client context here.
     AllocEngine::ClientContext6 ctx;
     initContext(renew, ctx);
-    setReservedClientClasses(renew, ctx);
 
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, renew->getTransid()));
 
     processClientFqdn(renew, reply, ctx);
     extendLeases(renew, reply, ctx);
 
+    setReservedClientClasses(renew, ctx);
+
     copyClientOptions(renew, reply);
     CfgOptionList co_list;
     buildCfgOptionList(renew, ctx, co_list);
@@ -2547,13 +2552,14 @@ Dhcpv6Srv::processRebind(const Pkt6Ptr& rebind) {
     // Let's create a simplified client context here.
     AllocEngine::ClientContext6 ctx;
     initContext(rebind, ctx);
-    setReservedClientClasses(rebind, ctx);
 
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, rebind->getTransid()));
 
     processClientFqdn(rebind, reply, ctx);
     extendLeases(rebind, reply, ctx);
 
+    setReservedClientClasses(rebind, ctx);
+
     copyClientOptions(rebind, reply);
     CfgOptionList co_list;
     buildCfgOptionList(rebind, ctx, co_list);
index bfcbf1f0c51b67f1aa4b4b63a859ceb94b801e97..9a60fad10f5a8413077ace091f72c09b78ee9018 100644 (file)
@@ -1097,6 +1097,7 @@ TEST_F(Dhcpv6SharedNetworkTest, variousFieldsInReservation) {
     client.setInterface("eth1");
     client.setDUID("00:03:00:01:11:22:33:44:55:66");
     ASSERT_NO_THROW(client.requestAddress(0xabcd));
+    ASSERT_NO_THROW(client.requestOption(D6O_NAME_SERVERS));
 
     ASSERT_NO_THROW(client.useFQDN(Option6ClientFqdn::FLAG_S,
                                    "bird.example.org",