Skip to content

Commit

Permalink
Don't error when receiving an ipv4 address (#15976)
Browse files Browse the repository at this point in the history
Receiving an ipv4 address isn't an error, we should just ignore it
if we don't support it.
  • Loading branch information
cecille authored Mar 9, 2022
1 parent ccad121 commit 475c710
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/platform/Linux/DnssdImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,7 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte
context->mCallback(context->mContext, nullptr, Span<Inet::IPAddress>(), CHIP_ERROR_INTERNAL);
break;
case AVAHI_RESOLVER_FOUND:
DnssdService result = {};
CHIP_ERROR result_err = CHIP_NO_ERROR;
DnssdService result = {};

result.mAddress.SetValue(chip::Inet::IPAddress());
ChipLogError(DeviceLayer, "Avahi resolve found");
Expand All @@ -753,6 +752,7 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte
*dot = '\0';
}

CHIP_ERROR result_err = CHIP_ERROR_INVALID_ADDRESS;
if (address)
{
switch (address->proto)
Expand All @@ -763,8 +763,8 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte

memcpy(&addr4, &(address->data.ipv4), sizeof(addr4));
result.mAddress.SetValue(chip::Inet::IPAddress(addr4));
result_err = CHIP_NO_ERROR;
#else
result_err = CHIP_ERROR_INVALID_ADDRESS;
ChipLogError(Discovery, "Ignoring IPv4 mDNS address.");
#endif
break;
Expand All @@ -773,6 +773,7 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte

memcpy(&addr6, &(address->data.ipv6), sizeof(addr6));
result.mAddress.SetValue(chip::Inet::IPAddress(addr6));
result_err = CHIP_NO_ERROR;
break;
default:
break;
Expand Down

0 comments on commit 475c710

Please sign in to comment.