From fb243cb4e27f7be83146d2cce557c12c68f0a02b Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Fri, 14 Apr 2023 10:29:59 +0200 Subject: [PATCH] [#2780] Fixed a crash in the FLQ tests --- src/lib/dhcpsrv/tests/flq_allocator_unittest.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc b/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc index 15c021b59a..5e60cf81b2 100644 --- a/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc +++ b/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc @@ -26,13 +26,13 @@ public: /// @brief Creates a DHCPv4 lease for an address and MAC address. /// /// @param address Lease address. - /// @param hw_address_seed a seed from which the MAC address is generated. + /// @param hw_address_seed a seed from which the hardware address is generated. /// @return Created lease pointer. Lease4Ptr createLease4(const IOAddress& address, uint64_t hw_address_seed) const { - vector hw_address_vec(6); + vector hw_address_vec(sizeof(hw_address_seed)); for (auto i = 0; i < sizeof(hw_address_seed); ++i) { - hw_address_vec[i] = hw_address_seed >> sizeof(hw_address_seed-1-i) & 0xFF; + hw_address_vec[i] = (hw_address_seed >> i) & 0xFF; } auto hw_address = boost::make_shared(hw_address_vec, HTYPE_ETHER); auto lease = boost::make_shared(address, hw_address, ClientIdPtr(), @@ -343,7 +343,7 @@ public: createLease6(Lease::Type type, const IOAddress& address, uint64_t duid_seed) const { vector duid_vec(sizeof(duid_seed)); for (auto i = 0; i < sizeof(duid_seed); ++i) { - duid_vec[i] = duid_seed >> sizeof(duid_seed-1-i) & 0xFF; + duid_vec[i] = (duid_seed >> i) & 0xFF; } auto duid = boost::make_shared(duid_vec); auto lease = boost::make_shared(type, address, duid, 1, 1800, -- 2.47.2