grpc 1.74.1 → 1.75.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +83 -41
- data/include/grpc/credentials.h +7 -1
- data/src/core/call/client_call.cc +4 -4
- data/src/core/call/filter_fusion.h +1230 -0
- data/src/core/call/metadata.cc +22 -0
- data/src/core/call/metadata.h +24 -2
- data/src/core/channelz/channelz.cc +10 -17
- data/src/core/channelz/channelz.h +58 -19
- data/src/core/channelz/channelz_registry.cc +0 -162
- data/src/core/channelz/channelz_registry.h +14 -7
- data/src/core/channelz/property_list.cc +19 -23
- data/src/core/channelz/property_list.h +3 -1
- data/src/core/channelz/v2tov1/convert.cc +683 -0
- data/src/core/channelz/v2tov1/convert.h +58 -0
- data/src/core/channelz/v2tov1/legacy_api.cc +425 -0
- data/src/core/channelz/v2tov1/legacy_api.h +32 -0
- data/src/core/channelz/v2tov1/property_list.cc +118 -0
- data/src/core/channelz/v2tov1/property_list.h +52 -0
- data/src/core/client_channel/client_channel_filter.cc +5 -4
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_internal.h +2 -1
- data/src/core/client_channel/load_balanced_call_destination.cc +6 -5
- data/src/core/client_channel/subchannel.cc +14 -6
- data/src/core/client_channel/subchannel.h +2 -0
- data/src/core/config/core_configuration.cc +3 -1
- data/src/core/config/core_configuration.h +12 -0
- data/src/core/credentials/transport/alts/alts_credentials.cc +5 -0
- data/src/core/credentials/transport/alts/check_gcp_environment_windows.cc +2 -0
- data/src/core/credentials/transport/channel_creds_registry_init.cc +3 -1
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +1 -1
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +8 -3
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -24
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +19 -8
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +96 -54
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +15 -2
- data/src/core/credentials/transport/tls/spiffe_utils.cc +371 -0
- data/src/core/credentials/transport/tls/spiffe_utils.h +171 -0
- data/src/core/credentials/transport/tls/ssl_utils.cc +11 -10
- data/src/core/credentials/transport/tls/ssl_utils.h +4 -2
- data/src/core/credentials/transport/tls/tls_credentials.cc +2 -0
- data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -26
- data/src/core/credentials/transport/tls/tls_security_connector.h +12 -12
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -2
- data/src/core/ext/filters/http/client/http_client_filter.cc +3 -6
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
- data/src/core/ext/filters/http/server/http_server_filter.cc +3 -6
- data/src/core/ext/filters/message_size/message_size_filter.cc +4 -4
- data/src/core/ext/filters/rbac/rbac_filter.cc +1 -1
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +3 -5
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame.cc +89 -6
- data/src/core/ext/transport/chttp2/transport/frame.h +38 -0
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +5 -14
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +4 -1
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +294 -78
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +128 -9
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +11 -38
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +52 -35
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +61 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +142 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +81 -3
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +12 -1
- data/src/core/ext/transport/chttp2/transport/message_assembler.h +2 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +22 -5
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +607 -0
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +254 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +6 -4
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb.h +4959 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.c +1111 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.h +108 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb.h +142 -54
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.c +18 -14
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.h +2 -2
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +716 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.h +227 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.c +86 -88
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.h +2 -2
- data/src/core/filter/auth/auth_filters.h +2 -2
- data/src/core/filter/fused_filters.cc +154 -0
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +1 -1
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +965 -0
- data/src/core/handshaker/security/secure_endpoint.cc +28 -13
- data/src/core/handshaker/security/secure_endpoint.h +8 -0
- data/src/core/lib/channel/promise_based_filter.cc +15 -25
- data/src/core/lib/channel/promise_based_filter.h +6 -5
- data/src/core/lib/event_engine/ares_resolver.h +3 -1
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +9 -5
- data/src/core/lib/event_engine/cf_engine/cf_engine.h +2 -1
- data/src/core/lib/event_engine/cf_engine/cfsocket_listener.cc +263 -0
- data/src/core/lib/event_engine/cf_engine/cfsocket_listener.h +107 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +31 -3
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +12 -0
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +12 -10
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +6 -4
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +15 -14
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +7 -5
- data/src/core/lib/event_engine/posix_engine/event_poller.h +0 -8
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +11 -5
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +3 -2
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +1 -0
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +4 -4
- data/src/core/lib/event_engine/posix_engine/lockfree_event.h +3 -4
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +188 -199
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +30 -45
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +1 -1
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +2 -1
- data/src/core/lib/experiments/experiments.cc +120 -6
- data/src/core/lib/experiments/experiments.h +46 -3
- data/src/core/lib/iomgr/combiner.cc +1 -1
- data/src/core/lib/iomgr/exec_ctx.h +3 -9
- data/src/core/lib/iomgr/socket_mutator.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_client_posix.cc +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +3 -3
- data/src/core/lib/promise/activity.h +2 -2
- data/src/core/lib/promise/mpsc.cc +8 -8
- data/src/core/lib/promise/party.cc +7 -7
- data/src/core/lib/promise/party.h +4 -4
- data/src/core/lib/promise/poll.h +10 -0
- data/src/core/lib/resource_quota/memory_quota.cc +90 -3
- data/src/core/lib/resource_quota/memory_quota.h +20 -9
- data/src/core/lib/resource_quota/periodic_update.cc +14 -0
- data/src/core/lib/resource_quota/periodic_update.h +8 -0
- data/src/core/lib/resource_quota/resource_quota.cc +15 -4
- data/src/core/lib/resource_quota/resource_quota.h +3 -0
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +1 -2
- data/src/core/lib/surface/call.cc +5 -5
- data/src/core/lib/surface/call.h +6 -5
- data/src/core/lib/surface/completion_queue.cc +2 -4
- data/src/core/lib/surface/filter_stack_call.cc +1 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/promise_endpoint.cc +2 -2
- data/src/core/lib/transport/promise_endpoint.h +3 -3
- data/src/core/load_balancing/endpoint_list.cc +29 -2
- data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +3 -3
- data/src/core/load_balancing/grpclb/client_load_reporting_filter.h +1 -1
- data/src/core/load_balancing/pick_first/pick_first.cc +12 -5
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +5 -3
- data/src/core/net/socket_mutator.cc +19 -0
- data/src/core/net/socket_mutator.h +25 -0
- data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -0
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +6 -1
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +2 -1
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +8 -5
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -1
- data/src/core/resolver/xds/xds_dependency_manager.cc +1 -1
- data/src/core/server/server.cc +1 -1
- data/src/core/server/server_call_tracer_filter.cc +0 -66
- data/src/core/server/server_call_tracer_filter.h +64 -0
- data/src/core/server/server_config_selector_filter.cc +1 -1
- data/src/core/service_config/service_config_channel_arg_filter.cc +3 -60
- data/src/core/service_config/service_config_channel_arg_filter.h +82 -0
- data/src/core/telemetry/call_tracer.cc +20 -14
- data/src/core/telemetry/call_tracer.h +22 -17
- data/src/core/telemetry/metrics.h +8 -8
- data/src/core/telemetry/stats_data.cc +151 -151
- data/src/core/telemetry/stats_data.h +87 -87
- data/src/core/transport/auth_context.cc +20 -0
- data/src/core/transport/auth_context.h +4 -0
- data/src/core/transport/auth_context_comparator_registry.h +69 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +2 -3
- data/src/core/tsi/ssl_transport_security.cc +202 -32
- data/src/core/tsi/ssl_transport_security.h +19 -10
- data/src/core/tsi/ssl_transport_security_utils.cc +21 -0
- data/src/core/tsi/ssl_transport_security_utils.h +4 -0
- data/src/core/util/http_client/httpcli_security_connector.cc +3 -1
- data/src/core/util/latent_see.cc +178 -146
- data/src/core/util/latent_see.h +245 -188
- data/src/core/util/single_set_ptr.h +5 -2
- data/src/core/util/useful.h +91 -0
- data/src/core/util/windows/directory_reader.cc +1 -0
- data/src/core/util/windows/thd.cc +1 -3
- data/src/core/util/work_serializer.cc +1 -1
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +32 -5
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +5 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +5 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/cares/cares/include/ares.h +925 -460
- data/third_party/cares/cares/include/ares_dns.h +86 -71
- data/third_party/cares/cares/include/ares_dns_record.h +1118 -0
- data/third_party/cares/cares/include/ares_nameser.h +215 -189
- data/third_party/cares/cares/include/ares_version.h +37 -14
- data/third_party/cares/cares/src/lib/ares_addrinfo2hostent.c +305 -0
- data/third_party/cares/cares/src/lib/ares_addrinfo_localhost.c +245 -0
- data/third_party/cares/cares/src/lib/ares_android.c +216 -164
- data/third_party/cares/cares/src/lib/ares_android.h +25 -14
- data/third_party/cares/cares/src/lib/ares_cancel.c +68 -44
- data/third_party/cares/cares/src/lib/ares_close_sockets.c +137 -0
- data/third_party/cares/cares/src/lib/ares_conn.c +511 -0
- data/third_party/cares/cares/src/lib/ares_conn.h +196 -0
- data/third_party/cares/cares/src/lib/ares_cookie.c +461 -0
- data/third_party/cares/cares/src/lib/ares_data.c +93 -181
- data/third_party/cares/cares/src/lib/ares_data.h +50 -39
- data/third_party/cares/cares/src/lib/ares_destroy.c +127 -89
- data/third_party/cares/cares/src/lib/ares_free_hostent.c +35 -24
- data/third_party/cares/cares/src/lib/ares_free_string.c +24 -16
- data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +45 -38
- data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +549 -663
- data/third_party/cares/cares/src/lib/ares_getenv.c +25 -15
- data/third_party/cares/cares/src/lib/ares_getenv.h +26 -18
- data/third_party/cares/cares/src/lib/ares_gethostbyaddr.c +163 -221
- data/third_party/cares/cares/src/lib/ares_gethostbyname.c +222 -223
- data/third_party/cares/cares/src/lib/ares_getnameinfo.c +328 -338
- data/third_party/cares/cares/src/lib/ares_hosts_file.c +952 -0
- data/third_party/cares/cares/src/lib/ares_inet_net_pton.h +25 -19
- data/third_party/cares/cares/src/lib/ares_init.c +425 -2091
- data/third_party/cares/cares/src/lib/ares_ipv6.h +63 -33
- data/third_party/cares/cares/src/lib/ares_library_init.c +110 -54
- data/third_party/cares/cares/src/lib/ares_metrics.c +261 -0
- data/third_party/cares/cares/src/lib/ares_options.c +418 -332
- data/third_party/cares/cares/src/lib/ares_parse_into_addrinfo.c +179 -0
- data/third_party/cares/cares/src/lib/ares_private.h +558 -356
- data/third_party/cares/cares/src/lib/ares_process.c +1224 -1369
- data/third_party/cares/cares/src/lib/ares_qcache.c +430 -0
- data/third_party/cares/cares/src/lib/ares_query.c +126 -121
- data/third_party/cares/cares/src/lib/ares_search.c +564 -262
- data/third_party/cares/cares/src/lib/ares_send.c +264 -93
- data/third_party/cares/cares/src/lib/ares_set_socket_functions.c +588 -0
- data/third_party/cares/cares/src/lib/ares_setup.h +115 -111
- data/third_party/cares/cares/src/lib/ares_socket.c +425 -0
- data/third_party/cares/cares/src/lib/ares_socket.h +163 -0
- data/third_party/cares/cares/src/lib/ares_sortaddrinfo.c +447 -0
- data/third_party/cares/cares/src/lib/ares_strerror.c +83 -48
- data/third_party/cares/cares/src/lib/ares_sysconfig.c +639 -0
- data/third_party/cares/cares/src/lib/ares_sysconfig_files.c +839 -0
- data/third_party/cares/cares/src/lib/ares_sysconfig_mac.c +373 -0
- data/third_party/cares/cares/src/lib/ares_sysconfig_win.c +621 -0
- data/third_party/cares/cares/src/lib/ares_timeout.c +136 -73
- data/third_party/cares/cares/src/lib/ares_update_servers.c +1362 -0
- data/third_party/cares/cares/src/lib/ares_version.c +29 -4
- data/third_party/cares/cares/src/lib/config-dos.h +88 -89
- data/third_party/cares/cares/src/lib/config-win32.h +122 -77
- data/third_party/cares/cares/src/lib/dsa/ares_array.c +394 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable.c +447 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable.h +174 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_asvp.c +224 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_dict.c +228 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_strvp.c +210 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_szvp.c +188 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_vpstr.c +186 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_vpvp.c +194 -0
- data/third_party/cares/cares/src/lib/dsa/ares_llist.c +382 -0
- data/third_party/cares/cares/src/lib/dsa/ares_slist.c +479 -0
- data/third_party/cares/cares/src/lib/dsa/ares_slist.h +207 -0
- data/third_party/cares/cares/src/lib/event/ares_event.h +191 -0
- data/third_party/cares/cares/src/lib/event/ares_event_configchg.c +743 -0
- data/third_party/cares/cares/src/lib/event/ares_event_epoll.c +192 -0
- data/third_party/cares/cares/src/lib/event/ares_event_kqueue.c +248 -0
- data/third_party/cares/cares/src/lib/event/ares_event_poll.c +140 -0
- data/third_party/cares/cares/src/lib/event/ares_event_select.c +159 -0
- data/third_party/cares/cares/src/lib/event/ares_event_thread.c +567 -0
- data/third_party/cares/cares/src/lib/event/ares_event_wake_pipe.c +166 -0
- data/third_party/cares/cares/src/lib/event/ares_event_win32.c +978 -0
- data/third_party/cares/cares/src/lib/event/ares_event_win32.h +161 -0
- data/third_party/cares/cares/src/lib/include/ares_array.h +276 -0
- data/third_party/cares/cares/src/lib/include/ares_buf.h +732 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_asvp.h +130 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_dict.h +123 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_strvp.h +130 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_szvp.h +118 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_vpstr.h +111 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_vpvp.h +128 -0
- data/third_party/cares/cares/src/lib/include/ares_llist.h +239 -0
- data/third_party/cares/cares/src/lib/include/ares_mem.h +38 -0
- data/third_party/cares/cares/src/lib/include/ares_str.h +244 -0
- data/third_party/cares/cares/src/lib/inet_net_pton.c +202 -157
- data/third_party/cares/cares/src/lib/inet_ntop.c +87 -69
- data/third_party/cares/cares/src/lib/legacy/ares_create_query.c +78 -0
- data/third_party/cares/cares/src/lib/legacy/ares_expand_name.c +99 -0
- data/third_party/cares/cares/src/lib/legacy/ares_expand_string.c +107 -0
- data/third_party/cares/cares/src/lib/legacy/ares_fds.c +80 -0
- data/third_party/cares/cares/src/lib/legacy/ares_getsock.c +85 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_a_reply.c +107 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_aaaa_reply.c +109 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_caa_reply.c +137 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_mx_reply.c +110 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_naptr_reply.c +132 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_ns_reply.c +154 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_ptr_reply.c +213 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_soa_reply.c +115 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_srv_reply.c +114 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_txt_reply.c +144 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_uri_reply.c +113 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_mapping.c +982 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_multistring.c +307 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_multistring.h +72 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_name.c +673 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_parse.c +1329 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_private.h +273 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_record.c +1661 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_write.c +1229 -0
- data/third_party/cares/cares/src/lib/str/ares_buf.c +1498 -0
- data/third_party/cares/cares/src/lib/str/ares_str.c +508 -0
- data/third_party/cares/cares/src/lib/str/ares_strsplit.c +90 -0
- data/third_party/cares/cares/src/lib/str/ares_strsplit.h +51 -0
- data/third_party/cares/cares/src/lib/thirdparty/apple/dnsinfo.h +122 -0
- data/third_party/cares/cares/src/lib/util/ares_iface_ips.c +628 -0
- data/third_party/cares/cares/src/lib/util/ares_iface_ips.h +139 -0
- data/third_party/cares/cares/src/lib/util/ares_math.c +158 -0
- data/third_party/cares/cares/src/lib/util/ares_math.h +45 -0
- data/third_party/cares/cares/src/lib/util/ares_rand.c +389 -0
- data/third_party/cares/cares/src/lib/util/ares_rand.h +36 -0
- data/third_party/cares/cares/src/lib/util/ares_threads.c +614 -0
- data/third_party/cares/cares/src/lib/util/ares_threads.h +60 -0
- data/third_party/cares/cares/src/lib/util/ares_time.h +48 -0
- data/third_party/cares/cares/src/lib/util/ares_timeval.c +95 -0
- data/third_party/cares/cares/src/lib/util/ares_uri.c +1626 -0
- data/third_party/cares/cares/src/lib/util/ares_uri.h +252 -0
- data/third_party/cares/cares/src/lib/windows_port.c +16 -9
- metadata +121 -49
- data/src/core/util/ring_buffer.h +0 -122
- data/third_party/cares/cares/include/ares_rules.h +0 -125
- data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +0 -266
- data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +0 -240
- data/third_party/cares/cares/src/lib/ares__close_sockets.c +0 -61
- data/third_party/cares/cares/src/lib/ares__get_hostent.c +0 -260
- data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +0 -229
- data/third_party/cares/cares/src/lib/ares__read_line.c +0 -73
- data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +0 -258
- data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +0 -507
- data/third_party/cares/cares/src/lib/ares__timeval.c +0 -111
- data/third_party/cares/cares/src/lib/ares_create_query.c +0 -197
- data/third_party/cares/cares/src/lib/ares_expand_name.c +0 -311
- data/third_party/cares/cares/src/lib/ares_expand_string.c +0 -67
- data/third_party/cares/cares/src/lib/ares_fds.c +0 -59
- data/third_party/cares/cares/src/lib/ares_getsock.c +0 -66
- data/third_party/cares/cares/src/lib/ares_iphlpapi.h +0 -221
- data/third_party/cares/cares/src/lib/ares_llist.c +0 -63
- data/third_party/cares/cares/src/lib/ares_llist.h +0 -39
- data/third_party/cares/cares/src/lib/ares_mkquery.c +0 -24
- data/third_party/cares/cares/src/lib/ares_nowarn.c +0 -260
- data/third_party/cares/cares/src/lib/ares_nowarn.h +0 -61
- data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +0 -90
- data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +0 -92
- data/third_party/cares/cares/src/lib/ares_parse_caa_reply.c +0 -199
- data/third_party/cares/cares/src/lib/ares_parse_mx_reply.c +0 -164
- data/third_party/cares/cares/src/lib/ares_parse_naptr_reply.c +0 -183
- data/third_party/cares/cares/src/lib/ares_parse_ns_reply.c +0 -177
- data/third_party/cares/cares/src/lib/ares_parse_ptr_reply.c +0 -228
- data/third_party/cares/cares/src/lib/ares_parse_soa_reply.c +0 -179
- data/third_party/cares/cares/src/lib/ares_parse_srv_reply.c +0 -168
- data/third_party/cares/cares/src/lib/ares_parse_txt_reply.c +0 -214
- data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +0 -184
- data/third_party/cares/cares/src/lib/ares_platform.c +0 -11042
- data/third_party/cares/cares/src/lib/ares_platform.h +0 -43
- data/third_party/cares/cares/src/lib/ares_rand.c +0 -279
- data/third_party/cares/cares/src/lib/ares_strcasecmp.c +0 -66
- data/third_party/cares/cares/src/lib/ares_strcasecmp.h +0 -30
- data/third_party/cares/cares/src/lib/ares_strdup.c +0 -42
- data/third_party/cares/cares/src/lib/ares_strdup.h +0 -24
- data/third_party/cares/cares/src/lib/ares_strsplit.c +0 -94
- data/third_party/cares/cares/src/lib/ares_strsplit.h +0 -42
- data/third_party/cares/cares/src/lib/ares_writev.c +0 -79
- data/third_party/cares/cares/src/lib/ares_writev.h +0 -36
- data/third_party/cares/cares/src/lib/bitncmp.c +0 -59
- data/third_party/cares/cares/src/lib/bitncmp.h +0 -26
- data/third_party/cares/cares/src/lib/setup_once.h +0 -554
- data/third_party/cares/cares/src/tools/ares_getopt.h +0 -53
@@ -2290,7 +2290,8 @@ class ClientChannelFilter::LoadBalancedCall::LbCallState final
|
|
2290
2290
|
ServiceConfigCallData::CallAttributeInterface* GetCallAttribute(
|
2291
2291
|
UniqueTypeName type) const override;
|
2292
2292
|
|
2293
|
-
|
2293
|
+
ClientCallTracerInterface::CallAttemptTracer* GetCallAttemptTracer()
|
2294
|
+
const override;
|
2294
2295
|
|
2295
2296
|
private:
|
2296
2297
|
LoadBalancedCall* lb_call_;
|
@@ -2307,7 +2308,7 @@ ClientChannelFilter::LoadBalancedCall::LbCallState::GetCallAttribute(
|
|
2307
2308
|
return service_config_call_data->GetCallAttribute(type);
|
2308
2309
|
}
|
2309
2310
|
|
2310
|
-
|
2311
|
+
ClientCallTracerInterface::CallAttemptTracer*
|
2311
2312
|
ClientChannelFilter::LoadBalancedCall::LbCallState::GetCallAttemptTracer()
|
2312
2313
|
const {
|
2313
2314
|
return lb_call_->call_attempt_tracer();
|
@@ -2364,9 +2365,9 @@ class ClientChannelFilter::LoadBalancedCall::BackendMetricAccessor final
|
|
2364
2365
|
|
2365
2366
|
namespace {
|
2366
2367
|
|
2367
|
-
|
2368
|
+
ClientCallTracerInterface::CallAttemptTracer* CreateCallAttemptTracer(
|
2368
2369
|
Arena* arena, bool is_transparent_retry) {
|
2369
|
-
auto* call_tracer = DownCast<
|
2370
|
+
auto* call_tracer = DownCast<ClientCallTracerInterface*>(
|
2370
2371
|
arena->GetContext<CallTracerAnnotationInterface>());
|
2371
2372
|
if (call_tracer == nullptr) return nullptr;
|
2372
2373
|
auto* tracer = call_tracer->StartNewAttempt(is_transparent_retry);
|
@@ -373,7 +373,7 @@ class ClientChannelFilter::LoadBalancedCall
|
|
373
373
|
|
374
374
|
protected:
|
375
375
|
ClientChannelFilter* chand() const { return chand_; }
|
376
|
-
|
376
|
+
ClientCallTracerInterface::CallAttemptTracer* call_attempt_tracer() const {
|
377
377
|
return call_attempt_tracer_;
|
378
378
|
}
|
379
379
|
ConnectedSubchannel* connected_subchannel() const {
|
@@ -434,7 +434,7 @@ class ClientChannelFilter::LoadBalancedCall
|
|
434
434
|
// previous attempt yet leading to a situation where we have two active call
|
435
435
|
// attempt tracers, and so we cannot rely on the arena to give us the right
|
436
436
|
// tracer when performing cleanup.
|
437
|
-
|
437
|
+
ClientCallTracerInterface::CallAttemptTracer* call_attempt_tracer_;
|
438
438
|
|
439
439
|
absl::AnyInvocable<void()> on_commit_;
|
440
440
|
|
@@ -54,7 +54,8 @@ class ClientChannelLbCallState : public LoadBalancingPolicy::CallState {
|
|
54
54
|
|
55
55
|
virtual ServiceConfigCallData::CallAttributeInterface* GetCallAttribute(
|
56
56
|
UniqueTypeName type) const = 0;
|
57
|
-
virtual
|
57
|
+
virtual ClientCallTracerInterface::CallAttemptTracer* GetCallAttemptTracer()
|
58
|
+
const = 0;
|
58
59
|
};
|
59
60
|
|
60
61
|
// Internal type for ServiceConfigCallData. Handles call commits.
|
@@ -29,7 +29,7 @@ namespace grpc_core {
|
|
29
29
|
namespace {
|
30
30
|
|
31
31
|
void MaybeCreateCallAttemptTracer(bool is_transparent_retry) {
|
32
|
-
auto* call_tracer = MaybeGetContext<
|
32
|
+
auto* call_tracer = MaybeGetContext<ClientCallTracerInterface>();
|
33
33
|
if (call_tracer == nullptr) return;
|
34
34
|
auto* tracer = call_tracer->StartNewAttempt(is_transparent_retry);
|
35
35
|
SetContext<CallTracerInterface>(tracer);
|
@@ -47,8 +47,9 @@ class LbCallState : public ClientChannelLbCallState {
|
|
47
47
|
return service_config_call_data->GetCallAttribute(type);
|
48
48
|
}
|
49
49
|
|
50
|
-
|
51
|
-
|
50
|
+
ClientCallTracerInterface::CallAttemptTracer* GetCallAttemptTracer()
|
51
|
+
const override {
|
52
|
+
return GetContext<ClientCallTracerInterface::CallAttemptTracer>();
|
52
53
|
}
|
53
54
|
};
|
54
55
|
|
@@ -239,8 +240,8 @@ void LoadBalancedCallDestination::StartCall(
|
|
239
240
|
}
|
240
241
|
// If it was queued, add a trace annotation.
|
241
242
|
if (was_queued) {
|
242
|
-
auto* tracer =
|
243
|
-
|
243
|
+
auto* tracer = MaybeGetContext<
|
244
|
+
ClientCallTracerInterface::CallAttemptTracer>();
|
244
245
|
if (tracer != nullptr) {
|
245
246
|
tracer->RecordAnnotation("Delayed LB pick complete.");
|
246
247
|
}
|
@@ -117,7 +117,7 @@ class LegacyConnectedSubchannel : public ConnectedSubchannel {
|
|
117
117
|
channel_stack_.reset(DEBUG_LOCATION, "ConnectedSubchannel");
|
118
118
|
}
|
119
119
|
|
120
|
-
channelz::SubchannelNode* channelz_node() const {
|
120
|
+
channelz::SubchannelNode* channelz_node() const override {
|
121
121
|
return channelz_node_.get();
|
122
122
|
}
|
123
123
|
|
@@ -220,6 +220,8 @@ class NewConnectedSubchannel : public ConnectedSubchannel {
|
|
220
220
|
Crash("legacy ping method called in call v3 impl");
|
221
221
|
}
|
222
222
|
|
223
|
+
channelz::SubchannelNode* channelz_node() const override { return nullptr; }
|
224
|
+
|
223
225
|
private:
|
224
226
|
RefCountedPtr<UnstartedCallDestination> call_destination_;
|
225
227
|
RefCountedPtr<TransportCallDestination> transport_;
|
@@ -410,17 +412,21 @@ class Subchannel::ConnectedSubchannelStateWatcher final
|
|
410
412
|
// we will see TRANSIENT_FAILURE followed by SHUTDOWN, but if not, we
|
411
413
|
// will see only SHUTDOWN. Either way, we react to the first one we
|
412
414
|
// see, ignoring anything that happens after that.
|
413
|
-
if (c->connected_subchannel_ == nullptr) return;
|
414
415
|
if (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
|
415
416
|
new_state == GRPC_CHANNEL_SHUTDOWN) {
|
417
|
+
RefCountedPtr<ConnectedSubchannel> connected_subchannel =
|
418
|
+
std::move(c->connected_subchannel_);
|
419
|
+
if (connected_subchannel == nullptr) return;
|
416
420
|
GRPC_TRACE_LOG(subchannel, INFO)
|
417
421
|
<< "subchannel " << c << " " << c->key_.ToString()
|
418
|
-
<< ": Connected subchannel " <<
|
422
|
+
<< ": Connected subchannel " << connected_subchannel.get()
|
419
423
|
<< " reports " << ConnectivityStateName(new_state) << ": "
|
420
424
|
<< status;
|
421
|
-
c->connected_subchannel_.reset();
|
422
425
|
if (c->channelz_node() != nullptr) {
|
423
|
-
|
426
|
+
if (connected_subchannel->channelz_node() != nullptr) {
|
427
|
+
connected_subchannel->channelz_node()->RemoveParent(
|
428
|
+
c->channelz_node());
|
429
|
+
}
|
424
430
|
}
|
425
431
|
// If the subchannel was created from an endpoint, then we report
|
426
432
|
// TRANSIENT_FAILURE here instead of IDLE. The subchannel will never
|
@@ -880,7 +886,9 @@ bool Subchannel::PublishTransportLocked() {
|
|
880
886
|
<< "subchannel " << this << " " << key_.ToString()
|
881
887
|
<< ": new connected subchannel at " << connected_subchannel_.get();
|
882
888
|
if (channelz_node_ != nullptr) {
|
883
|
-
|
889
|
+
if (socket_node != nullptr) {
|
890
|
+
socket_node->AddParent(channelz_node_.get());
|
891
|
+
}
|
884
892
|
}
|
885
893
|
// Start watching connected subchannel.
|
886
894
|
connected_subchannel_->StartWatch(
|
@@ -85,6 +85,8 @@ class ConnectedSubchannel : public RefCounted<ConnectedSubchannel> {
|
|
85
85
|
virtual size_t GetInitialCallSizeEstimate() const = 0;
|
86
86
|
virtual void Ping(grpc_closure* on_initiate, grpc_closure* on_ack) = 0;
|
87
87
|
|
88
|
+
virtual channelz::SubchannelNode* channelz_node() const = 0;
|
89
|
+
|
88
90
|
protected:
|
89
91
|
explicit ConnectedSubchannel(const ChannelArgs& args);
|
90
92
|
|
@@ -51,7 +51,9 @@ CoreConfiguration::CoreConfiguration(Builder* builder)
|
|
51
51
|
certificate_provider_registry_(
|
52
52
|
builder->certificate_provider_registry_.Build()),
|
53
53
|
endpoint_transport_registry_(
|
54
|
-
builder->endpoint_transport_registry_.Build())
|
54
|
+
builder->endpoint_transport_registry_.Build()),
|
55
|
+
auth_context_comparator_registry_(
|
56
|
+
builder->auth_context_comparator_registry_.Build()) {}
|
55
57
|
|
56
58
|
void CoreConfiguration::RegisterBuilder(
|
57
59
|
BuilderScope scope, absl::AnyInvocable<void(Builder*)> builder,
|
@@ -32,6 +32,7 @@
|
|
32
32
|
#include "src/core/load_balancing/lb_policy_registry.h"
|
33
33
|
#include "src/core/resolver/resolver_registry.h"
|
34
34
|
#include "src/core/service_config/service_config_parser.h"
|
35
|
+
#include "src/core/transport/auth_context_comparator_registry.h"
|
35
36
|
#include "src/core/transport/endpoint_transport.h"
|
36
37
|
#include "src/core/util/debug_location.h"
|
37
38
|
|
@@ -111,6 +112,10 @@ class GRPC_DLL CoreConfiguration {
|
|
111
112
|
return &endpoint_transport_registry_;
|
112
113
|
}
|
113
114
|
|
115
|
+
AuthContextComparatorRegistry::Builder* auth_context_comparator_registry() {
|
116
|
+
return &auth_context_comparator_registry_;
|
117
|
+
}
|
118
|
+
|
114
119
|
private:
|
115
120
|
friend class CoreConfiguration;
|
116
121
|
|
@@ -125,6 +130,7 @@ class GRPC_DLL CoreConfiguration {
|
|
125
130
|
ProxyMapperRegistry::Builder proxy_mapper_registry_;
|
126
131
|
CertificateProviderRegistry::Builder certificate_provider_registry_;
|
127
132
|
EndpointTransportRegistry::Builder endpoint_transport_registry_;
|
133
|
+
AuthContextComparatorRegistry::Builder auth_context_comparator_registry_;
|
128
134
|
|
129
135
|
Builder();
|
130
136
|
CoreConfiguration* Build();
|
@@ -275,6 +281,11 @@ class GRPC_DLL CoreConfiguration {
|
|
275
281
|
return endpoint_transport_registry_;
|
276
282
|
}
|
277
283
|
|
284
|
+
const AuthContextComparatorRegistry& auth_context_comparator_registry()
|
285
|
+
const {
|
286
|
+
return auth_context_comparator_registry_;
|
287
|
+
}
|
288
|
+
|
278
289
|
static void SetDefaultBuilder(void (*builder)(CoreConfiguration::Builder*)) {
|
279
290
|
default_builder_ = builder;
|
280
291
|
}
|
@@ -309,6 +320,7 @@ class GRPC_DLL CoreConfiguration {
|
|
309
320
|
ProxyMapperRegistry proxy_mapper_registry_;
|
310
321
|
CertificateProviderRegistry certificate_provider_registry_;
|
311
322
|
EndpointTransportRegistry endpoint_transport_registry_;
|
323
|
+
AuthContextComparatorRegistry auth_context_comparator_registry_;
|
312
324
|
};
|
313
325
|
|
314
326
|
template <typename Sink>
|
@@ -25,6 +25,7 @@
|
|
25
25
|
|
26
26
|
#include <utility>
|
27
27
|
|
28
|
+
#include "absl/log/log.h"
|
28
29
|
#include "src/core/credentials/transport/alts/alts_security_connector.h"
|
29
30
|
#include "src/core/credentials/transport/alts/check_gcp_environment.h"
|
30
31
|
#include "src/core/credentials/transport/alts/grpc_alts_credentials_options.h"
|
@@ -89,6 +90,8 @@ grpc_channel_credentials* grpc_alts_credentials_create_customized(
|
|
89
90
|
const grpc_alts_credentials_options* options,
|
90
91
|
const char* handshaker_service_url, bool enable_untrusted_alts) {
|
91
92
|
if (!enable_untrusted_alts && !grpc_alts_is_running_on_gcp()) {
|
93
|
+
LOG(ERROR) << "ALTS creds ignored. Not running on GCP and untrusted ALTS "
|
94
|
+
"is not enabled.";
|
92
95
|
return nullptr;
|
93
96
|
}
|
94
97
|
return new grpc_alts_credentials(options, handshaker_service_url);
|
@@ -98,6 +101,8 @@ grpc_server_credentials* grpc_alts_server_credentials_create_customized(
|
|
98
101
|
const grpc_alts_credentials_options* options,
|
99
102
|
const char* handshaker_service_url, bool enable_untrusted_alts) {
|
100
103
|
if (!enable_untrusted_alts && !grpc_alts_is_running_on_gcp()) {
|
104
|
+
LOG(ERROR) << "ALTS server creds ignored. Not running on GCP and untrusted "
|
105
|
+
"ALTS is not enabled.";
|
101
106
|
return nullptr;
|
102
107
|
}
|
103
108
|
return new grpc_alts_server_credentials(options, handshaker_service_url);
|
@@ -87,10 +87,12 @@ class TlsChannelCredsFactory : public ChannelCredsFactory<> {
|
|
87
87
|
auto options = MakeRefCounted<grpc_tls_credentials_options>();
|
88
88
|
if (!config->certificate_file().empty() ||
|
89
89
|
!config->ca_certificate_file().empty()) {
|
90
|
+
// TODO(gtcooke94): Expose the spiffe_bundle_map option in the XDS
|
91
|
+
// bootstrap config to use here.
|
90
92
|
options->set_certificate_provider(
|
91
93
|
MakeRefCounted<FileWatcherCertificateProvider>(
|
92
94
|
config->private_key_file(), config->certificate_file(),
|
93
|
-
config->ca_certificate_file(),
|
95
|
+
config->ca_certificate_file(), /*spiffe_bundle_map_file=*/"",
|
94
96
|
config->refresh_interval().millis() / GPR_MS_PER_SEC));
|
95
97
|
}
|
96
98
|
options->set_watch_root_cert(!config->ca_certificate_file().empty());
|
@@ -193,7 +193,7 @@ grpc_security_status grpc_ssl_credentials::InitializeClientHandshakerFactory(
|
|
193
193
|
"be nullptr";
|
194
194
|
return GRPC_SECURITY_ERROR;
|
195
195
|
}
|
196
|
-
options.
|
196
|
+
options.root_cert_info = std::make_shared<RootCertInfo>(pem_root_certs);
|
197
197
|
options.root_store = root_store;
|
198
198
|
options.alpn_protocols =
|
199
199
|
grpc_fill_alpn_protocol_strings(&options.num_alpn_protocols);
|
@@ -243,8 +243,10 @@ class grpc_ssl_server_security_connector
|
|
243
243
|
server_credentials->config().pem_key_cert_pairs;
|
244
244
|
options.num_key_cert_pairs =
|
245
245
|
server_credentials->config().num_key_cert_pairs;
|
246
|
-
|
247
|
-
|
246
|
+
if (server_credentials->config().pem_root_certs != nullptr) {
|
247
|
+
options.root_cert_info = std::make_shared<RootCertInfo>(
|
248
|
+
server_credentials->config().pem_root_certs);
|
249
|
+
}
|
248
250
|
options.client_certificate_request =
|
249
251
|
grpc_get_tsi_client_certificate_request_type(
|
250
252
|
server_credentials->config().client_certificate_request);
|
@@ -360,7 +362,10 @@ class grpc_ssl_server_security_connector
|
|
360
362
|
options.pem_key_cert_pairs = grpc_convert_grpc_to_tsi_cert_pairs(
|
361
363
|
config->pem_key_cert_pairs, config->num_key_cert_pairs);
|
362
364
|
options.num_key_cert_pairs = config->num_key_cert_pairs;
|
363
|
-
|
365
|
+
if (config->pem_root_certs != nullptr) {
|
366
|
+
options.root_cert_info =
|
367
|
+
std::make_shared<RootCertInfo>(config->pem_root_certs);
|
368
|
+
}
|
364
369
|
options.client_certificate_request =
|
365
370
|
grpc_get_tsi_client_certificate_request_type(
|
366
371
|
server_creds->config().client_certificate_request);
|
@@ -22,14 +22,20 @@
|
|
22
22
|
|
23
23
|
#include "absl/log/check.h"
|
24
24
|
#include "absl/status/status.h"
|
25
|
+
#include "src/core/credentials/transport/tls/spiffe_utils.h"
|
26
|
+
#include "src/core/tsi/ssl_transport_security.h"
|
27
|
+
|
28
|
+
bool grpc_tls_certificate_distributor::CertificateInfo::AreRootsEmpty() {
|
29
|
+
return IsRootCertInfoEmpty(roots.get());
|
30
|
+
}
|
25
31
|
|
26
32
|
void grpc_tls_certificate_distributor::SetKeyMaterials(
|
27
|
-
const std::string& cert_name, std::
|
33
|
+
const std::string& cert_name, std::shared_ptr<RootCertInfo> roots,
|
28
34
|
std::optional<grpc_core::PemKeyCertPairList> pem_key_cert_pairs) {
|
29
|
-
CHECK(
|
35
|
+
CHECK(roots != nullptr || pem_key_cert_pairs.has_value());
|
30
36
|
grpc_core::MutexLock lock(&mu_);
|
31
37
|
auto& cert_info = certificate_info_map_[cert_name];
|
32
|
-
if (
|
38
|
+
if (roots != nullptr) {
|
33
39
|
// Successful credential updates will clear any pre-existing error.
|
34
40
|
cert_info.SetRootError(absl::OkStatus());
|
35
41
|
for (auto* watcher_ptr : cert_info.root_cert_watchers) {
|
@@ -49,9 +55,9 @@ void grpc_tls_certificate_distributor::SetKeyMaterials(
|
|
49
55
|
}
|
50
56
|
}
|
51
57
|
watcher_ptr->OnCertificatesChanged(
|
52
|
-
|
58
|
+
roots, std::move(pem_key_cert_pairs_to_report));
|
53
59
|
}
|
54
|
-
cert_info.
|
60
|
+
cert_info.roots = roots;
|
55
61
|
}
|
56
62
|
if (pem_key_cert_pairs.has_value()) {
|
57
63
|
// Successful credential updates will clear any pre-existing error.
|
@@ -61,20 +67,19 @@ void grpc_tls_certificate_distributor::SetKeyMaterials(
|
|
61
67
|
const auto watcher_it = watchers_.find(watcher_ptr);
|
62
68
|
CHECK(watcher_it != watchers_.end());
|
63
69
|
CHECK(watcher_it->second.identity_cert_name.has_value());
|
64
|
-
std::
|
65
|
-
if (
|
66
|
-
watcher_it->second.root_cert_name == cert_name) {
|
70
|
+
std::shared_ptr<RootCertInfo> roots_to_report;
|
71
|
+
if (roots != nullptr && watcher_it->second.root_cert_name == cert_name) {
|
67
72
|
// In this case, We've already sent the credential updates at the time
|
68
73
|
// when checking pem_root_certs, so we will skip here.
|
69
74
|
continue;
|
70
75
|
} else if (watcher_it->second.root_cert_name.has_value()) {
|
71
76
|
auto& root_cert_info =
|
72
77
|
certificate_info_map_[*watcher_it->second.root_cert_name];
|
73
|
-
if (!root_cert_info.
|
74
|
-
|
78
|
+
if (!root_cert_info.AreRootsEmpty()) {
|
79
|
+
roots_to_report = root_cert_info.roots;
|
75
80
|
}
|
76
81
|
}
|
77
|
-
watcher_ptr->OnCertificatesChanged(
|
82
|
+
watcher_ptr->OnCertificatesChanged(std::move(roots_to_report),
|
78
83
|
pem_key_cert_pairs);
|
79
84
|
}
|
80
85
|
cert_info.pem_key_cert_pairs = std::move(*pem_key_cert_pairs);
|
@@ -85,8 +90,7 @@ bool grpc_tls_certificate_distributor::HasRootCerts(
|
|
85
90
|
const std::string& root_cert_name) {
|
86
91
|
grpc_core::MutexLock lock(&mu_);
|
87
92
|
const auto it = certificate_info_map_.find(root_cert_name);
|
88
|
-
return it != certificate_info_map_.end() &&
|
89
|
-
!it->second.pem_root_certs.empty();
|
93
|
+
return it != certificate_info_map_.end() && !it->second.AreRootsEmpty();
|
90
94
|
};
|
91
95
|
|
92
96
|
bool grpc_tls_certificate_distributor::HasKeyCertPairs(
|
@@ -129,9 +133,9 @@ void grpc_tls_certificate_distributor::SetErrorForCert(
|
|
129
133
|
CHECK_NE(watcher_ptr, nullptr);
|
130
134
|
const auto watcher_it = watchers_.find(watcher_ptr);
|
131
135
|
CHECK(watcher_it != watchers_.end());
|
132
|
-
//
|
133
|
-
// watching, if there is any.
|
134
|
-
grpc_error_handle
|
136
|
+
// root_error_to_report is the error of the roots this watcher
|
137
|
+
// is watching, if there is any.
|
138
|
+
grpc_error_handle root_error_to_report;
|
135
139
|
if (root_cert_error.has_value() &&
|
136
140
|
watcher_it->second.root_cert_name == cert_name) {
|
137
141
|
// In this case, We've already sent the error updates at the time when
|
@@ -140,9 +144,9 @@ void grpc_tls_certificate_distributor::SetErrorForCert(
|
|
140
144
|
} else if (watcher_it->second.root_cert_name.has_value()) {
|
141
145
|
auto& root_cert_info =
|
142
146
|
certificate_info_map_[*watcher_it->second.root_cert_name];
|
143
|
-
|
147
|
+
root_error_to_report = root_cert_info.root_cert_error;
|
144
148
|
}
|
145
|
-
watcher_ptr->OnError(
|
149
|
+
watcher_ptr->OnError(root_error_to_report, *identity_cert_error);
|
146
150
|
}
|
147
151
|
cert_info.SetIdentityError(*identity_cert_error);
|
148
152
|
}
|
@@ -186,7 +190,7 @@ void grpc_tls_certificate_distributor::WatchTlsCertificates(
|
|
186
190
|
CHECK(watcher_it == watchers_.end());
|
187
191
|
watchers_[watcher_ptr] = {std::move(watcher), root_cert_name,
|
188
192
|
identity_cert_name};
|
189
|
-
std::
|
193
|
+
std::shared_ptr<RootCertInfo> updated_roots;
|
190
194
|
std::optional<grpc_core::PemKeyCertPairList> updated_identity_pairs;
|
191
195
|
grpc_error_handle root_error;
|
192
196
|
grpc_error_handle identity_error;
|
@@ -198,8 +202,8 @@ void grpc_tls_certificate_distributor::WatchTlsCertificates(
|
|
198
202
|
cert_info.root_cert_watchers.insert(watcher_ptr);
|
199
203
|
root_error = cert_info.root_cert_error;
|
200
204
|
// Empty credentials will be treated as no updates.
|
201
|
-
if (!cert_info.
|
202
|
-
|
205
|
+
if (!cert_info.AreRootsEmpty()) {
|
206
|
+
updated_roots = cert_info.roots;
|
203
207
|
}
|
204
208
|
}
|
205
209
|
if (identity_cert_name.has_value()) {
|
@@ -219,11 +223,12 @@ void grpc_tls_certificate_distributor::WatchTlsCertificates(
|
|
219
223
|
// occurred while trying to fetch the latest cert, but the updated_*_certs
|
220
224
|
// should always be valid. So we will send the updates regardless of
|
221
225
|
// *_cert_error.
|
222
|
-
if (
|
223
|
-
watcher_ptr->OnCertificatesChanged(
|
226
|
+
if (updated_roots != nullptr || updated_identity_pairs.has_value()) {
|
227
|
+
watcher_ptr->OnCertificatesChanged(updated_roots,
|
224
228
|
std::move(updated_identity_pairs));
|
225
229
|
}
|
226
|
-
// Notify this watcher if the certs it is watching already had some
|
230
|
+
// Notify this watcher if the certs it is watching already had some
|
231
|
+
// errors.
|
227
232
|
if (!root_error.ok() || !identity_error.ok()) {
|
228
233
|
watcher_ptr->OnError(root_error, identity_error);
|
229
234
|
}
|
@@ -29,8 +29,10 @@
|
|
29
29
|
|
30
30
|
#include "absl/base/thread_annotations.h"
|
31
31
|
#include "absl/strings/string_view.h"
|
32
|
+
#include "src/core/credentials/transport/tls/spiffe_utils.h"
|
32
33
|
#include "src/core/credentials/transport/tls/ssl_utils.h"
|
33
34
|
#include "src/core/lib/iomgr/error.h"
|
35
|
+
#include "src/core/tsi/ssl_transport_security.h"
|
34
36
|
#include "src/core/util/ref_counted.h"
|
35
37
|
#include "src/core/util/sync.h"
|
36
38
|
|
@@ -53,11 +55,11 @@ struct grpc_tls_certificate_distributor
|
|
53
55
|
// latest contents for both root and identity certificates, even when only
|
54
56
|
// one side of it got updated.
|
55
57
|
//
|
56
|
-
// @param
|
58
|
+
// @param roots the contents of the reloaded roots.
|
57
59
|
// @param key_cert_pairs the contents of the reloaded identity key-cert
|
58
60
|
// pairs.
|
59
61
|
virtual void OnCertificatesChanged(
|
60
|
-
std::
|
62
|
+
std::shared_ptr<RootCertInfo> roots,
|
61
63
|
std::optional<grpc_core::PemKeyCertPairList> key_cert_pairs) = 0;
|
62
64
|
|
63
65
|
// Handles an error that occurs while attempting to fetch certificate data.
|
@@ -81,10 +83,11 @@ struct grpc_tls_certificate_distributor
|
|
81
83
|
// Sets the key materials based on their certificate name.
|
82
84
|
//
|
83
85
|
// @param cert_name The name of the certificates being updated.
|
84
|
-
// @param
|
86
|
+
// @param roots The content of the roots, either the pem root certificates or
|
87
|
+
// the SpiffeBundleMap.
|
85
88
|
// @param pem_key_cert_pairs The content of identity key-cert pairs.
|
86
89
|
void SetKeyMaterials(
|
87
|
-
const std::string& cert_name, std::
|
90
|
+
const std::string& cert_name, std::shared_ptr<RootCertInfo> roots,
|
88
91
|
std::optional<grpc_core::PemKeyCertPairList> pem_key_cert_pairs);
|
89
92
|
|
90
93
|
bool HasRootCerts(const std::string& root_cert_name);
|
@@ -171,10 +174,12 @@ struct grpc_tls_certificate_distributor
|
|
171
174
|
// root certs, while pem_root_certs still contains the valid old data.
|
172
175
|
struct CertificateInfo {
|
173
176
|
// The contents of the root certificates.
|
174
|
-
std::
|
177
|
+
std::shared_ptr<RootCertInfo> roots;
|
175
178
|
// The contents of the identity key-certificate pairs.
|
176
179
|
grpc_core::PemKeyCertPairList pem_key_cert_pairs;
|
177
|
-
//
|
180
|
+
// TODO(gtcooke94) Swap to using absl::StatusOr<>
|
181
|
+
// https://github.com/grpc/grpc/pull/39708/files#r2144014200 The root cert
|
182
|
+
// reloading error propagated by the caller.
|
178
183
|
grpc_error_handle root_cert_error;
|
179
184
|
// The identity cert reloading error propagated by the caller.
|
180
185
|
grpc_error_handle identity_cert_error;
|
@@ -188,10 +193,16 @@ struct grpc_tls_certificate_distributor
|
|
188
193
|
std::set<TlsCertificatesWatcherInterface*> identity_cert_watchers;
|
189
194
|
|
190
195
|
~CertificateInfo() {}
|
196
|
+
// TODO(gtcooke94) These can be set directly, no need for setters
|
197
|
+
// https://github.com/grpc/grpc/pull/39708/files#r2144015746
|
191
198
|
void SetRootError(grpc_error_handle error) { root_cert_error = error; }
|
192
199
|
void SetIdentityError(grpc_error_handle error) {
|
193
200
|
identity_cert_error = error;
|
194
201
|
}
|
202
|
+
|
203
|
+
// Returns if the root variant contains either "", an empty SpiffeBundleMap,
|
204
|
+
// or a nullptr to a SpiffeBundleMap
|
205
|
+
bool AreRootsEmpty();
|
195
206
|
};
|
196
207
|
|
197
208
|
grpc_core::Mutex mu_;
|
@@ -202,8 +213,8 @@ struct grpc_tls_certificate_distributor
|
|
202
213
|
// Stores information about each watcher.
|
203
214
|
std::map<TlsCertificatesWatcherInterface*, WatcherInfo> watchers_
|
204
215
|
ABSL_GUARDED_BY(mu_);
|
205
|
-
// The callback to notify the caller, e.g. the Producer, that the watch
|
206
|
-
// is changed.
|
216
|
+
// The callback to notify the caller, e.g. the Producer, that the watch
|
217
|
+
// status is changed.
|
207
218
|
std::function<void(std::string, bool, bool)> watch_status_callback_
|
208
219
|
ABSL_GUARDED_BY(callback_mu_);
|
209
220
|
// Stores the names of each certificate, and their corresponding credential
|