From: Razvan Becheriu Date: Thu, 16 Oct 2025 08:52:30 +0000 (+0300) Subject: [#4164] fixed data race in ping check X-Git-Tag: Kea-3.1.3~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41c008bd6d4cc489fe340da7f372581b88019ccf;p=thirdparty%2Fkea.git [#4164] fixed data race in ping check --- diff --git a/src/hooks/dhcp/ping_check/ping_check_mgr.cc b/src/hooks/dhcp/ping_check/ping_check_mgr.cc index 08cae08693..9ad95b239b 100644 --- a/src/hooks/dhcp/ping_check/ping_check_mgr.cc +++ b/src/hooks/dhcp/ping_check/ping_check_mgr.cc @@ -203,6 +203,8 @@ PingCheckMgr::sendCompleted(const ICMPMsgPtr& echo, bool send_failed) { } try { + MultiThreadingLock lock(*mutex_); + if (!echo) { isc_throw(BadValue, "PingCheckMgr::sendCompleted() - echo is empty"); } @@ -230,7 +232,7 @@ PingCheckMgr::sendCompleted(const ICMPMsgPtr& echo, bool send_failed) { } // Update the expiration timer if necessary. - setNextExpiration(); + setNextExpirationInternal(); } catch (const std::exception& ex) { LOG_ERROR(ping_check_logger, PING_CHECK_MGR_SEND_COMPLETED_ERROR) .arg(ex.what()); @@ -244,6 +246,8 @@ PingCheckMgr::replyReceived(const ICMPMsgPtr& reply) { } try { + MultiThreadingLock lock(*mutex_); + if (!reply) { isc_throw(BadValue, "PingCheckMgr::replyReceived() - echo is empty"); } @@ -261,7 +265,7 @@ PingCheckMgr::replyReceived(const ICMPMsgPtr& reply) { return; } - setNextExpiration(); + setNextExpirationInternal(); } catch (const std::exception& ex) { LOG_ERROR(ping_check_logger, PING_CHECK_MGR_REPLY_RECEIVED_ERROR) .arg(ex.what());