From 42ccf281fbca6bd7ca5b531b9e4debc760f866f2 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Mon, 6 May 2024 12:18:06 -0700 Subject: [PATCH] [routing-manager] ensure correct handling of shorter PD prefix (#10145) This commit corrects the order of calls to prefix methods `Tidy()` and `SetLength(kOmrPrefixLength)`. This was unintentionally reversed in PR #10000. PD prefixes can be shorter than `kOmrPrefixLength` (as allowed by `IsValidPdPrefix()`). To use them as OMR prefixes, `Tidy()` is called first to clear any extra bits before potentially extending the prefix to `kOmrPrefixLength`. --- src/core/border_router/routing_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/border_router/routing_manager.cpp b/src/core/border_router/routing_manager.cpp index c64e289e1..8bb814f2b 100644 --- a/src/core/border_router/routing_manager.cpp +++ b/src/core/border_router/routing_manager.cpp @@ -3775,8 +3775,8 @@ bool RoutingManager::PdPrefixManager::ProcessPrefixEntry(DiscoveredPrefixTable:: ExitNow(); } - aEntry.mPrefix.SetLength(kOmrPrefixLength); aEntry.mPrefix.Tidy(); + aEntry.mPrefix.SetLength(kOmrPrefixLength); // Check if there is an update to the current prefix. The valid or // preferred lifetime may have changed.