Skip to content

Commit

Permalink
Reduce number of replies on MinMds query processing. (#27183)
Browse files Browse the repository at this point in the history
* Reduce number of replies on MinMds query processing.

UDP packets are received on every listening interface,
resulting in single queries being multipled by the interface count
and this causes more packets than expected being generated.

This change will only process queries that are originating from
the same interface that the mdns endpoint is bound to.

* Restyled by clang-format

---------

Co-authored-by: Andrei Litvin <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Oct 20, 2023
1 parent 139cb8e commit a634a4c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/dnssd/minimal_mdns/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,13 @@ void ServerBase::OnUdpPacketReceived(chip::Inet::UDPEndPoint * endPoint, chip::S

if (HeaderRef(const_cast<uint8_t *>(data.Start())).GetFlags().IsQuery())
{
srv->mDelegate->OnQuery(data, info);
// Only consider queries that are received on the same interface we are listening on.
// Without this, queries show up on all addresses on all interfaces, resulting
// in more replies than one would expect.
if (endPoint->GetBoundInterface() == info->Interface)
{
srv->mDelegate->OnQuery(data, info);
}
}
else
{
Expand Down

0 comments on commit a634a4c

Please sign in to comment.