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

[Tizen] Add address type check logic #13102

Merged
merged 1 commit into from
Dec 17, 2021
Merged
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
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