Support named scope id's with ipv6 resolver on posix

pull/16187/head
Alexander Polcyn 6 years ago
parent c3eb206897
commit 00763bc3ea
  1. 3
      BUILD
  2. 102
      CMakeLists.txt
  3. 106
      Makefile
  4. 38
      build.yaml
  5. 2
      config.m4
  6. 2
      config.w32
  7. 2
      gRPC-C++.podspec
  8. 4
      gRPC-Core.podspec
  9. 3
      grpc.gemspec
  10. 8
      grpc.gyp
  11. 3
      package.xml
  12. 29
      src/core/ext/filters/client_channel/parse_address.cc
  13. 30
      src/core/lib/iomgr/grpc_if_nametoindex.h
  14. 41
      src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
  15. 37
      src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
  16. 2
      src/python/grpcio/grpc_core_dependencies.py
  17. 11
      test/core/client_channel/BUILD
  18. 126
      test/core/client_channel/parse_address_with_named_scope_id_test.cc
  19. 19
      test/core/iomgr/BUILD
  20. 81
      test/core/iomgr/resolve_address_posix_test.cc
  21. 1
      tools/doxygen/Doxyfile.c++.internal
  22. 3
      tools/doxygen/Doxyfile.core.internal
  23. 38
      tools/run_tests/generated/sources_and_headers.json
  24. 54
      tools/run_tests/generated/tests.json

