[netdata] always check IsConsistent() before netdata registration (#7643)

This commit removes the `#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE`
around the call to `IsConsistent()` which checks whether there is any
difference between local network entries and ones from leader network
data and decide to send a "Server Data Notification" message to
leader. This change ensures that services are updated correctly under
the uncommon config combination where `TMF_NETDATA_SERVICE_ENABLE` is
enabled without `BORDER_ROUTER_ENABLE`.
This commit is contained in:
Abtin Keshavarzian
2022-05-02 16:57:29 -07:00
committed by GitHub
parent d2f18d5ebc
commit f3774e3368
2 changed files with 8 additions and 9 deletions
+6 -8
View File
@@ -184,12 +184,6 @@ void Local::UpdateRloc(PrefixTlv &aPrefixTlv)
}
}
bool Local::IsConsistent(void) const
{
return Get<Leader>().ContainsEntriesFrom(*this, Get<Mle::MleRouter>().GetRloc16()) &&
ContainsEntriesFrom(Get<Leader>(), Get<Mle::MleRouter>().GetRloc16());
}
#endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
@@ -293,6 +287,12 @@ void Local::UpdateRloc(void)
}
}
bool Local::IsConsistent(void) const
{
return Get<Leader>().ContainsEntriesFrom(*this, Get<Mle::MleRouter>().GetRloc16()) &&
ContainsEntriesFrom(Get<Leader>(), Get<Mle::MleRouter>().GetRloc16());
}
Error Local::UpdateInconsistentServerData(Coap::ResponseHandler aHandler, void *aContext)
{
Error error = kErrorNone;
@@ -308,9 +308,7 @@ Error Local::UpdateInconsistentServerData(Coap::ResponseHandler aHandler, void *
UpdateRloc();
#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
VerifyOrExit(!IsConsistent(), error = kErrorNotFound);
#endif
if (mOldRloc == rloc)
{
+2 -1
View File
@@ -179,11 +179,12 @@ public:
private:
void UpdateRloc(void);
bool IsConsistent(void) const;
#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
Error AddPrefix(const Ip6::Prefix &aPrefix, NetworkDataTlv::Type aSubTlvType, uint16_t aFlags, bool aStable);
Error RemovePrefix(const Ip6::Prefix &aPrefix, NetworkDataTlv::Type aSubTlvType);
void UpdateRloc(PrefixTlv &aPrefixTlv);
bool IsConsistent(void) const;
#endif
#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE