mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 17:17:45 +00:00
[nat64] update Mapping::ToString() to include translated ports (#11886)
When `OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE` is enabled, multiple `Mapping` entries can exist for the same IPv6 and IPv4 addresses, differing only by their protocol ports. To distinguish between these entries in logs and diagnostics, this change updates `Mapping::ToString()` to include the source and translated port numbers in the generated string output.
This commit is contained in:
@@ -348,7 +348,12 @@ Translator::Mapping::InfoString Translator::Mapping::ToString(void) const
|
||||
{
|
||||
InfoString string;
|
||||
|
||||
#if OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE
|
||||
string.Append("%s,%u -> %s,%u", mIp6Address.ToString().AsCString(), mSrcPortOrId,
|
||||
mIp4Address.ToString().AsCString(), mTranslatedPortOrId);
|
||||
#else
|
||||
string.Append("%s -> %s", mIp6Address.ToString().AsCString(), mIp4Address.ToString().AsCString());
|
||||
#endif
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ private:
|
||||
|
||||
struct Mapping : public InstanceLocatorInit, public LinkedListEntry<Mapping>
|
||||
{
|
||||
static constexpr uint16_t kInfoStringSize = 70;
|
||||
static constexpr uint16_t kInfoStringSize = 80;
|
||||
|
||||
typedef String<kInfoStringSize> InfoString;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user