@ -732,6 +732,8 @@ grpc_cc_library(
"src/core/lib/iomgr/iomgr_posix.cc", "src/core/lib/iomgr/iomgr_posix.cc",
"src/core/lib/iomgr/iomgr_windows.cc", "src/core/lib/iomgr/iomgr_windows.cc",
"src/core/lib/iomgr/is_epollexclusive_available.cc", "src/core/lib/iomgr/is_epollexclusive_available.cc",
"src/core/lib/iomgr/grpc_if_nametoindex_posix.cc",
"src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc",
"src/core/lib/iomgr/load_file.cc", "src/core/lib/iomgr/load_file.cc",
"src/core/lib/iomgr/lockfree_event.cc", "src/core/lib/iomgr/lockfree_event.cc",
"src/core/lib/iomgr/network_status_tracker.cc", "src/core/lib/iomgr/network_status_tracker.cc",
@ -873,6 +875,7 @@ grpc_cc_library(
"src/core/lib/iomgr/executor.h", "src/core/lib/iomgr/executor.h",
"src/core/lib/iomgr/gethostname.h", "src/core/lib/iomgr/gethostname.h",
"src/core/lib/iomgr/gevent_util.h", "src/core/lib/iomgr/gevent_util.h",
"src/core/lib/iomgr/grpc_if_nametoindex.h",
"src/core/lib/iomgr/internal_errqueue.h", "src/core/lib/iomgr/internal_errqueue.h",
"src/core/lib/iomgr/iocp_windows.h", "src/core/lib/iomgr/iocp_windows.h",
"src/core/lib/iomgr/iomgr.h", "src/core/lib/iomgr/iomgr.h",

@ -371,11 +371,17 @@ add_dependencies(buildtests_c murmur_hash_test)
add_dependencies(buildtests_c no_server_test) add_dependencies(buildtests_c no_server_test)
add_dependencies(buildtests_c num_external_connectivity_watchers_test) add_dependencies(buildtests_c num_external_connectivity_watchers_test)
add_dependencies(buildtests_c parse_address_test) add_dependencies(buildtests_c parse_address_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_c parse_address_with_named_scope_id_test)
endif()
add_dependencies(buildtests_c percent_encoding_test) add_dependencies(buildtests_c percent_encoding_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_c resolve_address_posix_test) add_dependencies(buildtests_c resolve_address_using_ares_resolver_posix_test)
endif() endif()
add_dependencies(buildtests_c resolve_address_using_ares_resolver_test) add_dependencies(buildtests_c resolve_address_using_ares_resolver_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_c resolve_address_using_native_resolver_posix_test)
endif()
add_dependencies(buildtests_c resolve_address_using_native_resolver_test) add_dependencies(buildtests_c resolve_address_using_native_resolver_test)
add_dependencies(buildtests_c resource_quota_test) add_dependencies(buildtests_c resource_quota_test)
add_dependencies(buildtests_c secure_channel_create_test) add_dependencies(buildtests_c secure_channel_create_test)
@ -989,6 +995,8 @@ add_library(grpc
src/core/lib/iomgr/gethostname_fallback.cc src/core/lib/iomgr/gethostname_fallback.cc
src/core/lib/iomgr/gethostname_host_name_max.cc src/core/lib/iomgr/gethostname_host_name_max.cc
src/core/lib/iomgr/gethostname_sysconf.cc src/core/lib/iomgr/gethostname_sysconf.cc
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
src/core/lib/iomgr/internal_errqueue.cc src/core/lib/iomgr/internal_errqueue.cc
src/core/lib/iomgr/iocp_windows.cc src/core/lib/iomgr/iocp_windows.cc
src/core/lib/iomgr/iomgr.cc src/core/lib/iomgr/iomgr.cc
@ -1411,6 +1419,8 @@ add_library(grpc_cronet
src/core/lib/iomgr/gethostname_fallback.cc src/core/lib/iomgr/gethostname_fallback.cc
src/core/lib/iomgr/gethostname_host_name_max.cc src/core/lib/iomgr/gethostname_host_name_max.cc
src/core/lib/iomgr/gethostname_sysconf.cc src/core/lib/iomgr/gethostname_sysconf.cc
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
src/core/lib/iomgr/internal_errqueue.cc src/core/lib/iomgr/internal_errqueue.cc
src/core/lib/iomgr/iocp_windows.cc src/core/lib/iomgr/iocp_windows.cc
src/core/lib/iomgr/iomgr.cc src/core/lib/iomgr/iomgr.cc
@ -1817,6 +1827,8 @@ add_library(grpc_test_util
src/core/lib/iomgr/gethostname_fallback.cc src/core/lib/iomgr/gethostname_fallback.cc
src/core/lib/iomgr/gethostname_host_name_max.cc src/core/lib/iomgr/gethostname_host_name_max.cc
src/core/lib/iomgr/gethostname_sysconf.cc src/core/lib/iomgr/gethostname_sysconf.cc
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
src/core/lib/iomgr/internal_errqueue.cc src/core/lib/iomgr/internal_errqueue.cc
src/core/lib/iomgr/iocp_windows.cc src/core/lib/iomgr/iocp_windows.cc
src/core/lib/iomgr/iomgr.cc src/core/lib/iomgr/iomgr.cc
@ -2139,6 +2151,8 @@ add_library(grpc_test_util_unsecure
src/core/lib/iomgr/gethostname_fallback.cc src/core/lib/iomgr/gethostname_fallback.cc
src/core/lib/iomgr/gethostname_host_name_max.cc src/core/lib/iomgr/gethostname_host_name_max.cc
src/core/lib/iomgr/gethostname_sysconf.cc src/core/lib/iomgr/gethostname_sysconf.cc
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
src/core/lib/iomgr/internal_errqueue.cc src/core/lib/iomgr/internal_errqueue.cc
src/core/lib/iomgr/iocp_windows.cc src/core/lib/iomgr/iocp_windows.cc
src/core/lib/iomgr/iomgr.cc src/core/lib/iomgr/iomgr.cc
@ -2438,6 +2452,8 @@ add_library(grpc_unsecure
src/core/lib/iomgr/gethostname_fallback.cc src/core/lib/iomgr/gethostname_fallback.cc
src/core/lib/iomgr/gethostname_host_name_max.cc src/core/lib/iomgr/gethostname_host_name_max.cc
src/core/lib/iomgr/gethostname_sysconf.cc src/core/lib/iomgr/gethostname_sysconf.cc
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
src/core/lib/iomgr/internal_errqueue.cc src/core/lib/iomgr/internal_errqueue.cc
src/core/lib/iomgr/iocp_windows.cc src/core/lib/iomgr/iocp_windows.cc
src/core/lib/iomgr/iomgr.cc src/core/lib/iomgr/iomgr.cc
@ -3323,6 +3339,8 @@ add_library(grpc++_cronet
src/core/lib/iomgr/gethostname_fallback.cc src/core/lib/iomgr/gethostname_fallback.cc
src/core/lib/iomgr/gethostname_host_name_max.cc src/core/lib/iomgr/gethostname_host_name_max.cc
src/core/lib/iomgr/gethostname_sysconf.cc src/core/lib/iomgr/gethostname_sysconf.cc
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
src/core/lib/iomgr/internal_errqueue.cc src/core/lib/iomgr/internal_errqueue.cc
src/core/lib/iomgr/iocp_windows.cc src/core/lib/iomgr/iocp_windows.cc
src/core/lib/iomgr/iomgr.cc src/core/lib/iomgr/iomgr.cc
@ -9132,6 +9150,42 @@ target_link_libraries(parse_address_test
endif (gRPC_BUILD_TESTS) endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(parse_address_with_named_scope_id_test
test/core/client_channel/parse_address_with_named_scope_id_test.cc
)
target_include_directories(parse_address_with_named_scope_id_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR}
)
target_link_libraries(parse_address_with_named_scope_id_test
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc
gpr
)
# avoid dependency on libstdc++
if (_gRPC_CORE_NOSTDCXX_FLAGS)
set_target_properties(parse_address_with_named_scope_id_test PROPERTIES LINKER_LANGUAGE C)
target_compile_options(parse_address_with_named_scope_id_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${_gRPC_CORE_NOSTDCXX_FLAGS}>)
endif()
endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(percent_encoding_test add_executable(percent_encoding_test
test/core/slice/percent_encoding_test.cc test/core/slice/percent_encoding_test.cc
@ -9168,12 +9222,12 @@ endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(resolve_address_posix_test add_executable(resolve_address_using_ares_resolver_posix_test
test/core/iomgr/resolve_address_posix_test.cc test/core/iomgr/resolve_address_posix_test.cc
) )
target_include_directories(resolve_address_posix_test target_include_directories(resolve_address_using_ares_resolver_posix_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
@ -9186,7 +9240,7 @@ target_include_directories(resolve_address_posix_test
PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR}
) )
target_link_libraries(resolve_address_posix_test target_link_libraries(resolve_address_using_ares_resolver_posix_test
${_gRPC_ALLTARGETS_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util grpc_test_util
grpc grpc
@ -9195,8 +9249,8 @@ target_link_libraries(resolve_address_posix_test
# avoid dependency on libstdc++ # avoid dependency on libstdc++
if (_gRPC_CORE_NOSTDCXX_FLAGS) if (_gRPC_CORE_NOSTDCXX_FLAGS)
set_target_properties(resolve_address_posix_test PROPERTIES LINKER_LANGUAGE C) set_target_properties(resolve_address_using_ares_resolver_posix_test PROPERTIES LINKER_LANGUAGE C)
target_compile_options(resolve_address_posix_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${_gRPC_CORE_NOSTDCXX_FLAGS}>) target_compile_options(resolve_address_using_ares_resolver_posix_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${_gRPC_CORE_NOSTDCXX_FLAGS}>)
endif() endif()
endif() endif()
@ -9236,6 +9290,42 @@ target_link_libraries(resolve_address_using_ares_resolver_test
endif (gRPC_BUILD_TESTS) endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(resolve_address_using_native_resolver_posix_test
test/core/iomgr/resolve_address_posix_test.cc
)
target_include_directories(resolve_address_using_native_resolver_posix_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR}
)
target_link_libraries(resolve_address_using_native_resolver_posix_test
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc
gpr
)
# avoid dependency on libstdc++
if (_gRPC_CORE_NOSTDCXX_FLAGS)
set_target_properties(resolve_address_using_native_resolver_posix_test PROPERTIES LINKER_LANGUAGE C)
target_compile_options(resolve_address_using_native_resolver_posix_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${_gRPC_CORE_NOSTDCXX_FLAGS}>)
endif()
endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
add_executable(resolve_address_using_native_resolver_test add_executable(resolve_address_using_native_resolver_test
test/core/iomgr/resolve_address_test.cc test/core/iomgr/resolve_address_test.cc

@ -1076,11 +1076,13 @@ nanopb_fuzzer_serverlist_test: $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test
no_server_test: $(BINDIR)/$(CONFIG)/no_server_test no_server_test: $(BINDIR)/$(CONFIG)/no_server_test
num_external_connectivity_watchers_test: $(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test num_external_connectivity_watchers_test: $(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test
parse_address_test: $(BINDIR)/$(CONFIG)/parse_address_test parse_address_test: $(BINDIR)/$(CONFIG)/parse_address_test
parse_address_with_named_scope_id_test: $(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test
percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer
percent_encode_fuzzer: $(BINDIR)/$(CONFIG)/percent_encode_fuzzer percent_encode_fuzzer: $(BINDIR)/$(CONFIG)/percent_encode_fuzzer
percent_encoding_test: $(BINDIR)/$(CONFIG)/percent_encoding_test percent_encoding_test: $(BINDIR)/$(CONFIG)/percent_encoding_test
resolve_address_posix_test: $(BINDIR)/$(CONFIG)/resolve_address_posix_test resolve_address_using_ares_resolver_posix_test: $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test
resolve_address_using_ares_resolver_test: $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test resolve_address_using_ares_resolver_test: $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test
resolve_address_using_native_resolver_posix_test: $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test
resolve_address_using_native_resolver_test: $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test resolve_address_using_native_resolver_test: $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test
resource_quota_test: $(BINDIR)/$(CONFIG)/resource_quota_test resource_quota_test: $(BINDIR)/$(CONFIG)/resource_quota_test
secure_channel_create_test: $(BINDIR)/$(CONFIG)/secure_channel_create_test secure_channel_create_test: $(BINDIR)/$(CONFIG)/secure_channel_create_test
@ -1527,9 +1529,11 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/no_server_test \ $(BINDIR)/$(CONFIG)/no_server_test \
$(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test \ $(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test \
$(BINDIR)/$(CONFIG)/parse_address_test \ $(BINDIR)/$(CONFIG)/parse_address_test \
$(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test \
$(BINDIR)/$(CONFIG)/percent_encoding_test \ $(BINDIR)/$(CONFIG)/percent_encoding_test \
$(BINDIR)/$(CONFIG)/resolve_address_posix_test \ $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test \
$(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test \ $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test \
$(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test \
$(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test \ $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test \
$(BINDIR)/$(CONFIG)/resource_quota_test \ $(BINDIR)/$(CONFIG)/resource_quota_test \
$(BINDIR)/$(CONFIG)/secure_channel_create_test \ $(BINDIR)/$(CONFIG)/secure_channel_create_test \
@ -2129,12 +2133,16 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test || ( echo test num_external_connectivity_watchers_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test || ( echo test num_external_connectivity_watchers_test failed ; exit 1 )
$(E) "[RUN] Testing parse_address_test" $(E) "[RUN] Testing parse_address_test"
$(Q) $(BINDIR)/$(CONFIG)/parse_address_test || ( echo test parse_address_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/parse_address_test || ( echo test parse_address_test failed ; exit 1 )
$(E) "[RUN] Testing parse_address_with_named_scope_id_test"
$(Q) $(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test || ( echo test parse_address_with_named_scope_id_test failed ; exit 1 )
$(E) "[RUN] Testing percent_encoding_test" $(E) "[RUN] Testing percent_encoding_test"
$(Q) $(BINDIR)/$(CONFIG)/percent_encoding_test || ( echo test percent_encoding_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/percent_encoding_test || ( echo test percent_encoding_test failed ; exit 1 )
$(E) "[RUN] Testing resolve_address_posix_test" $(E) "[RUN] Testing resolve_address_using_ares_resolver_posix_test"
$(Q) $(BINDIR)/$(CONFIG)/resolve_address_posix_test || ( echo test resolve_address_posix_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test || ( echo test resolve_address_using_ares_resolver_posix_test failed ; exit 1 )
$(E) "[RUN] Testing resolve_address_using_ares_resolver_test" $(E) "[RUN] Testing resolve_address_using_ares_resolver_test"
$(Q) $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test || ( echo test resolve_address_using_ares_resolver_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test || ( echo test resolve_address_using_ares_resolver_test failed ; exit 1 )
$(E) "[RUN] Testing resolve_address_using_native_resolver_posix_test"
$(Q) $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test || ( echo test resolve_address_using_native_resolver_posix_test failed ; exit 1 )
$(E) "[RUN] Testing resolve_address_using_native_resolver_test" $(E) "[RUN] Testing resolve_address_using_native_resolver_test"
$(Q) $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test || ( echo test resolve_address_using_native_resolver_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test || ( echo test resolve_address_using_native_resolver_test failed ; exit 1 )
$(E) "[RUN] Testing resource_quota_test" $(E) "[RUN] Testing resource_quota_test"
@ -3504,6 +3512,8 @@ LIBGRPC_SRC = \
src/core/lib/iomgr/gethostname_fallback.cc \ src/core/lib/iomgr/gethostname_fallback.cc \
src/core/lib/iomgr/gethostname_host_name_max.cc \ src/core/lib/iomgr/gethostname_host_name_max.cc \
src/core/lib/iomgr/gethostname_sysconf.cc \ src/core/lib/iomgr/gethostname_sysconf.cc \
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \
src/core/lib/iomgr/internal_errqueue.cc \ src/core/lib/iomgr/internal_errqueue.cc \
src/core/lib/iomgr/iocp_windows.cc \ src/core/lib/iomgr/iocp_windows.cc \
src/core/lib/iomgr/iomgr.cc \ src/core/lib/iomgr/iomgr.cc \
@ -3920,6 +3930,8 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/iomgr/gethostname_fallback.cc \ src/core/lib/iomgr/gethostname_fallback.cc \
src/core/lib/iomgr/gethostname_host_name_max.cc \ src/core/lib/iomgr/gethostname_host_name_max.cc \
src/core/lib/iomgr/gethostname_sysconf.cc \ src/core/lib/iomgr/gethostname_sysconf.cc \
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \
src/core/lib/iomgr/internal_errqueue.cc \ src/core/lib/iomgr/internal_errqueue.cc \
src/core/lib/iomgr/iocp_windows.cc \ src/core/lib/iomgr/iocp_windows.cc \
src/core/lib/iomgr/iomgr.cc \ src/core/lib/iomgr/iomgr.cc \
@ -4319,6 +4331,8 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/iomgr/gethostname_fallback.cc \ src/core/lib/iomgr/gethostname_fallback.cc \
src/core/lib/iomgr/gethostname_host_name_max.cc \ src/core/lib/iomgr/gethostname_host_name_max.cc \
src/core/lib/iomgr/gethostname_sysconf.cc \ src/core/lib/iomgr/gethostname_sysconf.cc \
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \
src/core/lib/iomgr/internal_errqueue.cc \ src/core/lib/iomgr/internal_errqueue.cc \
src/core/lib/iomgr/iocp_windows.cc \ src/core/lib/iomgr/iocp_windows.cc \
src/core/lib/iomgr/iomgr.cc \ src/core/lib/iomgr/iomgr.cc \
@ -4628,6 +4642,8 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
src/core/lib/iomgr/gethostname_fallback.cc \ src/core/lib/iomgr/gethostname_fallback.cc \
src/core/lib/iomgr/gethostname_host_name_max.cc \ src/core/lib/iomgr/gethostname_host_name_max.cc \
src/core/lib/iomgr/gethostname_sysconf.cc \ src/core/lib/iomgr/gethostname_sysconf.cc \
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \
src/core/lib/iomgr/internal_errqueue.cc \ src/core/lib/iomgr/internal_errqueue.cc \
src/core/lib/iomgr/iocp_windows.cc \ src/core/lib/iomgr/iocp_windows.cc \
src/core/lib/iomgr/iomgr.cc \ src/core/lib/iomgr/iomgr.cc \
@ -4901,6 +4917,8 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/iomgr/gethostname_fallback.cc \ src/core/lib/iomgr/gethostname_fallback.cc \
src/core/lib/iomgr/gethostname_host_name_max.cc \ src/core/lib/iomgr/gethostname_host_name_max.cc \
src/core/lib/iomgr/gethostname_sysconf.cc \ src/core/lib/iomgr/gethostname_sysconf.cc \
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \
src/core/lib/iomgr/internal_errqueue.cc \ src/core/lib/iomgr/internal_errqueue.cc \
src/core/lib/iomgr/iocp_windows.cc \ src/core/lib/iomgr/iocp_windows.cc \
src/core/lib/iomgr/iomgr.cc \ src/core/lib/iomgr/iomgr.cc \
@ -5763,6 +5781,8 @@ LIBGRPC++_CRONET_SRC = \
src/core/lib/iomgr/gethostname_fallback.cc \ src/core/lib/iomgr/gethostname_fallback.cc \
src/core/lib/iomgr/gethostname_host_name_max.cc \ src/core/lib/iomgr/gethostname_host_name_max.cc \
src/core/lib/iomgr/gethostname_sysconf.cc \ src/core/lib/iomgr/gethostname_sysconf.cc \
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \
src/core/lib/iomgr/internal_errqueue.cc \ src/core/lib/iomgr/internal_errqueue.cc \
src/core/lib/iomgr/iocp_windows.cc \ src/core/lib/iomgr/iocp_windows.cc \
src/core/lib/iomgr/iomgr.cc \ src/core/lib/iomgr/iomgr.cc \
@ -13988,6 +14008,38 @@ endif
endif endif
PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_SRC = \
test/core/client_channel/parse_address_with_named_scope_id_test.cc \
PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test: $(PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test
endif
$(OBJDIR)/$(CONFIG)/test/core/client_channel/parse_address_with_named_scope_id_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_parse_address_with_named_scope_id_test: $(PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_OBJS:.o=.dep)
endif
endif
PERCENT_DECODE_FUZZER_SRC = \ PERCENT_DECODE_FUZZER_SRC = \
test/core/slice/percent_decode_fuzzer.cc \ test/core/slice/percent_decode_fuzzer.cc \
@ -14084,34 +14136,34 @@ endif
endif endif
RESOLVE_ADDRESS_POSIX_TEST_SRC = \ RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_SRC = \
test/core/iomgr/resolve_address_posix_test.cc \ test/core/iomgr/resolve_address_posix_test.cc \
RESOLVE_ADDRESS_POSIX_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(RESOLVE_ADDRESS_POSIX_TEST_SRC)))) RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL. # You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/resolve_address_posix_test: openssl_dep_error $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test: openssl_dep_error
else else
$(BINDIR)/$(CONFIG)/resolve_address_posix_test: $(RESOLVE_ADDRESS_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test: $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(RESOLVE_ADDRESS_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_posix_test $(Q) $(LD) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test
endif endif
$(OBJDIR)/$(CONFIG)/test/core/iomgr/resolve_address_posix_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/iomgr/resolve_address_posix_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_resolve_address_posix_test: $(RESOLVE_ADDRESS_POSIX_TEST_OBJS:.o=.dep) deps_resolve_address_using_ares_resolver_posix_test: $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true) ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true) ifneq ($(NO_DEPS),true)
-include $(RESOLVE_ADDRESS_POSIX_TEST_OBJS:.o=.dep) -include $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_OBJS:.o=.dep)
endif endif
endif endif
@ -14148,6 +14200,38 @@ endif
endif endif
RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_SRC = \
test/core/iomgr/resolve_address_posix_test.cc \
RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test: $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test
endif
$(OBJDIR)/$(CONFIG)/test/core/iomgr/resolve_address_posix_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_resolve_address_using_native_resolver_posix_test: $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_OBJS:.o=.dep)
endif
endif
RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_TEST_SRC = \ RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_TEST_SRC = \
test/core/iomgr/resolve_address_test.cc \ test/core/iomgr/resolve_address_test.cc \

@ -276,6 +276,8 @@ filegroups:
- src/core/lib/iomgr/gethostname_fallback.cc - src/core/lib/iomgr/gethostname_fallback.cc
- src/core/lib/iomgr/gethostname_host_name_max.cc - src/core/lib/iomgr/gethostname_host_name_max.cc
- src/core/lib/iomgr/gethostname_sysconf.cc - src/core/lib/iomgr/gethostname_sysconf.cc
- src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
- src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
- src/core/lib/iomgr/internal_errqueue.cc - src/core/lib/iomgr/internal_errqueue.cc
- src/core/lib/iomgr/iocp_windows.cc - src/core/lib/iomgr/iocp_windows.cc
- src/core/lib/iomgr/iomgr.cc - src/core/lib/iomgr/iomgr.cc
@ -452,6 +454,7 @@ filegroups:
- src/core/lib/iomgr/exec_ctx.h - src/core/lib/iomgr/exec_ctx.h
- src/core/lib/iomgr/executor.h - src/core/lib/iomgr/executor.h
- src/core/lib/iomgr/gethostname.h - src/core/lib/iomgr/gethostname.h
- src/core/lib/iomgr/grpc_if_nametoindex.h
- src/core/lib/iomgr/internal_errqueue.h - src/core/lib/iomgr/internal_errqueue.h
- src/core/lib/iomgr/iocp_windows.h - src/core/lib/iomgr/iocp_windows.h
- src/core/lib/iomgr/iomgr.h - src/core/lib/iomgr/iomgr.h
@ -3241,6 +3244,20 @@ targets:
- grpc - grpc
- gpr - gpr
uses_polling: false uses_polling: false
- name: parse_address_with_named_scope_id_test
build: test
language: c
src:
- test/core/client_channel/parse_address_with_named_scope_id_test.cc
deps:
- grpc_test_util
- grpc
- gpr
platforms:
- mac
- linux
- posix
uses_polling: false
- name: percent_decode_fuzzer - name: percent_decode_fuzzer
build: fuzzer build: fuzzer
language: c language: c
@ -3275,7 +3292,7 @@ targets:
- grpc - grpc
- gpr - gpr
uses_polling: false uses_polling: false
- name: resolve_address_posix_test - name: resolve_address_using_ares_resolver_posix_test
build: test build: test
language: c language: c
src: src:
@ -3284,6 +3301,8 @@ targets:
- grpc_test_util - grpc_test_util
- grpc - grpc
- gpr - gpr
args:
- --resolver=ares
exclude_iomgrs: exclude_iomgrs:
- uv - uv
platforms: platforms:
@ -3301,6 +3320,23 @@ targets:
- gpr - gpr
args: args:
- --resolver=ares - --resolver=ares
- name: resolve_address_using_native_resolver_posix_test
build: test
language: c
src:
- test/core/iomgr/resolve_address_posix_test.cc
deps:
- grpc_test_util
- grpc
- gpr
args:
- --resolver=native
exclude_iomgrs:
- uv
platforms:
- mac
- linux
- posix
- name: resolve_address_using_native_resolver_test - name: resolve_address_using_native_resolver_test
build: test build: test
language: c language: c

@ -128,6 +128,8 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/gethostname_fallback.cc \ src/core/lib/iomgr/gethostname_fallback.cc \
src/core/lib/iomgr/gethostname_host_name_max.cc \ src/core/lib/iomgr/gethostname_host_name_max.cc \
src/core/lib/iomgr/gethostname_sysconf.cc \ src/core/lib/iomgr/gethostname_sysconf.cc \
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \
src/core/lib/iomgr/internal_errqueue.cc \ src/core/lib/iomgr/internal_errqueue.cc \
src/core/lib/iomgr/iocp_windows.cc \ src/core/lib/iomgr/iocp_windows.cc \
src/core/lib/iomgr/iomgr.cc \ src/core/lib/iomgr/iomgr.cc \

@ -103,6 +103,8 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\iomgr\\gethostname_fallback.cc " + "src\\core\\lib\\iomgr\\gethostname_fallback.cc " +
"src\\core\\lib\\iomgr\\gethostname_host_name_max.cc " + "src\\core\\lib\\iomgr\\gethostname_host_name_max.cc " +
"src\\core\\lib\\iomgr\\gethostname_sysconf.cc " + "src\\core\\lib\\iomgr\\gethostname_sysconf.cc " +
"src\\core\\lib\\iomgr\\grpc_if_nametoindex_posix.cc " +
"src\\core\\lib\\iomgr\\grpc_if_nametoindex_unsupported.cc " +
"src\\core\\lib\\iomgr\\internal_errqueue.cc " + "src\\core\\lib\\iomgr\\internal_errqueue.cc " +
"src\\core\\lib\\iomgr\\iocp_windows.cc " + "src\\core\\lib\\iomgr\\iocp_windows.cc " +
"src\\core\\lib\\iomgr\\iomgr.cc " + "src\\core\\lib\\iomgr\\iomgr.cc " +

@ -423,6 +423,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/exec_ctx.h', 'src/core/lib/iomgr/exec_ctx.h',
'src/core/lib/iomgr/executor.h', 'src/core/lib/iomgr/executor.h',
'src/core/lib/iomgr/gethostname.h', 'src/core/lib/iomgr/gethostname.h',
'src/core/lib/iomgr/grpc_if_nametoindex.h',
'src/core/lib/iomgr/internal_errqueue.h', 'src/core/lib/iomgr/internal_errqueue.h',
'src/core/lib/iomgr/iocp_windows.h', 'src/core/lib/iomgr/iocp_windows.h',
'src/core/lib/iomgr/iomgr.h', 'src/core/lib/iomgr/iomgr.h',
@ -616,6 +617,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/exec_ctx.h', 'src/core/lib/iomgr/exec_ctx.h',
'src/core/lib/iomgr/executor.h', 'src/core/lib/iomgr/executor.h',
'src/core/lib/iomgr/gethostname.h', 'src/core/lib/iomgr/gethostname.h',
'src/core/lib/iomgr/grpc_if_nametoindex.h',
'src/core/lib/iomgr/internal_errqueue.h', 'src/core/lib/iomgr/internal_errqueue.h',
'src/core/lib/iomgr/iocp_windows.h', 'src/core/lib/iomgr/iocp_windows.h',
'src/core/lib/iomgr/iomgr.h', 'src/core/lib/iomgr/iomgr.h',

@ -417,6 +417,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/exec_ctx.h', 'src/core/lib/iomgr/exec_ctx.h',
'src/core/lib/iomgr/executor.h', 'src/core/lib/iomgr/executor.h',
'src/core/lib/iomgr/gethostname.h', 'src/core/lib/iomgr/gethostname.h',
'src/core/lib/iomgr/grpc_if_nametoindex.h',
'src/core/lib/iomgr/internal_errqueue.h', 'src/core/lib/iomgr/internal_errqueue.h',
'src/core/lib/iomgr/iocp_windows.h', 'src/core/lib/iomgr/iocp_windows.h',
'src/core/lib/iomgr/iomgr.h', 'src/core/lib/iomgr/iomgr.h',
@ -571,6 +572,8 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/gethostname_fallback.cc', 'src/core/lib/iomgr/gethostname_fallback.cc',
'src/core/lib/iomgr/gethostname_host_name_max.cc', 'src/core/lib/iomgr/gethostname_host_name_max.cc',
'src/core/lib/iomgr/gethostname_sysconf.cc', 'src/core/lib/iomgr/gethostname_sysconf.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_posix.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc',
'src/core/lib/iomgr/internal_errqueue.cc', 'src/core/lib/iomgr/internal_errqueue.cc',
'src/core/lib/iomgr/iocp_windows.cc', 'src/core/lib/iomgr/iocp_windows.cc',
'src/core/lib/iomgr/iomgr.cc', 'src/core/lib/iomgr/iomgr.cc',
@ -1040,6 +1043,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/exec_ctx.h', 'src/core/lib/iomgr/exec_ctx.h',
'src/core/lib/iomgr/executor.h', 'src/core/lib/iomgr/executor.h',
'src/core/lib/iomgr/gethostname.h', 'src/core/lib/iomgr/gethostname.h',
'src/core/lib/iomgr/grpc_if_nametoindex.h',
'src/core/lib/iomgr/internal_errqueue.h', 'src/core/lib/iomgr/internal_errqueue.h',
'src/core/lib/iomgr/iocp_windows.h', 'src/core/lib/iomgr/iocp_windows.h',
'src/core/lib/iomgr/iomgr.h', 'src/core/lib/iomgr/iomgr.h',

@ -353,6 +353,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/exec_ctx.h ) s.files += %w( src/core/lib/iomgr/exec_ctx.h )
s.files += %w( src/core/lib/iomgr/executor.h ) s.files += %w( src/core/lib/iomgr/executor.h )
s.files += %w( src/core/lib/iomgr/gethostname.h ) s.files += %w( src/core/lib/iomgr/gethostname.h )
s.files += %w( src/core/lib/iomgr/grpc_if_nametoindex.h )
s.files += %w( src/core/lib/iomgr/internal_errqueue.h ) s.files += %w( src/core/lib/iomgr/internal_errqueue.h )
s.files += %w( src/core/lib/iomgr/iocp_windows.h ) s.files += %w( src/core/lib/iomgr/iocp_windows.h )
s.files += %w( src/core/lib/iomgr/iomgr.h ) s.files += %w( src/core/lib/iomgr/iomgr.h )
@ -507,6 +508,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/gethostname_fallback.cc ) s.files += %w( src/core/lib/iomgr/gethostname_fallback.cc )
s.files += %w( src/core/lib/iomgr/gethostname_host_name_max.cc ) s.files += %w( src/core/lib/iomgr/gethostname_host_name_max.cc )
s.files += %w( src/core/lib/iomgr/gethostname_sysconf.cc ) s.files += %w( src/core/lib/iomgr/gethostname_sysconf.cc )
s.files += %w( src/core/lib/iomgr/grpc_if_nametoindex_posix.cc )
s.files += %w( src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc )
s.files += %w( src/core/lib/iomgr/internal_errqueue.cc ) s.files += %w( src/core/lib/iomgr/internal_errqueue.cc )
s.files += %w( src/core/lib/iomgr/iocp_windows.cc ) s.files += %w( src/core/lib/iomgr/iocp_windows.cc )
s.files += %w( src/core/lib/iomgr/iomgr.cc ) s.files += %w( src/core/lib/iomgr/iomgr.cc )

@ -310,6 +310,8 @@
'src/core/lib/iomgr/gethostname_fallback.cc', 'src/core/lib/iomgr/gethostname_fallback.cc',
'src/core/lib/iomgr/gethostname_host_name_max.cc', 'src/core/lib/iomgr/gethostname_host_name_max.cc',
'src/core/lib/iomgr/gethostname_sysconf.cc', 'src/core/lib/iomgr/gethostname_sysconf.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_posix.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc',
'src/core/lib/iomgr/internal_errqueue.cc', 'src/core/lib/iomgr/internal_errqueue.cc',
'src/core/lib/iomgr/iocp_windows.cc', 'src/core/lib/iomgr/iocp_windows.cc',
'src/core/lib/iomgr/iomgr.cc', 'src/core/lib/iomgr/iomgr.cc',
@ -672,6 +674,8 @@
'src/core/lib/iomgr/gethostname_fallback.cc', 'src/core/lib/iomgr/gethostname_fallback.cc',
'src/core/lib/iomgr/gethostname_host_name_max.cc', 'src/core/lib/iomgr/gethostname_host_name_max.cc',
'src/core/lib/iomgr/gethostname_sysconf.cc', 'src/core/lib/iomgr/gethostname_sysconf.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_posix.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc',
'src/core/lib/iomgr/internal_errqueue.cc', 'src/core/lib/iomgr/internal_errqueue.cc',
'src/core/lib/iomgr/iocp_windows.cc', 'src/core/lib/iomgr/iocp_windows.cc',
'src/core/lib/iomgr/iomgr.cc', 'src/core/lib/iomgr/iomgr.cc',
@ -914,6 +918,8 @@
'src/core/lib/iomgr/gethostname_fallback.cc', 'src/core/lib/iomgr/gethostname_fallback.cc',
'src/core/lib/iomgr/gethostname_host_name_max.cc', 'src/core/lib/iomgr/gethostname_host_name_max.cc',
'src/core/lib/iomgr/gethostname_sysconf.cc', 'src/core/lib/iomgr/gethostname_sysconf.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_posix.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc',
'src/core/lib/iomgr/internal_errqueue.cc', 'src/core/lib/iomgr/internal_errqueue.cc',
'src/core/lib/iomgr/iocp_windows.cc', 'src/core/lib/iomgr/iocp_windows.cc',
'src/core/lib/iomgr/iomgr.cc', 'src/core/lib/iomgr/iomgr.cc',
@ -1133,6 +1139,8 @@
'src/core/lib/iomgr/gethostname_fallback.cc', 'src/core/lib/iomgr/gethostname_fallback.cc',
'src/core/lib/iomgr/gethostname_host_name_max.cc', 'src/core/lib/iomgr/gethostname_host_name_max.cc',
'src/core/lib/iomgr/gethostname_sysconf.cc', 'src/core/lib/iomgr/gethostname_sysconf.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_posix.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc',
'src/core/lib/iomgr/internal_errqueue.cc', 'src/core/lib/iomgr/internal_errqueue.cc',
'src/core/lib/iomgr/iocp_windows.cc', 'src/core/lib/iomgr/iocp_windows.cc',
'src/core/lib/iomgr/iomgr.cc', 'src/core/lib/iomgr/iomgr.cc',

@ -358,6 +358,7 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/exec_ctx.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/exec_ctx.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/executor.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/executor.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/gethostname.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/gethostname.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/grpc_if_nametoindex.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/internal_errqueue.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/internal_errqueue.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/iocp_windows.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/iocp_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/iomgr.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/iomgr.h" role="src" />
@ -512,6 +513,8 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/gethostname_fallback.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/gethostname_fallback.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/gethostname_host_name_max.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/gethostname_host_name_max.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/gethostname_sysconf.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/gethostname_sysconf.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/grpc_if_nametoindex_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/internal_errqueue.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/internal_errqueue.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/iocp_windows.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/iocp_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/iomgr.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/iomgr.cc" role="src" />

@ -19,6 +19,7 @@
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include "src/core/ext/filters/client_channel/parse_address.h" #include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/lib/iomgr/grpc_if_nametoindex.h"
#include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h" #include "src/core/lib/iomgr/socket_utils.h"
@ -35,6 +36,11 @@
#include "src/core/lib/gpr/host_port.h" #include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/string.h"
#ifdef GRPC_POSIX_SOCKET
#include <errno.h>
#include <net/if.h>
#endif
#ifdef GRPC_HAVE_UNIX_SOCKET #ifdef GRPC_HAVE_UNIX_SOCKET
bool grpc_parse_unix(const grpc_uri* uri, bool grpc_parse_unix(const grpc_uri* uri,
@ -69,7 +75,12 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
// Split host and port. // Split host and port.
char* host; char* host;
char* port; char* port;
if (!gpr_split_host_port(hostport, &host, &port)) return false; if (!gpr_split_host_port(hostport, &host, &port)) {
if (log_errors) {
gpr_log(GPR_ERROR, "Failed gpr_split_host_port(%s, ...)", hostport);
}
return false;
}
// Parse IP address. // Parse IP address.
memset(addr, 0, sizeof(*addr)); memset(addr, 0, sizeof(*addr));
addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in)); addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in));
@ -115,7 +126,12 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
// Split host and port. // Split host and port.
char* host; char* host;
char* port; char* port;
if (!gpr_split_host_port(hostport, &host, &port)) return false; if (!gpr_split_host_port(hostport, &host, &port)) {
if (log_errors) {
gpr_log(GPR_ERROR, "Failed gpr_split_host_port(%s, ...)", hostport);
}
return false;
}
// Parse IP address. // Parse IP address.
memset(addr, 0, sizeof(*addr)); memset(addr, 0, sizeof(*addr));
addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in6)); addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in6));
@ -150,11 +166,14 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
if (gpr_parse_bytes_to_uint32(host_end + 1, if (gpr_parse_bytes_to_uint32(host_end + 1,
strlen(host) - host_without_scope_len - 1, strlen(host) - host_without_scope_len - 1,
&sin6_scope_id) == 0) { &sin6_scope_id) == 0) {
if (log_errors) { if ((sin6_scope_id = grpc_if_nametoindex(host_end + 1)) == 0) {
gpr_log(GPR_ERROR, "invalid ipv6 scope id: '%s'", host_end + 1); gpr_log(GPR_ERROR,
} "Invalid interface name: '%s'. "
"Non-numeric and failed if_nametoindex.",
host_end + 1);
goto done; goto done;
} }
}
// Handle "sin6_scope_id" being type "u_long". See grpc issue #10027. // Handle "sin6_scope_id" being type "u_long". See grpc issue #10027.
in6->sin6_scope_id = sin6_scope_id; in6->sin6_scope_id = sin6_scope_id;
} else { } else {

@ -0,0 +1,30 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_CORE_LIB_IOMGR_GRPC_IF_NAMETOINDEX_H
#define GRPC_CORE_LIB_IOMGR_GRPC_IF_NAMETOINDEX_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
/* Returns the interface index corresponding to the interface "name" provided.
* Returns non-zero upon success, and zero upon failure. */
uint32_t grpc_if_nametoindex(char* name);
#endif /* GRPC_CORE_LIB_IOMGR_GRPC_IF_NAMETOINDEX_H */

@ -0,0 +1,41 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_POSIX_SOCKET
#include "src/core/lib/iomgr/grpc_if_nametoindex.h"
#include <errno.h>
#include <net/if.h>
#include <grpc/support/log.h>
uint32_t grpc_if_nametoindex(char* name) {
uint32_t out = if_nametoindex(name);
if (out == 0) {
gpr_log(GPR_DEBUG, "if_nametoindex failed for name %s. errno %d", name,
errno);
}
return out;
}
#endif /* GRPC_POSIX_SOCKET */

@ -0,0 +1,37 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
#ifndef GRPC_POSIX_SOCKET
#include "src/core/lib/iomgr/grpc_if_nametoindex.h"
#include <grpc/support/log.h>
uint32_t grpc_if_nametoindex(char* name) {
gpr_log(GPR_DEBUG,
"Not attempting to convert interface name %s to index for current "
"platform.",
name);
return 0;
}
#endif /* GRPC_POSIX_SOCKET */

@ -102,6 +102,8 @@ CORE_SOURCE_FILES = [
'src/core/lib/iomgr/gethostname_fallback.cc', 'src/core/lib/iomgr/gethostname_fallback.cc',
'src/core/lib/iomgr/gethostname_host_name_max.cc', 'src/core/lib/iomgr/gethostname_host_name_max.cc',
'src/core/lib/iomgr/gethostname_sysconf.cc', 'src/core/lib/iomgr/gethostname_sysconf.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_posix.cc',
'src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc',
'src/core/lib/iomgr/internal_errqueue.cc', 'src/core/lib/iomgr/internal_errqueue.cc',
'src/core/lib/iomgr/iocp_windows.cc', 'src/core/lib/iomgr/iocp_windows.cc',
'src/core/lib/iomgr/iomgr.cc', 'src/core/lib/iomgr/iomgr.cc',

@ -43,6 +43,17 @@ grpc_cc_test(
], ],
) )
grpc_cc_test(
name = "parse_address_with_named_scope_id_test",
srcs = ["parse_address_with_named_scope_id_test.cc"],
language = "C++",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
grpc_cc_test( grpc_cc_test(
name = "uri_parser_test", name = "uri_parser_test",
srcs = ["uri_parser_test.cc"], srcs = ["uri_parser_test.cc"],

@ -0,0 +1,126 @@
/*
*
* Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"
#include <net/if.h>
#include <string.h>
#ifdef GRPC_HAVE_UNIX_SOCKET
#include <sys/un.h>
#endif
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/socket_utils.h"
#include "test/core/util/test_config.h"
static void test_grpc_parse_ipv6_parity_with_getaddrinfo(
const char* target, const struct sockaddr_in6 result_from_getaddrinfo) {
// Get the sockaddr that gRPC's ipv6 resolver resolves this too.
grpc_core::ExecCtx exec_ctx;
grpc_uri* uri = grpc_uri_parse(target, 0);
grpc_resolved_address addr;
GPR_ASSERT(1 == grpc_parse_ipv6(uri, &addr));
grpc_sockaddr_in6* result_from_grpc_parser =
reinterpret_cast<grpc_sockaddr_in6*>(addr.addr);
// Compare the sockaddr returned from gRPC's ipv6 resolver with that returned
// from getaddrinfo.
GPR_ASSERT(result_from_grpc_parser->sin6_family == AF_INET6);
GPR_ASSERT(result_from_getaddrinfo.sin6_family == AF_INET6);
GPR_ASSERT(memcmp(&result_from_grpc_parser->sin6_addr,
&result_from_getaddrinfo.sin6_addr, sizeof(in6_addr)) == 0);
GPR_ASSERT(result_from_grpc_parser->sin6_scope_id ==
result_from_getaddrinfo.sin6_scope_id);
GPR_ASSERT(result_from_grpc_parser->sin6_scope_id != 0);
// TODO: compare sin6_flow_info fields? parse_ipv6 zero's this field as is.
// Cleanup
grpc_uri_destroy(uri);
}
struct sockaddr_in6 resolve_with_gettaddrinfo(const char* uri_text) {
grpc_uri* uri = grpc_uri_parse(uri_text, 0);
char* host = nullptr;
char* port = nullptr;
gpr_split_host_port(uri->path, &host, &port);
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_NUMERICHOST;
struct addrinfo* result;
int res = getaddrinfo(host, port, &hints, &result);
if (res != 0) {
gpr_log(GPR_ERROR,
"getaddrinfo failed to resolve host:%s port:%s. Error: %d.", host,
port, res);
abort();
}
size_t num_addrs_from_getaddrinfo = 0;
for (struct addrinfo* resp = result; resp != nullptr; resp = resp->ai_next) {
num_addrs_from_getaddrinfo++;
}
GPR_ASSERT(num_addrs_from_getaddrinfo == 1);
GPR_ASSERT(result->ai_family == AF_INET6);
struct sockaddr_in6 out =
*reinterpret_cast<struct sockaddr_in6*>(result->ai_addr);
// Cleanup
freeaddrinfo(result);
gpr_free(host);
gpr_free(port);
grpc_uri_destroy(uri);
return out;
}
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
char* arbitrary_interface_name = static_cast<char*>(gpr_zalloc(IF_NAMESIZE));
// Per RFC 3493, an interface index is a "small positive integer starts at 1".
// Probe candidate interface index numbers until we find one that the
// system recognizes, and then use that for the test.
for (size_t i = 1; i < 65536; i++) {
if (if_indextoname(i, arbitrary_interface_name) != nullptr) {
gpr_log(
GPR_DEBUG,
"Found interface at index %d named %s. Will use this for the test",
(int)i, arbitrary_interface_name);
break;
}
}
GPR_ASSERT(strlen(arbitrary_interface_name) > 0);
char* target = nullptr;
gpr_asprintf(&target, "ipv6:[fe80::1234%%%s]:12345",
arbitrary_interface_name);
struct sockaddr_in6 result_from_getaddrinfo =
resolve_with_gettaddrinfo(target);
// Run the test
gpr_log(GPR_DEBUG,
"Run test_grpc_parse_ipv6_parity_with_getaddrinfo with target: %s",
target);
test_grpc_parse_ipv6_parity_with_getaddrinfo(target, result_from_getaddrinfo);
// Cleanup
gpr_free(target);
gpr_free(arbitrary_interface_name);
grpc_shutdown();
}

@ -128,8 +128,25 @@ grpc_cc_test(
) )
grpc_cc_test( grpc_cc_test(
name = "resolve_address_posix_test", name = "resolve_address_using_ares_resolver_posix_test",
srcs = ["resolve_address_posix_test.cc"], srcs = ["resolve_address_posix_test.cc"],
args = [
"--resolver=ares",
],
language = "C++",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
],
)
grpc_cc_test(
name = "resolve_address_using_native_resolver_posix_test",
srcs = ["resolve_address_posix_test.cc"],
args = [
"--resolver=native",
],
language = "C++", language = "C++",
deps = [ deps = [
"//:gpr", "//:gpr",

@ -18,12 +18,14 @@
#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolve_address.h"
#include <net/if.h>
#include <string.h> #include <string.h>
#include <sys/un.h> #include <sys/un.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
@ -33,6 +35,7 @@
#include "src/core/lib/gprpp/thd.h" #include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/iomgr.h"
#include "test/core/util/cmdline.h"
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
static gpr_timespec test_deadline(void) { static gpr_timespec test_deadline(void) {
@ -117,12 +120,18 @@ static void must_succeed(void* argsp, grpc_error* err) {
GPR_ASSERT(args->addrs != nullptr); GPR_ASSERT(args->addrs != nullptr);
GPR_ASSERT(args->addrs->naddrs > 0); GPR_ASSERT(args->addrs->naddrs > 0);
gpr_atm_rel_store(&args->done_atm, 1); gpr_atm_rel_store(&args->done_atm, 1);
gpr_mu_lock(args->mu);
GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(args->pollset, nullptr));
gpr_mu_unlock(args->mu);
} }
static void must_fail(void* argsp, grpc_error* err) { static void must_fail(void* argsp, grpc_error* err) {
args_struct* args = static_cast<args_struct*>(argsp); args_struct* args = static_cast<args_struct*>(argsp);
GPR_ASSERT(err != GRPC_ERROR_NONE); GPR_ASSERT(err != GRPC_ERROR_NONE);
gpr_atm_rel_store(&args->done_atm, 1); gpr_atm_rel_store(&args->done_atm, 1);
gpr_mu_lock(args->mu);
GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(args->pollset, nullptr));
gpr_mu_unlock(args->mu);
} }
static void test_unix_socket(void) { static void test_unix_socket(void) {
@ -159,22 +168,92 @@ static void test_unix_socket_path_name_too_long(void) {
args_finish(&args); args_finish(&args);
} }
static void resolve_address_must_succeed(const char* target) {
grpc_core::ExecCtx exec_ctx;
args_struct args;
args_init(&args);
poll_pollset_until_request_done(&args);
grpc_resolve_address(
target, "1" /* port number */, args.pollset_set,
GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx),
&args.addrs);
grpc_core::ExecCtx::Get()->Flush();
args_finish(&args);
}
static void test_named_and_numeric_scope_ids(void) {
char* arbitrary_interface_name = static_cast<char*>(gpr_zalloc(IF_NAMESIZE));
int interface_index = 0;
// Probe candidate interface index numbers until we find one that the
// system recognizes, and then use that for the test.
for (size_t i = 1; i < 65536; i++) {
if (if_indextoname(i, arbitrary_interface_name) != nullptr) {
gpr_log(
GPR_DEBUG,
"Found interface at index %d named %s. Will use this for the test",
(int)i, arbitrary_interface_name);
interface_index = (int)i;
break;
}
}
GPR_ASSERT(strlen(arbitrary_interface_name) > 0);
// Test resolution of an ipv6 address with a named scope ID
gpr_log(GPR_DEBUG, "test resolution with a named scope ID");
char* target_with_named_scope_id = nullptr;
gpr_asprintf(&target_with_named_scope_id, "fe80::1234%%%s",
arbitrary_interface_name);
resolve_address_must_succeed(target_with_named_scope_id);
gpr_free(target_with_named_scope_id);
gpr_free(arbitrary_interface_name);
// Test resolution of an ipv6 address with a numeric scope ID
gpr_log(GPR_DEBUG, "test resolution with a numeric scope ID");
char* target_with_numeric_scope_id = nullptr;
gpr_asprintf(&target_with_numeric_scope_id, "fe80::1234%%%d",
interface_index);
resolve_address_must_succeed(target_with_numeric_scope_id);
gpr_free(target_with_numeric_scope_id);
}
int main(int argc, char** argv) { int main(int argc, char** argv) {
// First set the resolver type based off of --resolver
const char* resolver_type = nullptr;
gpr_cmdline* cl = gpr_cmdline_create("resolve address test");
gpr_cmdline_add_string(cl, "resolver", "Resolver type (ares or native)",
&resolver_type);
// In case that there are more than one argument on the command line,
// --resolver will always be the first one, so only parse the first argument
// (other arguments may be unknown to cl)
gpr_cmdline_parse(cl, argc > 2 ? 2 : argc, argv);
const char* cur_resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (cur_resolver != nullptr && strlen(cur_resolver) != 0) {
gpr_log(GPR_INFO, "Warning: overriding resolver setting of %s",
cur_resolver);
}
if (gpr_stricmp(resolver_type, "native") == 0) {
gpr_setenv("GRPC_DNS_RESOLVER", "native");
} else if (gpr_stricmp(resolver_type, "ares") == 0) {
gpr_setenv("GRPC_DNS_RESOLVER", "ares");
} else {
gpr_log(GPR_ERROR, "--resolver_type was not set to ares or native");
abort();
}
grpc::testing::TestEnvironment env(argc, argv); grpc::testing::TestEnvironment env(argc, argv);
grpc_init(); grpc_init();
{ {
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER"); test_named_and_numeric_scope_ids();
// c-ares resolver doesn't support UDS (ability for native DNS resolver // c-ares resolver doesn't support UDS (ability for native DNS resolver
// to handle this is only expected to be used by servers, which // to handle this is only expected to be used by servers, which
// unconditionally use the native DNS resolver). // unconditionally use the native DNS resolver).
char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver_env == nullptr || gpr_stricmp(resolver_env, "native") == 0) { if (resolver_env == nullptr || gpr_stricmp(resolver_env, "native") == 0) {
test_unix_socket(); test_unix_socket();
test_unix_socket_path_name_too_long(); test_unix_socket_path_name_too_long();
} }
gpr_free(resolver_env); gpr_free(resolver_env);
} }
gpr_cmdline_destroy(cl);
grpc_shutdown(); grpc_shutdown();
return 0; return 0;

@ -1100,6 +1100,7 @@ src/core/lib/iomgr/ev_posix.h \
src/core/lib/iomgr/exec_ctx.h \ src/core/lib/iomgr/exec_ctx.h \
src/core/lib/iomgr/executor.h \ src/core/lib/iomgr/executor.h \
src/core/lib/iomgr/gethostname.h \ src/core/lib/iomgr/gethostname.h \
src/core/lib/iomgr/grpc_if_nametoindex.h \
src/core/lib/iomgr/internal_errqueue.h \ src/core/lib/iomgr/internal_errqueue.h \
src/core/lib/iomgr/iocp_windows.h \ src/core/lib/iomgr/iocp_windows.h \
src/core/lib/iomgr/iomgr.h \ src/core/lib/iomgr/iomgr.h \

@ -1214,6 +1214,9 @@ src/core/lib/iomgr/gethostname.h \
src/core/lib/iomgr/gethostname_fallback.cc \ src/core/lib/iomgr/gethostname_fallback.cc \
src/core/lib/iomgr/gethostname_host_name_max.cc \ src/core/lib/iomgr/gethostname_host_name_max.cc \
src/core/lib/iomgr/gethostname_sysconf.cc \ src/core/lib/iomgr/gethostname_sysconf.cc \
src/core/lib/iomgr/grpc_if_nametoindex.h \
src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \
src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \
src/core/lib/iomgr/internal_errqueue.cc \ src/core/lib/iomgr/internal_errqueue.cc \
src/core/lib/iomgr/internal_errqueue.h \ src/core/lib/iomgr/internal_errqueue.h \
src/core/lib/iomgr/iocp_windows.cc \ src/core/lib/iomgr/iocp_windows.cc \

@ -1722,6 +1722,22 @@
"third_party": false, "third_party": false,
"type": "target" "type": "target"
}, },
{
"deps": [
"gpr",
"grpc",
"grpc_test_util"
],
"headers": [],
"is_filegroup": false,
"language": "c",
"name": "parse_address_with_named_scope_id_test",
"src": [
"test/core/client_channel/parse_address_with_named_scope_id_test.cc"
],
"third_party": false,
"type": "target"
},
{ {
"deps": [ "deps": [
"gpr", "gpr",
@ -1779,7 +1795,7 @@
"headers": [], "headers": [],
"is_filegroup": false, "is_filegroup": false,
"language": "c", "language": "c",
"name": "resolve_address_posix_test", "name": "resolve_address_using_ares_resolver_posix_test",
"src": [ "src": [
"test/core/iomgr/resolve_address_posix_test.cc" "test/core/iomgr/resolve_address_posix_test.cc"
], ],
@ -1802,6 +1818,22 @@
"third_party": false, "third_party": false,
"type": "target" "type": "target"
}, },
{
"deps": [
"gpr",
"grpc",
"grpc_test_util"
],
"headers": [],
"is_filegroup": false,
"language": "c",
"name": "resolve_address_using_native_resolver_posix_test",
"src": [
"test/core/iomgr/resolve_address_posix_test.cc"
],
"third_party": false,
"type": "target"
},
{ {
"deps": [ "deps": [
"gpr", "gpr",
@ -9371,6 +9403,8 @@
"src/core/lib/iomgr/gethostname_fallback.cc", "src/core/lib/iomgr/gethostname_fallback.cc",
"src/core/lib/iomgr/gethostname_host_name_max.cc", "src/core/lib/iomgr/gethostname_host_name_max.cc",
"src/core/lib/iomgr/gethostname_sysconf.cc", "src/core/lib/iomgr/gethostname_sysconf.cc",
"src/core/lib/iomgr/grpc_if_nametoindex_posix.cc",
"src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc",
"src/core/lib/iomgr/internal_errqueue.cc", "src/core/lib/iomgr/internal_errqueue.cc",
"src/core/lib/iomgr/iocp_windows.cc", "src/core/lib/iomgr/iocp_windows.cc",
"src/core/lib/iomgr/iomgr.cc", "src/core/lib/iomgr/iomgr.cc",
@ -9548,6 +9582,7 @@
"src/core/lib/iomgr/exec_ctx.h", "src/core/lib/iomgr/exec_ctx.h",
"src/core/lib/iomgr/executor.h", "src/core/lib/iomgr/executor.h",
"src/core/lib/iomgr/gethostname.h", "src/core/lib/iomgr/gethostname.h",
"src/core/lib/iomgr/grpc_if_nametoindex.h",
"src/core/lib/iomgr/internal_errqueue.h", "src/core/lib/iomgr/internal_errqueue.h",
"src/core/lib/iomgr/iocp_windows.h", "src/core/lib/iomgr/iocp_windows.h",
"src/core/lib/iomgr/iomgr.h", "src/core/lib/iomgr/iomgr.h",
@ -9701,6 +9736,7 @@
"src/core/lib/iomgr/exec_ctx.h", "src/core/lib/iomgr/exec_ctx.h",
"src/core/lib/iomgr/executor.h", "src/core/lib/iomgr/executor.h",
"src/core/lib/iomgr/gethostname.h", "src/core/lib/iomgr/gethostname.h",
"src/core/lib/iomgr/grpc_if_nametoindex.h",
"src/core/lib/iomgr/internal_errqueue.h", "src/core/lib/iomgr/internal_errqueue.h",
"src/core/lib/iomgr/iocp_windows.h", "src/core/lib/iomgr/iocp_windows.h",
"src/core/lib/iomgr/iomgr.h", "src/core/lib/iomgr/iomgr.h",

@ -2057,6 +2057,28 @@
], ],
"uses_polling": false "uses_polling": false
}, },
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": false,
"language": "c",
"name": "parse_address_with_named_scope_id_test",
"platforms": [
"linux",
"mac",
"posix"
],
"uses_polling": false
},
{ {
"args": [], "args": [],
"benchmark": false, "benchmark": false,
@ -2082,7 +2104,9 @@
"uses_polling": false "uses_polling": false
}, },
{ {
"args": [], "args": [
"--resolver=ares"
],
"benchmark": false, "benchmark": false,
"ci_platforms": [ "ci_platforms": [
"linux", "linux",
@ -2097,7 +2121,7 @@
"flaky": false, "flaky": false,
"gtest": false, "gtest": false,
"language": "c", "language": "c",
"name": "resolve_address_posix_test", "name": "resolve_address_using_ares_resolver_posix_test",
"platforms": [ "platforms": [
"linux", "linux",
"mac", "mac",
@ -2131,6 +2155,32 @@
], ],
"uses_polling": true "uses_polling": true
}, },
{
"args": [
"--resolver=native"
],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [
"uv"
],
"flaky": false,
"gtest": false,
"language": "c",
"name": "resolve_address_using_native_resolver_posix_test",
"platforms": [
"linux",
"mac",
"posix"
],
"uses_polling": true
},
{ {
"args": [ "args": [
"--resolver=native" "--resolver=native"

Loading…
Cancel
Save