Skip to content

Commit

Permalink
Match the order of ScoreIpAddress with IpScore
Browse files Browse the repository at this point in the history
The project-chip#27981 PR was merged, but it didn't follow IpScore's comments.

// IP addess "suitability"
//   - Larger value means "more suitable"
//   - Enum ordered ascending for easier read. Note however that order of
//     checks MUST match in ScoreIpAddress below.
enum class IpScore : unsigned

This change matches the order of ScoreIpAddress with the order of
IpScore enum.

Signed-off-by: Youngho Yoon <[email protected]>
  • Loading branch information
yhoyoon committed Aug 27, 2023
1 parent 2d5fe2c commit d9ec871
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/lib/dnssd/IPAddressSorter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ IpScore ScoreIpAddress(const Inet::IPAddress & ip, Inet::InterfaceId interfaceId
{
if (ip.IsIPv6())
{
#ifdef __APPLE__
if (ip.IsIPv6LinkLocal())
{
return IpScore::kLinkLocal;
}
#endif // __APPLE__

if (interfaceId.MatchLocalIPv6Subnet(ip))
{
Expand All @@ -73,13 +71,6 @@ IpScore ScoreIpAddress(const Inet::IPAddress & ip, Inet::InterfaceId interfaceId
return IpScore::kUniqueLocal;
}

#ifndef __APPLE__
if (ip.IsIPv6LinkLocal())
{
return IpScore::kLinkLocal;
}
#endif // __APPLE__

return IpScore::kOtherIpv6;
}

Expand Down

0 comments on commit d9ec871

Please sign in to comment.