From c70e47d16cf7cc16deaf4001a645b874466235a6 Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Wed, 9 Dec 2020 02:41:21 +0800 Subject: [PATCH] [dua] delay registration for DUA newly added (#5925) We found that it's possible that a Router, in a topology like above, could send DUA.req so quickly after receiving Data Response from Leader that the PBBR is not able to process the same Data Response message and update the network data accordingly. Consequently, PBBR sends DUA.rsp with kDuaInvalid status because it can't find a valid Domain Prefix in the Network Data. This commit help resolve this issue with two fixes: - Node to delay for up to 1000ms before sending DUA.req when domain prefix addresses is generated - PBBR to respond with kDuaGeneralFailure to allow the node to re-register the same DUA again. --- src/core/backbone_router/bbr_manager.cpp | 1 + src/core/thread/dua_manager.cpp | 4 +++- src/core/thread/dua_manager.hpp | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/backbone_router/bbr_manager.cpp b/src/core/backbone_router/bbr_manager.cpp index 8e61f10b1..43519f349 100644 --- a/src/core/backbone_router/bbr_manager.cpp +++ b/src/core/backbone_router/bbr_manager.cpp @@ -407,6 +407,7 @@ void Manager::HandleDuaRegistration(const Coap::Message &aMessage, const Ip6::Me #endif VerifyOrExit(isPrimary, status = ThreadStatusTlv::kDuaNotPrimary); + VerifyOrExit(Get().HasDomainPrefix(), status = ThreadStatusTlv::kDuaGeneralFailure); VerifyOrExit(Get().IsDomainUnicast(target), status = ThreadStatusTlv::kDuaInvalid); hasLastTransactionTime = (Tlv::Find(aMessage, lastTransactionTime) == OT_ERROR_NONE); diff --git a/src/core/thread/dua_manager.cpp b/src/core/thread/dua_manager.cpp index 5941bda7f..a9503a1c7 100644 --- a/src/core/thread/dua_manager.cpp +++ b/src/core/thread/dua_manager.cpp @@ -326,10 +326,12 @@ void DuaManager::HandleNotifierEvents(Events aEvents) #endif } +#if OPENTHREAD_CONFIG_DUA_ENABLE if (aEvents.ContainsAny(kEventIp6AddressAdded)) { - mRegistrationTask.Post(); + UpdateRegistrationDelay(kNewDuaRegistrationDelay); } +#endif } void DuaManager::HandleBackboneRouterPrimaryUpdate(BackboneRouter::Leader::State aState, diff --git a/src/core/thread/dua_manager.hpp b/src/core/thread/dua_manager.hpp index be31a2d42..ac46c6b6c 100644 --- a/src/core/thread/dua_manager.hpp +++ b/src/core/thread/dua_manager.hpp @@ -170,6 +170,7 @@ private: enum { kNewRouterRegistrationDelay = 3, ///< Delay (in seconds) for waiting link establishment for a new Router. + kNewDuaRegistrationDelay = 1, ///< Delay (in seconds) for newly added DUA. }; #if OPENTHREAD_CONFIG_DUA_ENABLE