From: Razvan Becheriu Date: Wed, 9 Jul 2025 04:24:38 +0000 (+0300) Subject: [#4001] backport #3910 to v2_6 X-Git-Tag: Kea-2.6.4~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3960b1d93546176fa16a7406e9c2fe60b96a67e4;p=thirdparty%2Fkea.git [#4001] backport #3910 to v2_6 --- diff --git a/ChangeLog b/ChangeLog index edd243261a..872c3b9916 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2368. [bug] razvan + Fix error handling when detecting a global reservation for the + client and global reservatons are explicitly disabled in the + configuration. + (Gitlab #4001) + Kea 2.6.3 (stable) released on May 28, 2025 2267. [build] andrei diff --git a/src/bin/dhcp4/tests/classify_unittest.cc b/src/bin/dhcp4/tests/classify_unittest.cc index b8c06c9f84..a6112e2a48 100644 --- a/src/bin/dhcp4/tests/classify_unittest.cc +++ b/src/bin/dhcp4/tests/classify_unittest.cc @@ -112,7 +112,7 @@ namespace { /// - 2 subnets: 10.0.0.0/24 guarded by first and 10.0.1.0/24 /// - 2 pools: 10.0.0.10-10.0.0.100 and 10.0.1.10-10.0.1.100 /// - 1 global reservation for HW address 'aa:bb:cc:dd:ee:ff' -/// setting the first class +/// with IP address outside the pool, setting the first class /// - the following class defined: first /// /// - Configuration 9: @@ -412,6 +412,7 @@ const char* CONFIGS[] = { "}]," "\"reservations\": [ {" " \"hw-address\": \"aa:bb:cc:dd:ee:ff\"," + " \"ip-address\": \"10.0.1.200\"," " \"client-classes\": [ \"first\" ] } ]" "}", diff --git a/src/bin/dhcp6/tests/classify_unittests.cc b/src/bin/dhcp6/tests/classify_unittests.cc index 85b1ef7e92..b5a9378837 100644 --- a/src/bin/dhcp6/tests/classify_unittests.cc +++ b/src/bin/dhcp6/tests/classify_unittests.cc @@ -98,7 +98,8 @@ namespace { /// - Used for the early global reservations lookup / select subnet. /// - 2 subnets: 2001:db8:1::/48 (guarded) and 2001:db8:2::/48 /// - 2 pools: 2001:db8:1:1::/64 and 2001:db8:2:1::/64 -/// - 1 global reservation setting the first class +/// - 1 global reservation with IP address outside the pool, setting +/// the first class /// - the following class defined: first /// /// - Configuration 7: @@ -416,6 +417,7 @@ const char* CONFIGS[] = { "\"reservations\": [" "{" " \"duid\": \"01:02:03:04\"," + " \"ip-addresses\": [ \"2001:db8:1:cafe::1\" ]," " \"client-classes\": [ \"first\" ]" "}" "]," diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 1e600c7b7d..d2b7513af5 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -3466,7 +3466,7 @@ hasAddressReservation(AllocEngine::ClientContext4& ctx) { LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE, ALLOC_ENGINE_IGNORING_UNSUITABLE_GLOBAL_ADDRESS) .arg(ctx.query_->getLabel()) - .arg(ctx.currentHost()->getIPv4Reservation().toText()) + .arg(global_host_address.toText()) .arg(AllocEngine::labelNetworkOrSubnet(ctx.subnet_)); }