Skip to content

Commit 5ddcb44

Browse files
authored
[nat64-translator] ensure expired mappings are released in timer callback (openthread#11139)
This commit fixes the release of expired mappings by ensuring that `ReleaseExpiredMappings()` is always called from the timer callback `HandleMappingExpirerTimer()`, regardless of the logging level. Previously, `ReleaseExpiredMappings()` was called as an input to `LogInfo()`, which could become an empty macro (ignoring its input) if info-level logs were disabled.
1 parent 5447ab8 commit 5ddcb44

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/core/net/nat64_translator.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,13 @@ void Translator::ClearNat64Prefix(void)
552552

553553
void Translator::HandleMappingExpirerTimer(void)
554554
{
555-
LogInfo("Released %d expired mappings", ReleaseExpiredMappings());
555+
uint16_t numReleased = ReleaseExpiredMappings();
556+
557+
LogInfo("Released %u expired mappings", numReleased);
558+
556559
mMappingExpirerTimer.Start(kAddressMappingIdleTimeoutMsec);
560+
561+
OT_UNUSED_VARIABLE(numReleased);
557562
}
558563

559564
void Translator::InitAddressMappingIterator(AddressMappingIterator &aIterator)

0 commit comments

Comments
 (0)