Skip to content

Commit

Permalink
[Tizen] Add address type check logic (#13102)
Browse files Browse the repository at this point in the history
  • Loading branch information
wootak-jung authored and pull[bot] committed Feb 16, 2024
1 parent 6bb57cd commit 5320577
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/platform/Tizen/DnssdImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,17 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * data)
// If both IPv4 and IPv6 are set, IPv6 address has higher priority.
if (ipv6 != nullptr)
{
validIP = chip::Inet::IPAddress::FromString(ipv6, ipStr);
validIP = (chip::Inet::IPAddress::FromString(ipv6, ipStr) && ipStr.Type() == chip::Inet::IPAddressType::kIPv6);
}
#if INET_CONFIG_ENABLE_IPV4
else if (ipv4 != nullptr)
{
validIP = chip::Inet::IPAddress::FromString(ipv4, ipStr);
validIP = (chip::Inet::IPAddress::FromString(ipv4, ipStr) && ipStr.Type() == chip::Inet::IPAddressType::kIPv4);
}
#endif

ChipLogDetail(DeviceLayer, "Dnssd: %s ipv4: %s, ipv6: %s, valid: %d", __func__, ipv4, ipv6, validIP);

if (validIP)
{
mdnsService.mAddress.SetValue(ipStr);
Expand Down

0 comments on commit 5320577

Please sign in to comment.