diff --git a/esphome/components/socket/lwip_getaddrinfo_impl.cpp b/esphome/components/socket/lwip_getaddrinfo_impl.cpp index d37087ad11..9bda4b944d 100644 --- a/esphome/components/socket/lwip_getaddrinfo_impl.cpp +++ b/esphome/components/socket/lwip_getaddrinfo_impl.cpp @@ -70,13 +70,7 @@ class LwipGetaddrinfoFuture : public GetaddrinfoFuture { struct addrinfo *ai = reinterpret_cast(storage); struct sockaddr_storage *sa = reinterpret_cast(ai + 1); -#if LWIP_IPV4 && LWIP_IPV6 - bool isipv6 = result_->ipaddr.type == IPADDR_TYPE_V6; -#elif LWIP_IPV4 - bool isipv6 = false; -#elif LWIP_IPV6 - bool isipv6 = true; -#endif + bool isipv6 = IP_IS_V6(result_->ipaddr); bool istcp = true; if ((hint_ai_socktype_ != 0 && hint_ai_socktype_ == SOCK_DGRAM) ||