From b9e9b6bd635247a4c7fadd0abb35e3d9dadb5ad8 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Wed, 28 Feb 2018 11:50:07 -0800 Subject: [PATCH] [mesh-forwarder] config option if to log src/dst IPv6 addresses (#2594) This commit adds a new config option which determines if the source and destination IPv6 addresses of received/sent messages are logged from `MeshForwarder::LogIp6Message()`. --- src/core/openthread-core-default-config.h | 11 +++++++++++ src/core/thread/mesh_forwarder.cpp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/openthread-core-default-config.h b/src/core/openthread-core-default-config.h index 5a38f4b9a..43b3e3c6d 100644 --- a/src/core/openthread-core-default-config.h +++ b/src/core/openthread-core-default-config.h @@ -763,6 +763,17 @@ #define OPENTHREAD_CONFIG_LOG_SUFFIX "" #endif +/** + * @def OPENTHREAD_CONFIG_LOG_SRC_DST_IP_ADDRESSES + * + * If defined as 1 when IPv6 message info is logged in mesh-forwarder, the source and destination IPv6 addresses of + * messages are also included. + * + */ +#ifndef OPENTHREAD_CONFIG_LOG_SRC_DST_IP_ADDRESSES +#define OPENTHREAD_CONFIG_LOG_SRC_DST_IP_ADDRESSES 1 +#endif + /** * @def OPENTHREAD_CONFIG_PLAT_LOG_FUNCTION * diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index ce6a07287..85ec64880 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -1443,7 +1443,7 @@ void MeshForwarder::LogIp6Message(MessageAction aAction, const char * actionText; const char * priorityText; bool shouldLogRss = false; - bool shouldLogSrcDstAddresses = true; + bool shouldLogSrcDstAddresses = (OPENTHREAD_CONFIG_LOG_SRC_DST_IP_ADDRESSES != 0); char stringBuffer[Ip6::Address::kIp6AddressStringSize]; char rssString[RssAverager::kStringSize];