]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3590] Checkpoint: reversed required order
authorFrancis Dupont <fdupont@isc.org>
Wed, 2 Oct 2024 07:45:59 +0000 (09:45 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 7 Oct 2024 13:06:40 +0000 (15:06 +0200)
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp6/dhcp6_srv.cc

index 6fe52144d8739413cc26ca2289ad95fd13159e14..107874f12b5b8b7488bd733832bc4406f697b489 100644 (file)
@@ -4824,23 +4824,9 @@ void Dhcpv4Srv::requiredClassify(Dhcpv4Exchange& ex) {
     Subnet4Ptr subnet = ex.getContext()->subnet_;
 
     if (subnet) {
-        // Begin by the shared-network
-        SharedNetwork4Ptr network;
-        subnet->getSharedNetwork(network);
-        if (network) {
-            const ClientClasses& to_add = network->getRequiredClasses();
-            for (auto const& cclass : to_add) {
-                classes.insert(cclass);
-            }
-        }
-
-        // Followed by the subnet
-        const ClientClasses& to_add = subnet->getRequiredClasses();
-        for (auto const& cclass : to_add) {
-            classes.insert(cclass);
-        }
+        // host reservation???
 
-        // And finish by the pool
+        // Begin by the pool
         Pkt4Ptr resp = ex.getResponse();
         IOAddress addr = IOAddress::IPV4_ZERO_ADDRESS();
         if (resp) {
@@ -4856,7 +4842,21 @@ void Dhcpv4Srv::requiredClassify(Dhcpv4Exchange& ex) {
             }
         }
 
-        // host reservation???
+        // Followed by the subnet
+        const ClientClasses& to_add = subnet->getRequiredClasses();
+        for (auto const& cclass : to_add) {
+            classes.insert(cclass);
+        }
+
+        // And finish by the shared-network
+        SharedNetwork4Ptr network;
+        subnet->getSharedNetwork(network);
+        if (network) {
+            const ClientClasses& net_to_add = network->getRequiredClasses();
+            for (auto const& cclass : net_to_add) {
+                classes.insert(cclass);
+            }
+        }
     }
 
     // Run match expressions
index 3813ecf11c68a5d3c0097e592f09775be792231c..6df646060387f81c094a651f2cc3bfb05557e6a5 100644 (file)
@@ -4454,23 +4454,9 @@ Dhcpv6Srv::requiredClassify(const Pkt6Ptr& pkt, AllocEngine::ClientContext6& ctx
     Subnet6Ptr subnet = ctx.subnet_;
 
     if (subnet) {
-        // Begin by the shared-network
-        SharedNetwork6Ptr network;
-        subnet->getSharedNetwork(network);
-        if (network) {
-            const ClientClasses& to_add = network->getRequiredClasses();
-            for (auto const& cclass : to_add) {
-                classes.insert(cclass);
-            }
-        }
-
-        // Followed by the subnet
-        const ClientClasses& to_add = subnet->getRequiredClasses();
-        for (auto const& cclass : to_add) {
-            classes.insert(cclass);
-        }
+        // host reservation???
 
-        // And finish by pools
+        // Begin by pools
         for (auto const& resource : ctx.allocated_resources_) {
             PoolPtr pool =
                 ctx.subnet_->getPool(resource.getPrefixLength() == 128 ?
@@ -4485,7 +4471,21 @@ Dhcpv6Srv::requiredClassify(const Pkt6Ptr& pkt, AllocEngine::ClientContext6& ctx
             }
         }
 
-        // host reservation???
+        // Followed by the subnet
+        const ClientClasses& to_add = subnet->getRequiredClasses();
+        for (auto const& cclass : to_add) {
+            classes.insert(cclass);
+        }
+
+        // And finish by the shared-network
+        SharedNetwork6Ptr network;
+        subnet->getSharedNetwork(network);
+        if (network) {
+            const ClientClasses& net_to_add = network->getRequiredClasses();
+            for (auto const& cclass : net_to_add) {
+                classes.insert(cclass);
+            }
+        }
     }
 
     // Run match expressions