Skip to content

Commit

Permalink
Reduce minmdns verbosity for common operations: logs of send/receive … (
Browse files Browse the repository at this point in the history
#22316)

* Reduce minmdns verbosity for common operations: logs of send/receive packets and insufficient parsers

* Reduce logging on IPv4 addresses as well when ipv4 is disabled
  • Loading branch information
andy31415 authored and pull[bot] committed Jul 24, 2023
1 parent 59a729c commit 1223032
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/dnssd/IncrementalResolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,21 @@ CHIP_ERROR IncrementalResolver::OnRecord(Inet::InterfaceId interface, const Reso
return CHIP_NO_ERROR;
}

#if INET_CONFIG_ENABLE_IPV4
Inet::IPAddress addr;
if (!ParseARecord(data.GetData(), &addr))
{
return CHIP_ERROR_INVALID_ARGUMENT;
}

return OnIpAddress(interface, addr);
#else
#if CHIP_MINMDNS_HIGH_VERBOSITY
ChipLogProgress(Discovery, "Ignoring A record: IPv4 not supported");
#endif
// skipping IPv4 addresses
return CHIP_NO_ERROR;
#endif
}
case QType::AAAA: {
if (data.GetName() != mTargetHostName.Get())
Expand Down
2 changes: 2 additions & 0 deletions src/lib/dnssd/Resolver_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ void PacketParser::ParseSRVResource(const ResourceData & data)
return;
}

#if CHIP_MINMDNS_HIGH_VERBOSITY
ChipLogError(Discovery, "Insufficient parsers to process all SRV entries.");
#endif
}

void PacketParser::ParseSrvRecords(const BytesRange & packet)
Expand Down
4 changes: 4 additions & 0 deletions src/lib/dnssd/minimal_mdns/ResponseSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,18 @@ CHIP_ERROR ResponseSender::FlushReply()

if (mSendState.SendUnicast())
{
#if CHIP_MINMDNS_HIGH_VERBOSITY
ChipLogDetail(Discovery, "Directly sending mDns reply to peer %s on port %d", srcAddressString,
mSendState.GetSourcePort());
#endif
ReturnErrorOnFailure(mServer->DirectSend(mResponseBuilder.ReleasePacket(), mSendState.GetSourceAddress(),
mSendState.GetSourcePort(), mSendState.GetSourceInterfaceId()));
}
else
{
#if CHIP_MINMDNS_HIGH_VERBOSITY
ChipLogDetail(Discovery, "Broadcasting mDns reply for query from %s", srcAddressString);
#endif
ReturnErrorOnFailure(mServer->BroadcastSend(mResponseBuilder.ReleasePacket(), kMdnsStandardPort,
mSendState.GetSourceInterfaceId(), mSendState.GetSourceAddress().Type()));
}
Expand Down

0 comments on commit 1223032

Please sign in to comment.