[routing-manager] update log messages (#6818)

This commit updates the logs in `RoutingManager` so that the log
messages start with capital letter (making them consistent with
logs in other modules).
This commit is contained in:
Abtin Keshavarzian
2021-07-15 13:03:33 -07:00
committed by GitHub
parent 9f4258d2ea
commit 625e088e52
+44 -44
View File
@@ -129,12 +129,12 @@ Error RoutingManager::LoadOrGenerateRandomOmrPrefix(void)
{
Ip6::NetworkPrefix randomOmrPrefix;
otLogNoteBr("no valid OMR prefix found in settings, generating new one");
otLogNoteBr("No valid OMR prefix found in settings, generating new one");
error = randomOmrPrefix.GenerateRandomUla();
if (error != kErrorNone)
{
otLogCritBr("failed to generate random OMR prefix");
otLogCritBr("Failed to generate random OMR prefix");
ExitNow();
}
@@ -155,12 +155,12 @@ Error RoutingManager::LoadOrGenerateRandomOnLinkPrefix(void)
{
Ip6::NetworkPrefix randomOnLinkPrefix;
otLogNoteBr("no valid on-link prefix found in settings, generating new one");
otLogNoteBr("No valid on-link prefix found in settings, generating new one");
error = randomOnLinkPrefix.GenerateRandomUla();
if (error != kErrorNone)
{
otLogCritBr("failed to generate random on-link prefix");
otLogCritBr("Failed to generate random on-link prefix");
ExitNow();
}
@@ -268,7 +268,7 @@ void RoutingManager::RecvIcmp6Message(uint32_t aInfraIfIndex,
exit:
if (error != kErrorNone)
{
otLogDebgBr("drop ICMPv6 message: %s", ErrorToString(error));
otLogDebgBr("Dropped ICMPv6 message: %s", ErrorToString(error));
}
}
@@ -280,7 +280,7 @@ Error RoutingManager::HandleInfraIfStateChanged(uint32_t aInfraIfIndex, bool aIs
VerifyOrExit(aInfraIfIndex == mInfraIfIndex, error = kErrorInvalidArgs);
VerifyOrExit(aIsRunning != mInfraIfIsRunning);
otLogInfoBr("infra interface (%u) state changed: %sRUNNING -> %sRUNNING", aInfraIfIndex,
otLogInfoBr("Infra interface (%u) state changed: %sRUNNING -> %sRUNNING", aInfraIfIndex,
(mInfraIfIsRunning ? "" : "NOT "), (aIsRunning ? "" : "NOT "));
mInfraIfIsRunning = aIsRunning;
@@ -341,7 +341,7 @@ uint8_t RoutingManager::EvaluateOmrPrefix(Ip6::Prefix *aNewOmrPrefixes, uint8_t
if (newOmrPrefixNum >= aMaxOmrPrefixNum)
{
otLogWarnBr("EvaluateOmrPrefix: too many OMR prefixes, ignoring prefix %s",
otLogWarnBr("EvaluateOmrPrefix: Too many OMR prefixes, ignoring prefix %s",
onMeshPrefixConfig.GetPrefix().ToString().AsCString());
continue;
}
@@ -361,7 +361,7 @@ uint8_t RoutingManager::EvaluateOmrPrefix(Ip6::Prefix *aNewOmrPrefixes, uint8_t
// Decide if we need to add or remove my local OMR prefix.
if (newOmrPrefixNum == 0)
{
otLogInfoBr("EvaluateOmrPrefix: no valid OMR prefixes found in Thread network");
otLogInfoBr("EvaluateOmrPrefix: No valid OMR prefixes found in Thread network");
if (PublishLocalOmrPrefix() == kErrorNone)
{
aNewOmrPrefixes[newOmrPrefixNum++] = mLocalOmrPrefix;
@@ -371,7 +371,7 @@ uint8_t RoutingManager::EvaluateOmrPrefix(Ip6::Prefix *aNewOmrPrefixes, uint8_t
}
else if (publishedLocalOmrPrefix != nullptr && smallestOmrPrefix != publishedLocalOmrPrefix)
{
otLogInfoBr("EvaluateOmrPrefix: there is already a smaller OMR prefix %s in the Thread network",
otLogInfoBr("EvaluateOmrPrefix: There is already a smaller OMR prefix %s in the Thread network",
smallestOmrPrefix->ToString().AsCString());
UnpublishLocalOmrPrefix();
@@ -401,13 +401,13 @@ Error RoutingManager::PublishLocalOmrPrefix(void)
error = Get<NetworkData::Local>().AddOnMeshPrefix(omrPrefixConfig);
if (error != kErrorNone)
{
otLogWarnBr("failed to publish local OMR prefix %s in Thread network: %s",
otLogWarnBr("Failed to publish local OMR prefix %s in Thread network: %s",
mLocalOmrPrefix.ToString().AsCString(), ErrorToString(error));
}
else
{
Get<NetworkData::Notifier>().HandleServerDataUpdated();
otLogInfoBr("published local OMR prefix %s in Thread network", mLocalOmrPrefix.ToString().AsCString());
otLogInfoBr("Published local OMR prefix %s in Thread network", mLocalOmrPrefix.ToString().AsCString());
}
return error;
@@ -422,12 +422,12 @@ void RoutingManager::UnpublishLocalOmrPrefix(void)
SuccessOrExit(error = Get<NetworkData::Local>().RemoveOnMeshPrefix(mLocalOmrPrefix));
Get<NetworkData::Notifier>().HandleServerDataUpdated();
otLogInfoBr("unpublished local OMR prefix %s from Thread network", mLocalOmrPrefix.ToString().AsCString());
otLogInfoBr("Unpublished local OMR prefix %s from Thread network", mLocalOmrPrefix.ToString().AsCString());
exit:
if (error != kErrorNone)
{
otLogWarnBr("failed to unpublish local OMR prefix %s from Thread network: %s",
otLogWarnBr("Failed to unpublish local OMR prefix %s from Thread network: %s",
mLocalOmrPrefix.ToString().AsCString(), ErrorToString(error));
}
}
@@ -447,12 +447,12 @@ Error RoutingManager::AddExternalRoute(const Ip6::Prefix &aPrefix, otRoutePrefer
error = Get<NetworkData::Local>().AddHasRoutePrefix(routeConfig);
if (error != kErrorNone)
{
otLogWarnBr("failed to add external route %s: %s", aPrefix.ToString().AsCString(), ErrorToString(error));
otLogWarnBr("Failed to add external route %s: %s", aPrefix.ToString().AsCString(), ErrorToString(error));
}
else
{
Get<NetworkData::Notifier>().HandleServerDataUpdated();
otLogInfoBr("added external route %s", aPrefix.ToString().AsCString());
otLogInfoBr("Added external route %s", aPrefix.ToString().AsCString());
}
return error;
@@ -467,12 +467,12 @@ void RoutingManager::RemoveExternalRoute(const Ip6::Prefix &aPrefix)
SuccessOrExit(error = Get<NetworkData::Local>().RemoveHasRoutePrefix(aPrefix));
Get<NetworkData::Notifier>().HandleServerDataUpdated();
otLogInfoBr("removed external route %s", aPrefix.ToString().AsCString());
otLogInfoBr("Removed external route %s", aPrefix.ToString().AsCString());
exit:
if (error != kErrorNone)
{
otLogWarnBr("failed to remove external route %s: %s", aPrefix.ToString().AsCString(), ErrorToString(error));
otLogWarnBr("Failed to remove external route %s: %s", aPrefix.ToString().AsCString(), ErrorToString(error));
}
}
@@ -539,7 +539,7 @@ const Ip6::Prefix *RoutingManager::EvaluateOnLinkPrefix(void)
}
else
{
otLogInfoBr("EvaluateOnLinkPrefix: there is already smaller on-link prefix %s on interface %u",
otLogInfoBr("EvaluateOnLinkPrefix: There is already smaller on-link prefix %s on interface %u",
smallestOnLinkPrefix->ToString().AsCString(), mInfraIfIndex);
// TODO: we remove the advertised on-link prefix by setting zero valid lifetime for PIO,
@@ -568,7 +568,7 @@ void RoutingManager::EvaluateRoutingPolicy(void)
Ip6::Prefix newOmrPrefixes[kMaxOmrPrefixNum];
uint8_t newOmrPrefixNum = 0;
otLogInfoBr("evaluating routing policy");
otLogInfoBr("Evaluating routing policy");
// 0. Evaluate on-link & OMR prefixes.
newOnLinkPrefix = EvaluateOnLinkPrefix();
@@ -581,7 +581,7 @@ void RoutingManager::EvaluateRoutingPolicy(void)
// This is the very exceptional case and happens only when we failed to publish
// our local OMR prefix to the Thread network. We schedule the Router Advertisement
// timer to re-evaluate our routing policy in the future.
otLogWarnBr("no OMR prefix advertised! Start Router Advertisement timer for future evaluation");
otLogWarnBr("No OMR prefix advertised! Start Router Advertisement timer for future evaluation");
}
// 2. Schedule Router Advertisement timer with random interval.
@@ -595,7 +595,7 @@ void RoutingManager::EvaluateRoutingPolicy(void)
nextSendTime = kMaxInitRtrAdvInterval;
}
otLogInfoBr("router advertisement scheduled in %u seconds", nextSendTime);
otLogInfoBr("Router advertisement scheduled in %u seconds", nextSendTime);
mRouterAdvertisementTimer.Start(Time::SecToMsec(nextSendTime));
}
@@ -615,7 +615,7 @@ void RoutingManager::StartRoutingPolicyEvaluationDelay(void)
static_assert(kMaxRoutingPolicyDelay > 0, "invalid maximum routing policy evaluation delay");
randomDelay = Random::NonCrypto::GetUint32InRange(0, Time::SecToMsec(kMaxRoutingPolicyDelay));
otLogInfoBr("start evaluating routing policy, scheduled in %u milliseconds", randomDelay);
otLogInfoBr("Start evaluating routing policy, scheduled in %u milliseconds", randomDelay);
mRoutingPolicyTimer.Start(randomDelay);
}
@@ -632,7 +632,7 @@ void RoutingManager::StartRouterSolicitationDelay(void)
static_assert(kMaxRtrSolicitationDelay > 0, "invalid maximum Router Solicitation delay");
randomDelay = Random::NonCrypto::GetUint32InRange(0, Time::SecToMsec(kMaxRtrSolicitationDelay));
otLogInfoBr("start Router Solicitation, scheduled in %u milliseconds", randomDelay);
otLogInfoBr("Start Router Solicitation, scheduled in %u milliseconds", randomDelay);
mTimeRouterSolicitStart = TimerMilli::GetNow();
mRouterSolicitTimer.Start(randomDelay);
@@ -686,11 +686,11 @@ void RoutingManager::SendRouterAdvertisement(const Ip6::Prefix *aNewOmrPrefixes,
if (mAdvertisedOnLinkPrefix == nullptr)
{
otLogInfoBr("start advertising new on-link prefix %s on interface %u",
otLogInfoBr("Start advertising new on-link prefix %s on interface %u",
aNewOnLinkPrefix->ToString().AsCString(), mInfraIfIndex);
}
otLogInfoBr("send on-link prefix %s in PIO (valid lifetime = %u seconds)",
otLogInfoBr("Send on-link prefix %s in PIO (valid lifetime = %u seconds)",
aNewOnLinkPrefix->ToString().AsCString(), kDefaultOnLinkPrefixLifetime);
}
else if (mAdvertisedOnLinkPrefix != nullptr)
@@ -709,7 +709,7 @@ void RoutingManager::SendRouterAdvertisement(const Ip6::Prefix *aNewOmrPrefixes,
memcpy(buffer + bufferLength, &pio, pio.GetSize());
bufferLength += pio.GetSize();
otLogInfoBr("stop advertising on-link prefix %s on interface %u",
otLogInfoBr("Stop advertising on-link prefix %s on interface %u",
mAdvertisedOnLinkPrefix->ToString().AsCString(), mInfraIfIndex);
}
@@ -730,7 +730,7 @@ void RoutingManager::SendRouterAdvertisement(const Ip6::Prefix *aNewOmrPrefixes,
memcpy(buffer + bufferLength, &rio, rio.GetSize());
bufferLength += rio.GetSize();
otLogInfoBr("stop advertising OMR prefix %s on interface %u", advertisedOmrPrefix.ToString().AsCString(),
otLogInfoBr("Stop advertising OMR prefix %s on interface %u", advertisedOmrPrefix.ToString().AsCString(),
mInfraIfIndex);
}
}
@@ -747,7 +747,7 @@ void RoutingManager::SendRouterAdvertisement(const Ip6::Prefix *aNewOmrPrefixes,
memcpy(buffer + bufferLength, &rio, rio.GetSize());
bufferLength += rio.GetSize();
otLogInfoBr("send OMR prefix %s in RIO (valid lifetime = %u seconds)", newOmrPrefix.ToString().AsCString(),
otLogInfoBr("Send OMR prefix %s in RIO (valid lifetime = %u seconds)", newOmrPrefix.ToString().AsCString(),
kDefaultOmrPrefixLifetime);
}
@@ -764,14 +764,14 @@ void RoutingManager::SendRouterAdvertisement(const Ip6::Prefix *aNewOmrPrefixes,
if (error == kErrorNone)
{
otLogInfoBr("sent Router Advertisement on interface %u", mInfraIfIndex);
otLogInfoBr("Sent Router Advertisement on interface %u", mInfraIfIndex);
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
otDumpCertBr("[BR-CERT] direction=send | type=RA |", buffer, bufferLength);
#endif
}
else
{
otLogWarnBr("failed to send Router Advertisement on interface %u: %s", mInfraIfIndex, ErrorToString(error));
otLogWarnBr("Failed to send Router Advertisement on interface %u: %s", mInfraIfIndex, ErrorToString(error));
}
}
}
@@ -808,7 +808,7 @@ void RoutingManager::HandleRouterAdvertisementTimer(Timer &aTimer)
void RoutingManager::HandleRouterAdvertisementTimer(void)
{
otLogInfoBr("router advertisement timer triggered");
otLogInfoBr("Router advertisement timer triggered");
EvaluateRoutingPolicy();
}
@@ -820,7 +820,7 @@ void RoutingManager::HandleVicariousRouterSolicitTimer(Timer &aTimer)
void RoutingManager::HandleVicariousRouterSolicitTimer(void)
{
otLogInfoBr("vicarious router solicitation time out");
otLogInfoBr("Vicarious router solicitation time out");
for (uint8_t i = 0; i < mDiscoveredPrefixNum; ++i)
{
@@ -841,7 +841,7 @@ void RoutingManager::HandleRouterSolicitTimer(Timer &aTimer)
void RoutingManager::HandleRouterSolicitTimer(void)
{
otLogInfoBr("router solicitation times out");
otLogInfoBr("Router solicitation times out");
if (mRouterSolicitCount < kMaxRtrSolicitations)
{
@@ -853,17 +853,17 @@ void RoutingManager::HandleRouterSolicitTimer(void)
if (error == kErrorNone)
{
otLogDebgBr("successfully sent %uth Router Solicitation", mRouterSolicitCount);
otLogDebgBr("Successfully sent %uth Router Solicitation", mRouterSolicitCount);
}
else
{
otLogCritBr("failed to send %uth Router Solicitation: %s", mRouterSolicitCount, ErrorToString(error));
otLogCritBr("Failed to send %uth Router Solicitation: %s", mRouterSolicitCount, ErrorToString(error));
}
nextSolicitationDelay =
(mRouterSolicitCount == kMaxRtrSolicitations) ? kMaxRtrSolicitationDelay : kRtrSolicitationInterval;
otLogDebgBr("router solicitation timer scheduled in %u seconds", nextSolicitationDelay);
otLogDebgBr("Router solicitation timer scheduled in %u seconds", nextSolicitationDelay);
mRouterSolicitTimer.Start(Time::SecToMsec(nextSolicitationDelay));
}
else
@@ -898,7 +898,7 @@ void RoutingManager::HandleDiscoveredPrefixStaleTimer(Timer &aTimer)
void RoutingManager::HandleDiscoveredPrefixStaleTimer(void)
{
otLogInfoBr("all on-link prefixes are stale");
otLogInfoBr("All on-link prefixes are stale");
StartRouterSolicitationDelay();
}
@@ -928,7 +928,7 @@ void RoutingManager::HandleRouterSolicit(const Ip6::Address &aSrcAddress,
OT_UNUSED_VARIABLE(aBufferLength);
VerifyOrExit(!mRouterSolicitTimer.IsRunning());
otLogInfoBr("received Router Solicitation from %s on interface %u", aSrcAddress.ToString().AsCString(),
otLogInfoBr("Received Router Solicitation from %s on interface %u", aSrcAddress.ToString().AsCString(),
mInfraIfIndex);
if (!mVicariousRouterSolicitTimer.IsRunning())
@@ -982,7 +982,7 @@ void RoutingManager::HandleRouterAdvertisement(const Ip6::Address &aSrcAddress,
VerifyOrExit(aBufferLength >= sizeof(RouterAdvMessage));
otLogInfoBr("received Router Advertisement from %s on interface %u", aSrcAddress.ToString().AsCString(),
otLogInfoBr("Received Router Advertisement from %s on interface %u", aSrcAddress.ToString().AsCString(),
mInfraIfIndex);
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
otDumpCertBr("[BR-CERT] direction=recv | type=RA |", aBuffer, aBufferLength);
@@ -1047,13 +1047,13 @@ bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::PrefixInfoOption
if (!IsValidOnLinkPrefix(aPio, aManagedAddrConfig))
{
otLogInfoBr("ignore invalid on-link prefix in PIO: %s", prefix.ToString().AsCString());
otLogInfoBr("Ignore invalid on-link prefix in PIO: %s", prefix.ToString().AsCString());
ExitNow();
}
VerifyOrExit(mAdvertisedOnLinkPrefix == nullptr || prefix != *mAdvertisedOnLinkPrefix);
otLogInfoBr("discovered on-link prefix (%s, %u seconds) from interface %u", prefix.ToString().AsCString(),
otLogInfoBr("Discovered on-link prefix (%s, %u seconds) from interface %u", prefix.ToString().AsCString(),
aPio.GetValidLifetime(), mInfraIfIndex);
if (aPio.GetValidLifetime() == 0)
@@ -1076,7 +1076,7 @@ bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::RouteInfoOption &
if (!IsValidOmrPrefix(prefix))
{
otLogInfoBr("ignore invalid OMR prefix in RIO: %s", prefix.ToString().AsCString());
otLogInfoBr("Ignore invalid OMR prefix in RIO: %s", prefix.ToString().AsCString());
ExitNow();
}
@@ -1092,7 +1092,7 @@ bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::RouteInfoOption &
VerifyOrExit(!ContainsPrefix(prefix, mAdvertisedOmrPrefixes, mAdvertisedOmrPrefixNum));
VerifyOrExit(!NetworkDataContainsOmrPrefix(prefix));
otLogInfoBr("discovered OMR prefix (%s, %u seconds) from interface %u", prefix.ToString().AsCString(),
otLogInfoBr("Discovered OMR prefix (%s, %u seconds) from interface %u", prefix.ToString().AsCString(),
aRio.GetRouteLifetime(), mInfraIfIndex);
if (aRio.GetRouteLifetime() == 0)
@@ -1218,7 +1218,7 @@ bool RoutingManager::AddDiscoveredPrefix(const Ip6::Prefix &aPrefix,
}
else
{
otLogWarnBr("discovered too many prefixes, ignore new prefix %s", aPrefix.ToString().AsCString());
otLogWarnBr("Discovered too many prefixes, ignore new prefix %s", aPrefix.ToString().AsCString());
ExitNow();
}
}