From 6e3495f83fe35f5854459582118e3273327e2314 Mon Sep 17 00:00:00 2001 From: Martin Turon Date: Wed, 16 Mar 2022 12:20:48 -0700 Subject: [PATCH] [mdns] Show interface on mDns failures. (#15266) * [mdns] Show interface on mDns failures. * [log] Deescalate bad interface log from error to detail. * [mdns] Comment resolution. * [mdns] Handle interface name error. * [restyle] --- src/lib/dnssd/minimal_mdns/Server.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/dnssd/minimal_mdns/Server.cpp b/src/lib/dnssd/minimal_mdns/Server.cpp index f868f34527f910..c2d97ad1324603 100644 --- a/src/lib/dnssd/minimal_mdns/Server.cpp +++ b/src/lib/dnssd/minimal_mdns/Server.cpp @@ -386,8 +386,14 @@ CHIP_ERROR ServerBase::BroadcastImpl(chip::System::PacketBufferHandle && data, u } else { - ChipLogError(Discovery, "Attempt to mDNS broadcast failed: %s", chip::ErrorStr(err)); lastError = err; +#if CHIP_DETAIL_LOGGING + char ifaceName[chip::Inet::InterfaceId::kMaxIfNameLength]; + err = info->mInterfaceId.GetInterfaceName(ifaceName, sizeof(ifaceName)); + if (err != CHIP_NO_ERROR) + strcpy(ifaceName, "???"); + ChipLogDetail(Discovery, "Warning: Attempt to mDNS broadcast failed on %s: %s", ifaceName, lastError.AsString()); +#endif } return chip::Loop::Continue; }))