Skip to content

Commit

Permalink
VerifyOrDie if broadcast addresses are wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
andreilitvin authored and PSONALl committed Jul 4, 2023
1 parent ded1857 commit f7db570
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ void AdvertiserMinMdns::AdvertiseRecords(BroadcastAdvertiseType type)
// This optimization likely will take more logic and state storage, so
// for now it is not done.
QueryData queryData(QType::PTR, QClass::IN, false /* unicast */);
queryData.SetIsInternalBroadcast(true);
queryData.SetIsAnnounceBroadcast(true);

for (auto & it : mOperationalResponders)
{
Expand Down
16 changes: 2 additions & 14 deletions src/lib/dnssd/minimal_mdns/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,12 @@ chip::Inet::IPAddress Get(chip::Inet::IPAddressType addressType)
#if INET_CONFIG_ENABLE_IPV4
if (addressType == chip::Inet::IPAddressType::kIPv4)
{
if (!chip::Inet::IPAddress::FromString("224.0.0.251", address))
{
ChipLogError(Discovery, "Failed to parse standard IPv4 broadcast address");

// not valid, however the parsing should never fail
return chip::Inet::IPAddress::Any;
}
VerifyOrDie(chip::Inet::IPAddress::FromString("224.0.0.251", address));
}
else
#endif
{
if (!chip::Inet::IPAddress::FromString("FF02::FB", address))
{
ChipLogError(Discovery, "Failed to parse standard IPv6 broadcast address");

// not valid, however the parsing should never fail
return chip::Inet::IPAddress::Any;
}
VerifyOrDie(chip::Inet::IPAddress::FromString("FF02::FB", address));
}
return address;
}
Expand Down

0 comments on commit f7db570

Please sign in to comment.