From 5d378a23cd4ff7b3b8024ceb508f3bc7f766b310 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 9 Mar 2022 16:23:01 -0500 Subject: [PATCH] Don't error when receiving an ipv4 address (#15976) Receiving an ipv4 address isn't an error, we should just ignore it if we don't support it. --- src/platform/Linux/DnssdImpl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/platform/Linux/DnssdImpl.cpp b/src/platform/Linux/DnssdImpl.cpp index df7a176b4f6062..1d17d67ef2079a 100644 --- a/src/platform/Linux/DnssdImpl.cpp +++ b/src/platform/Linux/DnssdImpl.cpp @@ -727,8 +727,7 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte context->mCallback(context->mContext, nullptr, Span(), 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"); @@ -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) @@ -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; @@ -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;