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 <andreilitvin@google.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
3 people authored and pull[bot] committed Jan 8, 2024
1 parent 7fb43c4 commit 1266440
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 1266440

Please sign in to comment.