[bbr] handle case where no PBBR exists in network data (#6165)

This commit is contained in:
Jonathan Hui
2021-02-19 09:32:53 -08:00
committed by GitHub
parent b11a3b2aec
commit cf0640973e
3 changed files with 7 additions and 11 deletions
+1 -1
View File
@@ -180,7 +180,7 @@ void Leader::UpdateBackboneRouterPrimary(void)
State state;
uint32_t origMlrTimeout;
IgnoreError(Get<NetworkData::Service::Manager>().GetBackboneRouterPrimary(config));
Get<NetworkData::Service::Manager>().GetBackboneRouterPrimary(config);
if (config.mServer16 != mConfig.mServer16)
{
+5 -6
View File
@@ -83,17 +83,18 @@ otError Manager::GetServiceId(uint8_t aServiceNumber, bool aServerStable, uint8_
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
otError Manager::GetBackboneRouterPrimary(ot::BackboneRouter::BackboneRouterConfig &aConfig) const
void Manager::GetBackboneRouterPrimary(ot::BackboneRouter::BackboneRouterConfig &aConfig) const
{
otError error = OT_ERROR_NOT_FOUND;
const uint8_t serviceData = BackboneRouter::kServiceNumber;
const ServerTlv * rvalServerTlv = nullptr;
const BackboneRouter::ServerData *rvalServerData = nullptr;
Iterator iterator;
aConfig.mServer16 = Mac::kShortAddrInvalid;
iterator.mServiceTlv = Get<Leader>().FindService(kThreadEnterpriseNumber, &serviceData, sizeof(serviceData));
VerifyOrExit(iterator.mServiceTlv != nullptr, aConfig.mServer16 = Mac::kShortAddrInvalid);
VerifyOrExit(iterator.mServiceTlv != nullptr);
while (IterateToNextServer(iterator) == OT_ERROR_NONE)
{
@@ -125,10 +126,8 @@ otError Manager::GetBackboneRouterPrimary(ot::BackboneRouter::BackboneRouterConf
aConfig.mReregistrationDelay = rvalServerData->GetReregistrationDelay();
aConfig.mMlrTimeout = rvalServerData->GetMlrTimeout();
error = OT_ERROR_NONE;
exit:
return error;
return;
}
#endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
+1 -4
View File
@@ -323,11 +323,8 @@ public:
*
* @param[out] aConfig The Primary Backbone Router configuration.
*
* @retval OT_ERROR_NONE Successfully got the Primary Backbone Router configuration.
* @retval OT_ERROR_NOT_FOUND No Backbone Router Service in the Thread Network.
*
*/
otError GetBackboneRouterPrimary(ot::BackboneRouter::BackboneRouterConfig &aConfig) const;
void GetBackboneRouterPrimary(ot::BackboneRouter::BackboneRouterConfig &aConfig) const;
#endif
/**