Skip to content

Commit

Permalink
[border-router] add RA message dump for testing (#6567)
Browse files Browse the repository at this point in the history
  • Loading branch information
wgtdkp authored May 9, 2021
1 parent 8dc9a53 commit e7c4236
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/core/border_router/routing_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,9 @@ void RoutingManager::SendRouterAdvertisement(const Ip6::Prefix *aNewOmrPrefixes,
if (error == kErrorNone)
{
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
{
Expand Down Expand Up @@ -918,6 +921,9 @@ void RoutingManager::HandleRouterAdvertisement(const Ip6::Address &aSrcAddress,

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);
#endif

routerAdvMessage = reinterpret_cast<const RouterAdvMessage *>(aBuffer);
optionsBegin = aBuffer + sizeof(RouterAdvMessage);
Expand Down
18 changes: 17 additions & 1 deletion src/core/common/logging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2462,7 +2462,7 @@ void otLogOtns(const char *aFormat, ...);
#endif

/**
* @def otDumpCert
* @def otDumpCertMeshCoP
*
* This function generates a memory dump with log level none for the certification test.
*
Expand All @@ -2477,6 +2477,22 @@ void otLogOtns(const char *aFormat, ...);
#define otDumpCertMeshCoP(aId, aBuf, aLength)
#endif

/**
* @def otDumpCertBr
*
* This function generates a memory dump with log level none for the BR certification test.
*
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
* @param[in] aBuf A pointer to the buffer.
* @param[in] aLength Number of bytes to print.
*
*/
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
#define otDumpCertBr(aId, aBuf, aLength) otDump(OT_LOG_LEVEL_NONE, OT_LOG_REGION_BR, aId, aBuf, aLength)
#else
#define otDumpCertBr(aId, aBuf, aLength)
#endif

/**
* This function dumps bytes to the log in a human-readable fashion.
*
Expand Down

0 comments on commit e7c4236

Please sign in to comment.