21 #ifdef GRPC_HAVE_UNIX_SOCKET
25 #include "absl/strings/str_format.h"
50 grpc_sockaddr_in6* result_from_grpc_parser =
51 reinterpret_cast<grpc_sockaddr_in6*
>(
addr.addr);
56 GPR_ASSERT(memcmp(&result_from_grpc_parser->sin6_addr,
57 &result_from_getaddrinfo.
sin6_addr,
sizeof(in6_addr)) == 0);
58 GPR_ASSERT(result_from_grpc_parser->sin6_scope_id ==
60 GPR_ASSERT(result_from_grpc_parser->sin6_scope_id != 0);
75 memset(&hints, 0,
sizeof(hints));
80 int res = getaddrinfo(host.c_str(),
port.c_str(), &hints, &
result);
83 "getaddrinfo failed to resolve host:%s port:%s. Error: %d.",
84 host.c_str(),
port.c_str(), res);
87 size_t num_addrs_from_getaddrinfo = 0;
89 num_addrs_from_getaddrinfo++;
100 int main(
int argc,
char** argv) {
107 for (
size_t i = 1;
i < 65536;
i++) {
108 if (if_indextoname(
i, arbitrary_interface_name) !=
nullptr) {
110 "Found interface at index %" PRIuPTR
111 " named %s. Will use this for the test",
112 i, arbitrary_interface_name);
116 GPR_ASSERT(strlen(arbitrary_interface_name) > 0);
118 absl::StrFormat(
"ipv6:[fe80::1234%%%s]:12345", arbitrary_interface_name);
123 "Run test_grpc_parse_ipv6_parity_with_getaddrinfo with target: %s",
126 result_from_getaddrinfo);