Skip to content

Commit

Permalink
Reduce number of replies on MinMds query processing.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andreilitvin committed Jun 9, 2023
1 parent 40fb7c2 commit ed37d0d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 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,12 @@ 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 ed37d0d

Please sign in to comment.