From 7b2e9f0aee20b4e406ecaf41700fd3048198f0ef Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Sat, 2 Sep 2023 10:02:40 -0700 Subject: [PATCH] add logs to debug --- src/mdns/mdns.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mdns/mdns.cpp b/src/mdns/mdns.cpp index 8306270e77e..5944994fc26 100644 --- a/src/mdns/mdns.cpp +++ b/src/mdns/mdns.cpp @@ -128,6 +128,8 @@ otbrError Publisher::DecodeTxtData(Publisher::TxtList &aTxtList, const uint8_t * { otbrError error = OTBR_ERROR_NONE; + otbrLogWarning("ABTIN -> DecodeTxtData(aTxtLength %u)", aTxtLength); + for (uint16_t r = 0; r < aTxtLength;) { uint16_t entrySize = aTxtData[r]; @@ -135,6 +137,9 @@ otbrError Publisher::DecodeTxtData(Publisher::TxtList &aTxtList, const uint8_t * uint16_t entryEnd = keyStart + entrySize; uint16_t keyEnd = keyStart; + otbrLogWarning("ABTIN -> r = %u, entrySize=%u", r, entrySize); + + VerifyOrExit(entryEnd <= aTxtLength, error = OTBR_ERROR_PARSE); while (keyEnd < entryEnd && aTxtData[keyEnd] != '=') @@ -144,6 +149,8 @@ otbrError Publisher::DecodeTxtData(Publisher::TxtList &aTxtList, const uint8_t * if (keyEnd == entryEnd) { + otbrLogWarning("ABTIN -> adding boolean attr", r, entrySize); + // No `=`, treat as a boolean attribute. aTxtList.emplace_back(reinterpret_cast(&aTxtData[keyStart]), keyEnd - keyStart); } @@ -151,6 +158,8 @@ otbrError Publisher::DecodeTxtData(Publisher::TxtList &aTxtList, const uint8_t * { uint16_t valStart = keyEnd + 1; // To skip over `=` + otbrLogWarning("ABTIN -> adding key value"); + aTxtList.emplace_back(reinterpret_cast(&aTxtData[keyStart]), keyEnd - keyStart, &aTxtData[valStart], entryEnd - valStart); } @@ -158,6 +167,8 @@ otbrError Publisher::DecodeTxtData(Publisher::TxtList &aTxtList, const uint8_t * r += entrySize + 1; } + otbrLogWarning("ABTIN -> aTxtList.size() = %u", aTxtList.size()); + exit: return error; }