diff --git a/src/shared/inc/conncheckshared.h b/src/shared/inc/conncheckshared.h index b477ce53e..fe5e4ce0a 100644 --- a/src/shared/inc/conncheckshared.h +++ b/src/shared/inc/conncheckshared.h @@ -46,11 +46,12 @@ using unique_socket = wil::unique_fd; enum class ConnCheckStatus { - InProgress, - Success, - FailureGetAddrInfo, - FailureConfig, - FailureSocketConnect, + InProgress = 0, + Success = 1, + FailureGetAddrInfo = 2, + FailureConfig = 3, + FailureSocketConnect = 4, + NoRecordsForFamily = 5, }; struct ConnCheckResult @@ -116,6 +117,15 @@ inline unique_socket ConnCheckConnectSocket(int family, const char* hostname, co auto status = getaddrinfo(hostname, port, &hints, &servinfo); if (status != 0) { + if (status == EAI_NODATA || status == EAI_NONAME) // Check for both as EAI_NODATA is deprecated on newer linux versions + { + // EAI_NODATA means the domain exists but lacks records for the requested + // address family (A for IPv4, AAAA for IPv6). This is expected behavior + // for domains that are IPv4-only or IPv6-only. + // This is not treated as an error; we simply skip this address family and + // continue testing the other protocols. + *connCheckStatus = ConnCheckStatus::NoRecordsForFamily; + } throw std::runtime_error(std::format("CheckConnection: getaddrinfo() failed: {}", status)); }