Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimal_mdns: Fix filter for Compressed Fabric Id when browsing operational nodes #35063

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/lib/dnssd/Resolver_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,17 @@ CHIP_ERROR MinMdnsResolver::BuildQuery(QueryBuilder & builder, const ActiveResol
switch (data.type)
{
case DiscoveryType::kOperational:
qname = CheckAndAllocateQName(kOperationalServiceName, kOperationalProtocol, kLocalDomain);
if (data.filter.type == DiscoveryFilterType::kCompressedFabricId)
{
char subtypeStr[Common::kSubTypeMaxLength + 1];
ReturnErrorOnFailure(MakeServiceSubtype(subtypeStr, sizeof(subtypeStr), data.filter));
qname = CheckAndAllocateQName(subtypeStr, kSubtypeServiceNamePart, kOperationalServiceName, kOperationalProtocol,
kLocalDomain);
}
else
{
qname = CheckAndAllocateQName(kOperationalServiceName, kOperationalProtocol, kLocalDomain);
}
break;
case DiscoveryType::kCommissionableNode:
if (data.filter.type == DiscoveryFilterType::kNone)
Expand Down
16 changes: 13 additions & 3 deletions src/lib/shell/commands/Dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,23 @@ bool ParseSubType(int argc, char ** argv, Dnssd::DiscoveryFilter & filter)
case 'C':
filterType = Dnssd::DiscoveryFilterType::kCommissioningMode;
break;
case 'I':
filterType = Dnssd::DiscoveryFilterType::kCompressedFabricId;
break;
default:
return false;
}

uint16_t code;
VerifyOrReturnError(ArgParser::ParseInt(subtype + 2, code), false);

uint64_t code = 0;
if (filterType == Dnssd::DiscoveryFilterType::kCompressedFabricId)
{
VerifyOrReturnError(ArgParser::ParseInt(subtype + 2, code, 16), false);
wqx6 marked this conversation as resolved.
Show resolved Hide resolved
VerifyOrReturnValue(code != 0, false);
}
else
{
VerifyOrReturnError(ArgParser::ParseInt(subtype + 2, code), false);
}
filter = Dnssd::DiscoveryFilter(filterType, code);
return true;
}
Expand Down
Loading