From: Francis Dupont Date: Wed, 2 Oct 2024 07:45:59 +0000 (+0200) Subject: [#3590] Checkpoint: reversed required order X-Git-Tag: Kea-2.7.4~103 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=069f1520c925a3479d7f7bd44dca5f839decceb8;p=thirdparty%2Fkea.git [#3590] Checkpoint: reversed required order --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 6fe52144d8..107874f12b 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -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 diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 3813ecf11c..6df6460603 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -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