grpc 1.85.4 → 1.86.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 +13 -9
- data/etc/roots.pem +0 -583
- data/include/grpc/channel_factory.h +78 -0
- data/include/grpc/credentials.h +21 -0
- data/include/grpc/grpc.h +7 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/module.modulemap +1 -0
- data/src/core/call/call_filters.cc +4 -1
- data/src/core/call/call_filters.h +3 -1
- data/src/core/call/call_spine.h +12 -6
- data/src/core/call/call_state.h +3 -3
- data/src/core/call/client_call.cc +4 -1
- data/src/core/call/client_call.h +1 -0
- data/src/core/call/filter_fusion.h +2 -15
- data/src/core/call/interception_chain.h +2 -7
- data/src/core/call/metadata_batch.cc +5 -0
- data/src/core/call/metadata_batch.h +13 -3
- data/src/core/call/request_buffer.cc +1 -1
- data/src/core/call/server_call.cc +3 -3
- data/src/core/call/server_call.h +15 -0
- data/src/core/channelz/channelz_registry.cc +4 -4
- data/src/core/client_channel/backup_poller.cc +1 -2
- data/src/core/client_channel/channel_factory.cc +110 -0
- data/src/core/client_channel/channel_factory.h +45 -0
- data/src/core/client_channel/global_subchannel_pool.cc +2 -2
- data/src/core/client_channel/lame_channel.cc +59 -0
- data/src/core/client_channel/lame_channel.h +86 -0
- data/src/core/credentials/call/external/aws_request_signer.cc +2 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +6 -17
- data/src/core/credentials/call/external/url_external_account_credentials.h +0 -1
- data/src/core/credentials/call/jwt/jwt_verifier.cc +25 -13
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +14 -0
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +12 -2
- data/src/core/credentials/transport/tls/ssl_utils.cc +20 -0
- data/src/core/credentials/transport/tls/ssl_utils.h +4 -0
- data/src/core/credentials/transport/tls/tls_security_connector.cc +6 -2
- data/src/core/ext/filters/rbac/rbac_filter.cc +3 -41
- data/src/core/ext/filters/rbac/rbac_filter.h +2 -11
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +31 -24
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +1 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +69 -102
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -1
- data/src/core/ext/transport/chttp2/transport/flow_control.h +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame.cc +15 -19
- data/src/core/ext/transport/chttp2/transport/frame.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +18 -61
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +0 -4
- data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +9 -0
- data/src/core/ext/transport/chttp2/transport/goaway.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/goaway.h +0 -5
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +1 -5
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +34 -19
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +5 -2
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +134 -82
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +30 -15
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +4 -3
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +9 -33
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +1 -6
- data/src/core/ext/transport/chttp2/transport/http2_transport_stats.h +60 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -1
- data/src/core/ext/transport/chttp2/transport/keepalive.h +1 -4
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -8
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +35 -11
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +52 -47
- data/src/core/ext/transport/chttp2/transport/read_context.h +19 -5
- data/src/core/ext/transport/chttp2/transport/security_frame.h +7 -6
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +7 -5
- data/src/core/ext/transport/chttp2/transport/transport_common.cc +47 -0
- data/src/core/ext/transport/chttp2/transport/transport_common.h +29 -0
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +1 -1
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +1 -7
- data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb.h +16 -0
- data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb_minitable.c +4 -3
- data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +129 -81
- data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +50 -39
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +411 -163
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +95 -44
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.h +3 -0
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb.h +41 -8
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb_minitable.c +8 -5
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +427 -222
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +97 -66
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb.h +130 -99
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb_minitable.c +29 -27
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +49 -33
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +19 -8
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +95 -3
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +33 -6
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb.h +93 -11
- data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb_minitable.c +8 -5
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +656 -134
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +117 -51
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +45 -23
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +19 -10
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +99 -34
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +12 -7
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +344 -273
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +62 -69
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +1 -3
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +53 -22
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +9 -7
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +108 -0
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.c +26 -2
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +809 -231
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +183 -77
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +3 -0
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +151 -26
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +17 -9
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +24 -8
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +6 -5
- data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb.h +224 -16
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.c +83 -10
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +95 -79
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +23 -22
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb.h +34 -18
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.c +10 -9
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +243 -2
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +53 -5
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h +3 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb.h +53 -22
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb_minitable.c +9 -7
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +23 -7
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +9 -4
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +516 -215
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +99 -60
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +60 -28
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +12 -10
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +109 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +32 -2
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +37 -4
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +7 -4
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +65 -47
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +29 -12
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +20 -4
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb_minitable.c +6 -3
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +776 -88
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +195 -35
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +5 -0
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb.h +23 -7
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.c +10 -3
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb.h +44 -0
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.c +11 -2
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/type/v3/scope.upb.h +218 -0
- data/src/core/ext/upb-gen/envoy/type/v3/scope.upb_minitable.c +70 -0
- data/src/core/ext/upb-gen/envoy/type/v3/scope.upb_minitable.h +31 -0
- data/src/core/ext/upbdefs-gen/envoy/admin/v3/clusters.upbdefs.c +30 -24
- data/src/core/ext/upbdefs-gen/envoy/admin/v3/server_info.upbdefs.c +166 -152
- data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +467 -422
- data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +120 -110
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +912 -857
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/outlier_detection.upbdefs.c +26 -19
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +59 -54
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +356 -346
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/http_service.upbdefs.c +49 -37
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +599 -483
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +65 -49
- data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +165 -161
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +369 -327
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -15
- data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +129 -121
- data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +224 -204
- data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +2046 -1932
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +70 -37
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +7 -3
- data/src/core/ext/upbdefs-gen/envoy/data/accesslog/v3/accesslog.upbdefs.c +5 -3
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.c +121 -78
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +165 -160
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +121 -118
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.c +68 -37
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/router/v3/router.upbdefs.c +48 -40
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +44 -37
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +919 -870
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +26 -14
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +44 -36
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +372 -371
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +32 -28
- data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.c +17 -15
- data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.c +4 -1
- data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/type/v3/scope.upbdefs.c +76 -0
- data/src/core/ext/upbdefs-gen/envoy/type/v3/scope.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/envoy/type/v3/token_bucket.upbdefs.c +1 -1
- data/src/core/filter/ext_proc/ext_proc_filter.cc +537 -259
- data/src/core/filter/ext_proc/ext_proc_filter.h +47 -14
- data/src/core/filter/ext_proc/ext_proc_messages.cc +38 -17
- data/src/core/filter/ext_proc/ext_proc_messages.h +19 -7
- data/src/core/filter/filter_args.h +5 -60
- data/src/core/handshaker/http_connect/http_connect_client_handshaker.cc +1 -1
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +23 -22
- data/src/core/handshaker/security/secure_endpoint.cc +16 -16
- data/src/core/lib/channel/channel_stack.cc +0 -12
- data/src/core/lib/channel/channel_stack.h +0 -8
- data/src/core/lib/channel/promise_based_filter.cc +57 -44
- data/src/core/lib/channel/promise_based_filter.h +29 -41
- data/src/core/lib/event_engine/ares_resolver.cc +10 -4
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +1 -1
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -5
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -12
- data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +3 -17
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +21 -1
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +10 -12
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
- data/src/core/lib/event_engine/posix_engine/timer.cc +2 -2
- data/src/core/lib/event_engine/shim.cc +1 -6
- data/src/core/lib/event_engine/shim.h +0 -5
- data/src/core/lib/event_engine/windows/windows_engine.cc +4 -4
- data/src/core/lib/event_engine/windows/windows_listener.cc +1 -1
- data/src/core/lib/experiments/experiments.cc +141 -246
- data/src/core/lib/experiments/experiments.h +42 -109
- data/src/core/lib/iomgr/iomgr_windows.cc +1 -6
- data/src/core/lib/iomgr/tcp_posix.cc +21 -21
- data/src/core/lib/iomgr/tcp_server_posix.cc +64 -242
- data/src/core/lib/iomgr/tcp_server_windows.cc +0 -469
- data/src/core/lib/promise/activity.cc +8 -8
- data/src/core/lib/promise/activity.h +5 -5
- data/src/core/lib/promise/inter_activity_pipe.h +3 -3
- data/src/core/lib/promise/party.cc +5 -5
- data/src/core/lib/promise/status_flag.h +7 -2
- data/src/core/lib/resource_quota/memory_quota.cc +2 -2
- data/src/core/lib/security/authorization/rbac_policy.h +2 -2
- data/src/core/lib/surface/call.cc +13 -3
- data/src/core/lib/surface/call.h +23 -6
- data/src/core/lib/surface/channel_create.cc +7 -1
- data/src/core/lib/surface/channel_init.h +1 -8
- data/src/core/lib/surface/filter_stack_call.cc +16 -0
- data/src/core/lib/surface/filter_stack_call.h +1 -0
- data/src/core/lib/surface/init.cc +3 -3
- data/src/core/lib/surface/legacy_channel.cc +4 -1
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/transport.cc +15 -8
- data/src/core/lib/transport/transport_framing_endpoint_extension.h +8 -2
- data/src/core/load_balancing/autosharding/autosharding.cc +0 -8
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +99 -8
- data/src/core/load_balancing/outlier_detection/outlier_detection_metrics.cc +38 -0
- data/src/core/load_balancing/outlier_detection/outlier_detection_metrics.h +55 -0
- data/src/core/load_balancing/ring_hash/ring_hash.cc +2 -1
- data/src/core/load_balancing/rls/rls.cc +21 -1
- data/src/core/load_balancing/xds/cds.cc +4 -51
- data/src/core/plugin_registry/grpc_plugin_registry.cc +10 -13
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -7
- data/src/core/resolver/xds/xds_resolver.cc +1 -1
- data/src/core/server/server.cc +60 -4
- data/src/core/server/server_config_selector.h +4 -18
- data/src/core/server/server_config_selector_filter.cc +20 -146
- data/src/core/server/server_config_selector_filter.h +2 -2
- data/src/core/server/xds_server_config_fetcher.cc +5 -20
- data/src/core/transport/auth_context.cc +15 -5
- data/src/core/transport/auth_context.h +5 -0
- data/src/core/tsi/ssl_telemetry_utils.cc +9 -1
- data/src/core/tsi/ssl_transport_security.cc +158 -52
- data/src/core/tsi/ssl_transport_security.h +18 -2
- data/src/core/tsi/ssl_transport_security_utils.cc +123 -12
- data/src/core/tsi/ssl_transport_security_utils.h +19 -0
- data/src/core/util/latent_see.cc +65 -3
- data/src/core/util/latent_see.h +57 -12
- data/src/core/util/linux/cpu.cc +12 -6
- data/src/core/util/mpscq.cc +2 -2
- data/src/core/util/sync_abseil.cc +3 -3
- data/src/core/util/trie_lookup.h +5 -1
- data/src/core/util/windows/env.cc +1 -0
- data/src/core/util/work_serializer.cc +1 -1
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +10 -9
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +3 -3
- data/src/core/xds/grpc/streaming_call_promise_wrapper.cc +5 -2
- data/src/core/xds/grpc/streaming_call_promise_wrapper.h +2 -5
- data/src/core/xds/grpc/xds_audit_logger_registry.cc +0 -54
- data/src/core/xds/grpc/xds_audit_logger_registry.h +0 -8
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +2 -28
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +0 -20
- data/src/core/xds/grpc/xds_client_grpc.cc +4 -4
- data/src/core/xds/grpc/xds_client_grpc.h +1 -1
- data/src/core/xds/grpc/xds_cluster_parser.cc +5 -1
- data/src/core/xds/grpc/xds_common_types_parser.cc +12 -0
- data/src/core/xds/grpc/xds_endpoint_parser.cc +3 -3
- data/src/core/xds/grpc/xds_http_composite_filter.cc +0 -5
- data/src/core/xds/grpc/xds_http_composite_filter.h +1 -27
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +1 -5
- data/src/core/xds/grpc/xds_http_ext_proc_filter.h +3 -29
- data/src/core/xds/grpc/xds_http_fault_filter.cc +0 -4
- data/src/core/xds/grpc/xds_http_fault_filter.h +0 -26
- data/src/core/xds/grpc/xds_http_filter.h +1 -63
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +0 -5
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +1 -27
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +0 -527
- data/src/core/xds/grpc/xds_http_rbac_filter.h +0 -15
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +0 -5
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +0 -26
- data/src/core/xds/grpc/xds_listener.cc +0 -2
- data/src/core/xds/grpc/xds_listener.h +0 -2
- data/src/core/xds/grpc/xds_listener_parser.cc +0 -7
- data/src/core/xds/grpc/xds_matcher.cc +17 -11
- data/src/core/xds/grpc/xds_matcher.h +2 -1
- data/src/core/xds/grpc/xds_matcher_context.cc +3 -0
- data/src/core/xds/grpc/xds_matcher_context.h +1 -1
- data/src/core/xds/grpc/xds_matcher_input.cc +19 -1
- data/src/core/xds/grpc/xds_matcher_parse.cc +3 -2
- data/src/core/xds/grpc/xds_route_config.cc +0 -2
- data/src/core/xds/grpc/xds_route_config.h +0 -2
- data/src/core/xds/grpc/xds_route_config_parser.cc +0 -5
- data/src/core/xds/grpc/xds_routing.cc +1 -112
- data/src/core/xds/grpc/xds_routing.h +0 -26
- data/src/core/xds/grpc/xds_transport_factory_grpc.cc +236 -0
- data/src/core/xds/grpc/xds_transport_factory_grpc.h +95 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +78 -241
- data/src/core/xds/grpc/xds_transport_grpc.h +41 -51
- data/src/core/xds/xds_client/lrs_client.cc +3 -5
- data/src/core/xds/xds_client/lrs_client.h +2 -1
- data/src/core/xds/xds_client/xds_client.cc +36 -23
- data/src/core/xds/xds_client/xds_client.h +6 -5
- data/src/core/xds/xds_client/xds_transport.h +110 -108
- data/src/core/xds/xds_client/xds_transport_factory.h +43 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/crypto/asn1/a_type.cc +54 -19
- data/third_party/boringssl-with-bazel/crypto/asn1/asn1_lib.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/asn1/internal.h +58 -12
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_dec.cc +13 -13
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_enc.cc +13 -11
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_fre.cc +14 -18
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_new.cc +31 -35
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_typ.cc +0 -2
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_utl.cc +17 -24
- data/third_party/boringssl-with-bazel/crypto/bio/bio.cc +0 -1
- data/third_party/boringssl-with-bazel/crypto/bio/bio_mem.cc +9 -3
- data/third_party/boringssl-with-bazel/crypto/bio/connect.cc +3 -3
- data/third_party/boringssl-with-bazel/crypto/bio/fd.cc +0 -1
- data/third_party/boringssl-with-bazel/crypto/bio/file.cc +0 -1
- data/third_party/boringssl-with-bazel/crypto/bio/internal.h +2 -3
- data/third_party/boringssl-with-bazel/crypto/bio/pair.cc +0 -1
- data/third_party/boringssl-with-bazel/crypto/bio/socket.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbb.cc +70 -45
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbs.cc +15 -34
- data/third_party/boringssl-with-bazel/crypto/bytestring/internal.h +5 -0
- data/third_party/boringssl-with-bazel/crypto/cipher/e_aesgcmsiv.cc +20 -165
- data/third_party/boringssl-with-bazel/crypto/cipher/e_tls.cc +7 -4
- data/third_party/boringssl-with-bazel/crypto/cipher/internal.h +159 -0
- data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519.cc +295 -16
- data/third_party/boringssl-with-bazel/crypto/curve25519/internal.h +25 -14
- data/third_party/boringssl-with-bazel/crypto/dh/params.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/ec/hash_to_curve.cc +208 -36
- data/third_party/boringssl-with-bazel/crypto/err/err.cc +3 -2
- data/third_party/boringssl-with-bazel/crypto/evp/evp.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/evp/evp_kem.cc +25 -6
- data/third_party/boringssl-with-bazel/crypto/evp/internal.h +15 -11
- data/third_party/boringssl-with-bazel/crypto/evp/p_ec.cc +121 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_mlkem.cc +34 -9
- data/third_party/boringssl-with-bazel/crypto/evp/p_rsa.cc +76 -8
- data/third_party/boringssl-with-bazel/crypto/evp/p_xwing.cc +47 -20
- data/third_party/boringssl-with-bazel/crypto/ex_data.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/aes_nohw.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/gcm.cc.inc +2 -2
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bcm.cc +1 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/add.cc.inc +9 -4
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +4 -4
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/exponentiation.cc.inc +2 -2
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/internal.h +12 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/jacobi.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/montgomery_inv.cc.inc +4 -4
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/prime.cc.inc +3 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/rsaz_exp.cc.inc +6 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/sqrt.cc.inc +21 -21
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/aead.cc.inc +4 -2
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/cipher.cc.inc +97 -132
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/internal.h +7 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/dh.cc.inc +3 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/internal.h +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec.cc.inc +77 -17
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec_montgomery.cc.inc +13 -13
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/felem.cc.inc +117 -34
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/internal.h +67 -18
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/oct.cc.inc +29 -151
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.cc.inc +740 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.h +207 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256.cc.inc +407 -519
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/simple.cc.inc +27 -28
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/jitter.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/fips_shared_support.cc +4 -4
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/internal.h +70 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/keccak.cc.inc +292 -52
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mldsa/mldsa.cc.inc +226 -69
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mlkem/mlkem.cc.inc +238 -83
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/rsa_impl.cc.inc +6 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha1.cc.inc +2 -2
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/fors.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/hpke/hpke.cc +327 -272
- data/third_party/boringssl-with-bazel/crypto/hrss/hrss.cc +14 -14
- data/third_party/boringssl-with-bazel/crypto/internal.h +63 -0
- data/third_party/boringssl-with-bazel/crypto/mem_internal.h +38 -3
- data/third_party/boringssl-with-bazel/crypto/obj/obj_dat.h +97 -1
- data/third_party/boringssl-with-bazel/crypto/pem/internal.h +86 -0
- data/third_party/boringssl-with-bazel/crypto/pem/pem_all.cc +8 -5
- data/third_party/boringssl-with-bazel/crypto/pem/pem_lib.cc +41 -73
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pk8.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pkey.cc +10 -4
- data/third_party/boringssl-with-bazel/crypto/pem/pem_x509.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/pem/pem_xaux.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7_x509.cc +2 -2
- data/third_party/boringssl-with-bazel/crypto/pkcs8/pkcs8_x509.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/poly1305/internal.h +17 -0
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_arm.cc +1 -13
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_vec.cc +3 -3
- data/third_party/boringssl-with-bazel/crypto/slhdsa/slhdsa.cc +23 -6
- data/third_party/boringssl-with-bazel/crypto/stack/stack.cc +7 -0
- data/third_party/boringssl-with-bazel/crypto/trust_token/internal.h +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/a_verify.cc +14 -7
- data/third_party/boringssl-with-bazel/crypto/x509/internal.h +110 -76
- data/third_party/boringssl-with-bazel/crypto/x509/name_print.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/rsa_pss.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/t_req.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/t_x509.cc +6 -5
- data/third_party/boringssl-with-bazel/crypto/x509/v3_crld.cc +11 -53
- data/third_party/boringssl-with-bazel/crypto/x509/v3_ncons.cc +5 -5
- data/third_party/boringssl-with-bazel/crypto/x509/v3_purp.cc +16 -39
- data/third_party/boringssl-with-bazel/crypto/x509/v3_skey.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/v3_utl.cc +12 -16
- data/third_party/boringssl-with-bazel/crypto/x509/x509_cmp.cc +9 -11
- data/third_party/boringssl-with-bazel/crypto/x509/x509_mtc.cc +598 -0
- data/third_party/boringssl-with-bazel/crypto/x509/x509_obj.cc +9 -8
- data/third_party/boringssl-with-bazel/crypto/x509/x509_set.cc +14 -18
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vfy.cc +315 -390
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vpm.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/x509name.cc +31 -29
- data/third_party/boringssl-with-bazel/crypto/x509/x_all.cc +10 -9
- data/third_party/boringssl-with-bazel/crypto/x509/x_crl.cc +3 -53
- data/third_party/boringssl-with-bazel/crypto/x509/x_name.cc +37 -59
- data/third_party/boringssl-with-bazel/crypto/x509/x_pubkey.cc +29 -47
- data/third_party/boringssl-with-bazel/crypto/x509/x_req.cc +2 -1
- data/third_party/boringssl-with-bazel/crypto/x509/x_x509.cc +53 -53
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +24 -0
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +24 -0
- data/third_party/boringssl-with-bazel/gen/crypto/err_data.cc +509 -497
- data/third_party/boringssl-with-bazel/include/openssl/aead.h +7 -19
- data/third_party/boringssl-with-bazel/include/openssl/asm_base.h +1 -1
- data/third_party/boringssl-with-bazel/include/openssl/asn1.h +6 -10
- data/third_party/boringssl-with-bazel/include/openssl/base.h +43 -16
- data/third_party/boringssl-with-bazel/include/openssl/bio.h +25 -10
- data/third_party/boringssl-with-bazel/include/openssl/bytestring.h +33 -1
- data/third_party/boringssl-with-bazel/include/openssl/cipher.h +11 -9
- data/third_party/boringssl-with-bazel/include/openssl/configuration.h +18 -0
- data/third_party/boringssl-with-bazel/include/openssl/curve25519.h +36 -0
- data/third_party/boringssl-with-bazel/include/openssl/digest.h +4 -4
- data/third_party/boringssl-with-bazel/include/openssl/ec.h +35 -1
- data/third_party/boringssl-with-bazel/include/openssl/ec_key.h +2 -2
- data/third_party/boringssl-with-bazel/include/openssl/evp.h +120 -3
- data/third_party/boringssl-with-bazel/include/openssl/evp_errors.h +1 -0
- data/third_party/boringssl-with-bazel/include/openssl/hmac.h +2 -2
- data/third_party/boringssl-with-bazel/include/openssl/hpke.h +38 -7
- data/third_party/boringssl-with-bazel/include/openssl/mem.h +5 -5
- data/third_party/boringssl-with-bazel/include/openssl/nid.h +42 -0
- data/third_party/boringssl-with-bazel/include/openssl/pem.h +650 -351
- data/third_party/boringssl-with-bazel/include/openssl/posix_time.h +4 -4
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols.h +130 -4
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_S.h +48 -0
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_c.h +24 -0
- data/third_party/boringssl-with-bazel/include/openssl/rsa.h +1 -1
- data/third_party/boringssl-with-bazel/include/openssl/slhdsa.h +25 -1
- data/third_party/boringssl-with-bazel/include/openssl/ssl.h +256 -87
- data/third_party/boringssl-with-bazel/include/openssl/stack.h +9 -0
- data/third_party/boringssl-with-bazel/include/openssl/types.h +18 -0
- data/third_party/boringssl-with-bazel/include/openssl/x509.h +40 -21
- data/third_party/boringssl-with-bazel/ssl/bio_ssl.cc +3 -5
- data/third_party/boringssl-with-bazel/ssl/d1_both.cc +146 -81
- data/third_party/boringssl-with-bazel/ssl/d1_lib.cc +39 -34
- data/third_party/boringssl-with-bazel/ssl/d1_pkt.cc +6 -6
- data/third_party/boringssl-with-bazel/ssl/d1_srtp.cc +10 -8
- data/third_party/boringssl-with-bazel/ssl/dtls_method.cc +4 -4
- data/third_party/boringssl-with-bazel/ssl/dtls_record.cc +15 -14
- data/third_party/boringssl-with-bazel/ssl/encrypted_client_hello.cc +41 -25
- data/third_party/boringssl-with-bazel/ssl/extensions.cc +153 -171
- data/third_party/boringssl-with-bazel/ssl/handoff.cc +79 -64
- data/third_party/boringssl-with-bazel/ssl/handshake.cc +15 -16
- data/third_party/boringssl-with-bazel/ssl/handshake_client.cc +35 -78
- data/third_party/boringssl-with-bazel/ssl/handshake_server.cc +75 -155
- data/third_party/boringssl-with-bazel/ssl/internal.h +419 -308
- data/third_party/boringssl-with-bazel/ssl/s3_both.cc +17 -150
- data/third_party/boringssl-with-bazel/ssl/s3_lib.cc +2 -3
- data/third_party/boringssl-with-bazel/ssl/s3_pkt.cc +10 -9
- data/third_party/boringssl-with-bazel/ssl/ssl_asn1.cc +13 -13
- data/third_party/boringssl-with-bazel/ssl/ssl_buffer.cc +8 -8
- data/third_party/boringssl-with-bazel/ssl/ssl_cert.cc +58 -24
- data/third_party/boringssl-with-bazel/ssl/ssl_cipher.cc +198 -26
- data/third_party/boringssl-with-bazel/ssl/ssl_credential.cc +164 -37
- data/third_party/boringssl-with-bazel/ssl/ssl_file.cc +10 -8
- data/third_party/boringssl-with-bazel/ssl/ssl_key_share.cc +2 -95
- data/third_party/boringssl-with-bazel/ssl/ssl_lib.cc +785 -472
- data/third_party/boringssl-with-bazel/ssl/ssl_privkey.cc +78 -67
- data/third_party/boringssl-with-bazel/ssl/ssl_session.cc +187 -150
- data/third_party/boringssl-with-bazel/ssl/ssl_stat.cc +6 -3
- data/third_party/boringssl-with-bazel/ssl/ssl_transcript.cc +1 -1
- data/third_party/boringssl-with-bazel/ssl/ssl_versions.cc +25 -19
- data/third_party/boringssl-with-bazel/ssl/ssl_x509.cc +148 -114
- data/third_party/boringssl-with-bazel/ssl/t1_enc.cc +28 -19
- data/third_party/boringssl-with-bazel/ssl/tls13_both.cc +24 -22
- data/third_party/boringssl-with-bazel/ssl/tls13_client.cc +30 -30
- data/third_party/boringssl-with-bazel/ssl/tls13_enc.cc +17 -16
- data/third_party/boringssl-with-bazel/ssl/tls13_server.cc +55 -63
- data/third_party/boringssl-with-bazel/ssl/tls_method.cc +12 -12
- data/third_party/boringssl-with-bazel/ssl/tls_record.cc +23 -20
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64.h +38 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64_msvc.h +2 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_field.c.inc +26 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_point.br.c.inc +0 -54
- data/third_party/cares/cares/include/ares.h +8 -0
- data/third_party/cares/cares/include/ares_dns_record.h +3 -2
- data/third_party/cares/cares/include/ares_version.h +3 -3
- data/third_party/cares/cares/src/lib/ares_addrinfo_localhost.c +20 -20
- data/third_party/cares/cares/src/lib/ares_cancel.c +17 -8
- data/third_party/cares/cares/src/lib/ares_close_sockets.c +81 -16
- data/third_party/cares/cares/src/lib/ares_conn.c +256 -10
- data/third_party/cares/cares/src/lib/ares_conn.h +40 -3
- data/third_party/cares/cares/src/lib/ares_cookie.c +2 -2
- data/third_party/cares/cares/src/lib/ares_destroy.c +75 -10
- data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +85 -10
- data/third_party/cares/cares/src/lib/ares_gethostbyaddr.c +5 -0
- data/third_party/cares/cares/src/lib/ares_gethostbyname.c +4 -0
- data/third_party/cares/cares/src/lib/ares_getnameinfo.c +10 -2
- data/third_party/cares/cares/src/lib/ares_hosts_file.c +8 -0
- data/third_party/cares/cares/src/lib/ares_inet_net_pton.h +28 -0
- data/third_party/cares/cares/src/lib/ares_init.c +55 -10
- data/third_party/cares/cares/src/lib/ares_library_init.c +25 -7
- data/third_party/cares/cares/src/lib/ares_options.c +38 -10
- data/third_party/cares/cares/src/lib/ares_parse_into_addrinfo.c +1 -1
- data/third_party/cares/cares/src/lib/ares_private.h +186 -27
- data/third_party/cares/cares/src/lib/ares_process.c +604 -112
- data/third_party/cares/cares/src/lib/ares_qcache.c +200 -36
- data/third_party/cares/cares/src/lib/ares_query.c +5 -0
- data/third_party/cares/cares/src/lib/ares_search.c +10 -0
- data/third_party/cares/cares/src/lib/ares_send.c +81 -10
- data/third_party/cares/cares/src/lib/ares_set_socket_functions.c +3 -1
- data/third_party/cares/cares/src/lib/ares_socket.c +28 -0
- data/third_party/cares/cares/src/lib/ares_socket.h +23 -0
- data/third_party/cares/cares/src/lib/ares_sysconfig.c +6 -3
- data/third_party/cares/cares/src/lib/ares_sysconfig_files.c +33 -11
- data/third_party/cares/cares/src/lib/ares_sysconfig_win.c +132 -80
- data/third_party/cares/cares/src/lib/ares_timeout.c +11 -0
- data/third_party/cares/cares/src/lib/ares_update_servers.c +55 -11
- data/third_party/cares/cares/src/lib/dsa/ares_array.c +20 -5
- data/third_party/cares/cares/src/lib/dsa/ares_htable.c +8 -4
- data/third_party/cares/cares/src/lib/dsa/ares_htable_dict.c +2 -0
- data/third_party/cares/cares/src/lib/dsa/ares_llist.c +4 -1
- data/third_party/cares/cares/src/lib/event/ares_event_configchg.c +5 -2
- data/third_party/cares/cares/src/lib/event/ares_event_select.c +14 -1
- data/third_party/cares/cares/src/lib/event/ares_event_thread.c +8 -0
- data/third_party/cares/cares/src/lib/event/ares_event_wake_pipe.c +7 -1
- data/third_party/cares/cares/src/lib/event/ares_event_win32.c +3 -0
- data/third_party/cares/cares/src/lib/include/ares_mem.h +3 -0
- data/third_party/cares/cares/src/lib/include/ares_str.h +17 -0
- data/third_party/cares/cares/src/lib/inet_net_pton.c +37 -28
- data/third_party/cares/cares/src/lib/legacy/ares_expand_name.c +1 -1
- data/third_party/cares/cares/src/lib/legacy/ares_parse_a_reply.c +5 -2
- data/third_party/cares/cares/src/lib/legacy/ares_parse_aaaa_reply.c +5 -2
- data/third_party/cares/cares/src/lib/legacy/ares_parse_ns_reply.c +2 -2
- data/third_party/cares/cares/src/lib/legacy/ares_parse_ptr_reply.c +2 -2
- data/third_party/cares/cares/src/lib/legacy/ares_parse_uri_reply.c +1 -1
- data/third_party/cares/cares/src/lib/record/ares_dns_mapping.c +19 -4
- data/third_party/cares/cares/src/lib/record/ares_dns_multistring.c +3 -1
- data/third_party/cares/cares/src/lib/record/ares_dns_name.c +67 -4
- data/third_party/cares/cares/src/lib/record/ares_dns_parse.c +62 -34
- data/third_party/cares/cares/src/lib/record/ares_dns_private.h +4 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_record.c +47 -7
- data/third_party/cares/cares/src/lib/record/ares_dns_write.c +13 -5
- data/third_party/cares/cares/src/lib/str/ares_buf.c +33 -16
- data/third_party/cares/cares/src/lib/str/ares_str.c +54 -0
- data/third_party/cares/cares/src/lib/util/ares_iface_ips.c +22 -10
- data/third_party/cares/cares/src/lib/util/ares_iface_ips.h +1 -0
- data/third_party/cares/cares/src/lib/util/ares_math.c +17 -2
- data/third_party/cares/cares/src/lib/util/ares_math.h +32 -7
- data/third_party/cares/cares/src/lib/util/ares_rand.c +4 -4
- data/third_party/cares/cares/src/lib/util/ares_threads.c +1 -2
- data/third_party/cares/cares/src/lib/util/ares_time.h +1 -0
- data/third_party/cares/cares/src/lib/util/ares_uri.c +9 -3
- data/third_party/zlib/compress.c +34 -10
- data/third_party/zlib/crc32.c +49 -115
- data/third_party/zlib/deflate.c +107 -61
- data/third_party/zlib/deflate.h +7 -1
- data/third_party/zlib/gzguts.h +33 -31
- data/third_party/zlib/infback.c +20 -67
- data/third_party/zlib/inffast.c +7 -6
- data/third_party/zlib/inffixed.h +91 -91
- data/third_party/zlib/inflate.c +38 -151
- data/third_party/zlib/inflate.h +1 -1
- data/third_party/zlib/inftrees.c +134 -9
- data/third_party/zlib/inftrees.h +3 -1
- data/third_party/zlib/trees.c +14 -12
- data/third_party/zlib/uncompr.c +39 -23
- data/third_party/zlib/zconf.h +27 -19
- data/third_party/zlib/zlib.h +215 -96
- data/third_party/zlib/zutil.c +49 -35
- data/third_party/zlib/zutil.h +87 -10
- metadata +23 -9
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +0 -916
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +0 -84
- data/src/core/server/xds_channel_stack_modifier.cc +0 -108
- data/src/core/server/xds_channel_stack_modifier.h +0 -62
- data/src/core/server/xds_server_config_fetcher_legacy.cc +0 -1340
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256_internal.h +0 -193
- data/third_party/boringssl-with-bazel/crypto/kyber/internal.h +0 -165
- data/third_party/boringssl-with-bazel/crypto/kyber/kyber.cc +0 -870
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
#include <limits.h>
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
static void timeadd(ares_timeval_t *now, size_t millisecs);
|
|
49
48
|
static ares_status_t process_write(ares_channel_t *channel,
|
|
50
49
|
ares_socket_t write_fd);
|
|
51
50
|
static ares_status_t process_read(ares_channel_t *channel,
|
|
@@ -64,7 +63,12 @@ static ares_bool_t same_questions(const ares_query_t *query,
|
|
|
64
63
|
const ares_dns_record_t *arec);
|
|
65
64
|
static void end_query(ares_channel_t *channel, ares_server_t *server,
|
|
66
65
|
ares_query_t *query, ares_status_t status,
|
|
67
|
-
|
|
66
|
+
ares_dns_record_t *dnsrec,
|
|
67
|
+
ares_array_t **requeue);
|
|
68
|
+
static ares_status_t ares_send_query_int(ares_server_t *requested_server,
|
|
69
|
+
ares_query_t *query,
|
|
70
|
+
const ares_timeval_t *now,
|
|
71
|
+
ares_array_t **requeue);
|
|
68
72
|
|
|
69
73
|
static void ares_query_remove_from_conn(ares_query_t *query)
|
|
70
74
|
{
|
|
@@ -76,14 +80,32 @@ static void ares_query_remove_from_conn(ares_query_t *query)
|
|
|
76
80
|
query->conn = NULL;
|
|
77
81
|
}
|
|
78
82
|
|
|
83
|
+
/*! A queued server-state notification. Holds the formatted address rather
|
|
84
|
+
* than the server, so it stays valid however the server list changes. */
|
|
85
|
+
typedef struct {
|
|
86
|
+
char *server_string;
|
|
87
|
+
ares_bool_t success;
|
|
88
|
+
int flags;
|
|
89
|
+
} ares_server_state_msg_t;
|
|
90
|
+
|
|
91
|
+
static void ares_server_state_msg_free(void *arg)
|
|
92
|
+
{
|
|
93
|
+
ares_server_state_msg_t *msg = arg;
|
|
94
|
+
if (msg == NULL) {
|
|
95
|
+
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
|
96
|
+
}
|
|
97
|
+
ares_free(msg->server_string);
|
|
98
|
+
}
|
|
99
|
+
|
|
79
100
|
/* Invoke the server state callback after a success or failure */
|
|
80
101
|
static void invoke_server_state_cb(const ares_server_t *server,
|
|
81
102
|
ares_bool_t success, int flags)
|
|
82
103
|
{
|
|
83
|
-
|
|
84
|
-
ares_buf_t
|
|
85
|
-
ares_status_t
|
|
86
|
-
char
|
|
104
|
+
ares_channel_t *channel = server->channel;
|
|
105
|
+
ares_buf_t *buf;
|
|
106
|
+
ares_status_t status;
|
|
107
|
+
char *server_string;
|
|
108
|
+
ares_server_state_msg_t msg;
|
|
87
109
|
|
|
88
110
|
if (channel->server_state_cb == NULL) {
|
|
89
111
|
return;
|
|
@@ -106,9 +128,57 @@ static void invoke_server_state_cb(const ares_server_t *server,
|
|
|
106
128
|
return; /* LCOV_EXCL_LINE: OutOfMemory */
|
|
107
129
|
}
|
|
108
130
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
131
|
+
/* Queue rather than dispatch. This runs in the middle of processing, and
|
|
132
|
+
* every caller keeps using its query / connection / server afterwards. The
|
|
133
|
+
* callback is application code that may reentrantly call ares_cancel(),
|
|
134
|
+
* which frees those objects -- so dispatch once the library is no longer
|
|
135
|
+
* holding them. Same philosophy as the deferred query-callback dispatch.
|
|
136
|
+
*
|
|
137
|
+
* Only the formatted address is captured, never the ares_server_t, so a
|
|
138
|
+
* queued entry cannot outlive anything it points at. */
|
|
139
|
+
if (channel->server_state_queue == NULL) {
|
|
140
|
+
channel->server_state_queue = ares_array_create(
|
|
141
|
+
sizeof(ares_server_state_msg_t), ares_server_state_msg_free);
|
|
142
|
+
if (channel->server_state_queue == NULL) {
|
|
143
|
+
/* LCOV_EXCL_START: OutOfMemory */
|
|
144
|
+
ares_free(server_string);
|
|
145
|
+
return;
|
|
146
|
+
/* LCOV_EXCL_STOP */
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
msg.server_string = server_string;
|
|
151
|
+
msg.success = success;
|
|
152
|
+
msg.flags = flags;
|
|
153
|
+
|
|
154
|
+
if (ares_array_insertdata_last(channel->server_state_queue, &msg) !=
|
|
155
|
+
ARES_SUCCESS) {
|
|
156
|
+
ares_free(server_string); /* LCOV_EXCL_LINE: OutOfMemory */
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/*! Deliver every server-state notification the channel has queued. Loops
|
|
161
|
+
* rather than snapshotting: a callback is allowed to re-enter the library and
|
|
162
|
+
* queue more, and those belong to this same delivery point. */
|
|
163
|
+
void ares_server_state_dispatch(ares_channel_t *channel)
|
|
164
|
+
{
|
|
165
|
+
while (ares_array_len(channel->server_state_queue) > 0) {
|
|
166
|
+
ares_server_state_msg_t msg;
|
|
167
|
+
|
|
168
|
+
if (ares_array_claim_at(&msg, sizeof(msg), channel->server_state_queue,
|
|
169
|
+
0) != ARES_SUCCESS) {
|
|
170
|
+
break; /* LCOV_EXCL_LINE: DefensiveCoding */
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (channel->server_state_cb != NULL) {
|
|
174
|
+
channel->server_state_cb(msg.server_string, msg.success, msg.flags,
|
|
175
|
+
channel->server_state_cb_data);
|
|
176
|
+
}
|
|
177
|
+
ares_free(msg.server_string);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
ares_array_destroy(channel->server_state_queue);
|
|
181
|
+
channel->server_state_queue = NULL;
|
|
112
182
|
}
|
|
113
183
|
|
|
114
184
|
static void server_increment_failures(ares_server_t *server,
|
|
@@ -119,17 +189,28 @@ static void server_increment_failures(ares_server_t *server,
|
|
|
119
189
|
ares_timeval_t next_retry_time;
|
|
120
190
|
|
|
121
191
|
node = ares_slist_node_find(channel->servers, server);
|
|
122
|
-
|
|
192
|
+
/* Matches by sort key, not identity, so a removed server can match the live
|
|
193
|
+
* one that replaced it at the same configuration index. */
|
|
194
|
+
if (node == NULL || ares_slist_node_val(node) != server) {
|
|
123
195
|
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
|
124
196
|
}
|
|
125
197
|
|
|
126
|
-
server
|
|
127
|
-
|
|
198
|
+
/* Cap the failure count. Only the relative order matters for server
|
|
199
|
+
* selection, and an uncapped count would require an unbounded number of
|
|
200
|
+
* failures on other servers before a server that failed during an
|
|
201
|
+
* extended outage could be selected again. */
|
|
202
|
+
if (server->consec_failures < SERVER_CONSEC_FAILURES_CAP) {
|
|
203
|
+
server->consec_failures++;
|
|
204
|
+
}
|
|
128
205
|
|
|
206
|
+
/* Must update the retry time before reinserting since the sort uses it to
|
|
207
|
+
* order servers with the same failure count */
|
|
129
208
|
ares_tvnow(&next_retry_time);
|
|
130
|
-
|
|
209
|
+
ares_timeval_add(&next_retry_time, channel->server_retry_delay);
|
|
131
210
|
server->next_retry_time = next_retry_time;
|
|
132
211
|
|
|
212
|
+
ares_slist_node_reinsert(node);
|
|
213
|
+
|
|
133
214
|
invoke_server_state_cb(server, ARES_FALSE,
|
|
134
215
|
used_tcp == ARES_TRUE ? ARES_SERV_STATE_TCP
|
|
135
216
|
: ARES_SERV_STATE_UDP);
|
|
@@ -141,18 +222,21 @@ static void server_set_good(ares_server_t *server, ares_bool_t used_tcp)
|
|
|
141
222
|
const ares_channel_t *channel = server->channel;
|
|
142
223
|
|
|
143
224
|
node = ares_slist_node_find(channel->servers, server);
|
|
144
|
-
|
|
225
|
+
/* Matches by sort key, not identity, so a removed server can match the live
|
|
226
|
+
* one that replaced it at the same configuration index. */
|
|
227
|
+
if (node == NULL || ares_slist_node_val(node) != server) {
|
|
145
228
|
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
|
146
229
|
}
|
|
147
230
|
|
|
148
231
|
if (server->consec_failures > 0) {
|
|
149
232
|
server->consec_failures = 0;
|
|
233
|
+
/* Must update the retry time before reinserting since the sort uses it
|
|
234
|
+
* to order servers with the same failure count */
|
|
235
|
+
server->next_retry_time.sec = 0;
|
|
236
|
+
server->next_retry_time.usec = 0;
|
|
150
237
|
ares_slist_node_reinsert(node);
|
|
151
238
|
}
|
|
152
239
|
|
|
153
|
-
server->next_retry_time.sec = 0;
|
|
154
|
-
server->next_retry_time.usec = 0;
|
|
155
|
-
|
|
156
240
|
invoke_server_state_cb(server, ARES_TRUE,
|
|
157
241
|
used_tcp == ARES_TRUE ? ARES_SERV_STATE_TCP
|
|
158
242
|
: ARES_SERV_STATE_UDP);
|
|
@@ -177,18 +261,6 @@ ares_bool_t ares_timedout(const ares_timeval_t *now,
|
|
|
177
261
|
: ARES_FALSE;
|
|
178
262
|
}
|
|
179
263
|
|
|
180
|
-
/* add the specific number of milliseconds to the time in the first argument */
|
|
181
|
-
static void timeadd(ares_timeval_t *now, size_t millisecs)
|
|
182
|
-
{
|
|
183
|
-
now->sec += (ares_int64_t)millisecs / 1000;
|
|
184
|
-
now->usec += (unsigned int)((millisecs % 1000) * 1000);
|
|
185
|
-
|
|
186
|
-
if (now->usec >= 1000000) {
|
|
187
|
-
now->sec += now->usec / 1000000;
|
|
188
|
-
now->usec %= 1000000;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
264
|
static ares_status_t ares_process_fds_nolock(ares_channel_t *channel,
|
|
193
265
|
const ares_fd_events_t *events,
|
|
194
266
|
size_t nevents, unsigned int flags)
|
|
@@ -201,6 +273,8 @@ static ares_status_t ares_process_fds_nolock(ares_channel_t *channel,
|
|
|
201
273
|
return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */
|
|
202
274
|
}
|
|
203
275
|
|
|
276
|
+
ares_deferred_cb_enter(channel);
|
|
277
|
+
|
|
204
278
|
ares_tvnow(&now);
|
|
205
279
|
|
|
206
280
|
/* Process write events */
|
|
@@ -230,14 +304,19 @@ static ares_status_t ares_process_fds_nolock(ares_channel_t *channel,
|
|
|
230
304
|
}
|
|
231
305
|
|
|
232
306
|
if (!(flags & ARES_PROCESS_FLAG_SKIP_NON_FD)) {
|
|
233
|
-
ares_check_cleanup_conns(channel);
|
|
234
307
|
status = process_timeouts(channel, &now);
|
|
235
308
|
if (status == ARES_ENOMEM) {
|
|
236
309
|
goto done;
|
|
237
310
|
}
|
|
311
|
+
|
|
312
|
+
/* Cleanup should be done after processing timeouts as it may invalidate
|
|
313
|
+
* connections */
|
|
314
|
+
ares_check_cleanup_conns(channel);
|
|
238
315
|
}
|
|
239
316
|
|
|
240
317
|
done:
|
|
318
|
+
ares_deferred_cb_leave(channel);
|
|
319
|
+
|
|
241
320
|
if (status == ARES_ENOMEM) {
|
|
242
321
|
return ARES_ENOMEM;
|
|
243
322
|
}
|
|
@@ -415,38 +494,69 @@ void ares_process_pending_write(ares_channel_t *channel)
|
|
|
415
494
|
return;
|
|
416
495
|
}
|
|
417
496
|
|
|
497
|
+
/* A failed flush closes the connection and fails its queries over, which
|
|
498
|
+
* notifies. Deliver once we are done walking the servers, and keep
|
|
499
|
+
* anything unlinked meanwhile readable until then. */
|
|
500
|
+
ares_deferred_cb_enter(channel);
|
|
501
|
+
|
|
418
502
|
/* Set as untriggerd before calling into ares_conn_flush(), this is
|
|
419
503
|
* because its possible ares_conn_flush() might cause additional data to
|
|
420
504
|
* be enqueued if there is some form of exception so it will need to recurse.
|
|
421
505
|
*/
|
|
422
506
|
channel->notify_pending_write = ARES_FALSE;
|
|
423
507
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
ares_server_t *server
|
|
427
|
-
ares_conn_t *conn
|
|
508
|
+
node = ares_slist_node_first(channel->servers);
|
|
509
|
+
while (node != NULL) {
|
|
510
|
+
ares_server_t *server = ares_slist_node_val(node);
|
|
511
|
+
ares_conn_t *conn = server->tcp_conn;
|
|
512
|
+
size_t generation = channel->servers_generation;
|
|
428
513
|
ares_status_t status;
|
|
429
514
|
|
|
430
515
|
if (conn == NULL) {
|
|
516
|
+
node = ares_slist_node_next(node);
|
|
431
517
|
continue;
|
|
432
518
|
}
|
|
433
519
|
|
|
434
|
-
/* Enqueue any pending data if there is any
|
|
520
|
+
/* Enqueue any pending data if there is any. The flush runs the
|
|
521
|
+
* application's send function, which may have reconfigured the servers
|
|
522
|
+
* and removed this one; its connection is then already closed, which
|
|
523
|
+
* handle_conn_error() ignores. */
|
|
435
524
|
status = ares_conn_flush(conn);
|
|
436
525
|
if (status != ARES_SUCCESS) {
|
|
437
526
|
handle_conn_error(conn, ARES_TRUE, status);
|
|
438
527
|
}
|
|
528
|
+
|
|
529
|
+
/* Tearing down a connection runs the callbacks of the queries it ends,
|
|
530
|
+
* and those may reconfigure the servers too, destroying the ones the new
|
|
531
|
+
* configuration omits along with their list nodes. A failure also moves
|
|
532
|
+
* this server further down the list. So when either may have happened,
|
|
533
|
+
* start over from the head rather than step from this node; flushing a
|
|
534
|
+
* connection again is harmless. */
|
|
535
|
+
if (status != ARES_SUCCESS || channel->servers_generation != generation) {
|
|
536
|
+
node = ares_slist_node_first(channel->servers);
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
node = ares_slist_node_next(node);
|
|
439
541
|
}
|
|
440
542
|
|
|
543
|
+
ares_deferred_cb_leave(channel);
|
|
441
544
|
ares_channel_unlock(channel);
|
|
442
545
|
}
|
|
443
546
|
|
|
444
|
-
static ares_status_t read_conn_packets(ares_conn_t *conn
|
|
547
|
+
static ares_status_t read_conn_packets(ares_conn_t *conn,
|
|
548
|
+
ares_bool_t *conn_error)
|
|
445
549
|
{
|
|
446
550
|
ares_bool_t read_again;
|
|
447
551
|
ares_conn_err_t err;
|
|
448
552
|
const ares_channel_t *channel = conn->server->channel;
|
|
449
553
|
|
|
554
|
+
if (conn_error == NULL) {
|
|
555
|
+
return ARES_EFORMERR;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
*conn_error = ARES_FALSE;
|
|
559
|
+
|
|
450
560
|
do {
|
|
451
561
|
size_t count;
|
|
452
562
|
size_t len = 65535;
|
|
@@ -494,6 +604,18 @@ static ares_status_t read_conn_packets(ares_conn_t *conn)
|
|
|
494
604
|
|
|
495
605
|
/* If UDP, overwrite length */
|
|
496
606
|
if (!(conn->flags & ARES_CONN_FLAG_TCP)) {
|
|
607
|
+
/* The read buffer is grown in powers of two, so a single recvfrom() can
|
|
608
|
+
* return more than the 2-byte length prefix is able to represent. A
|
|
609
|
+
* datagram that large can't be a valid DNS message, and writing the
|
|
610
|
+
* truncated (unsigned short)count would desync the framing of everything
|
|
611
|
+
* buffered after it, so discard it. Standard UDP can't actually deliver
|
|
612
|
+
* a payload this large (max is 65507 IPv4 / 65527 IPv6); the only vector
|
|
613
|
+
* is IPv6 jumbograms (RFC 2675), which DNS never uses. This is purely
|
|
614
|
+
* defense-in-depth. */
|
|
615
|
+
if (count > 65535) {
|
|
616
|
+
ares_buf_set_length(conn->in_buf, start_len);
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
497
619
|
len = ares_buf_len(conn->in_buf);
|
|
498
620
|
ares_buf_set_length(conn->in_buf, start_len);
|
|
499
621
|
ares_buf_append_be16(conn->in_buf, (unsigned short)count);
|
|
@@ -504,23 +626,43 @@ static ares_status_t read_conn_packets(ares_conn_t *conn)
|
|
|
504
626
|
} while (read_again);
|
|
505
627
|
|
|
506
628
|
if (err != ARES_CONN_ERR_SUCCESS && err != ARES_CONN_ERR_WOULDBLOCK) {
|
|
507
|
-
|
|
508
|
-
|
|
629
|
+
/* If there is no packet data buffered, preserve the historical
|
|
630
|
+
* immediate connection-failure behavior so retries happen promptly.
|
|
631
|
+
* Only defer if there is buffered data to parse first. */
|
|
632
|
+
if (ares_buf_len(conn->in_buf) == 0) {
|
|
633
|
+
handle_conn_error(conn, ARES_TRUE, ARES_ECONNREFUSED);
|
|
634
|
+
return ARES_ECONNREFUSED;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
*conn_error = ARES_TRUE;
|
|
509
638
|
}
|
|
510
639
|
|
|
511
640
|
return ARES_SUCCESS;
|
|
512
641
|
}
|
|
513
642
|
|
|
643
|
+
typedef enum {
|
|
644
|
+
REQUEUE_REQUEUE = 1,
|
|
645
|
+
REQUEUE_ENDQUERY = 2
|
|
646
|
+
} requeue_type_t;
|
|
647
|
+
|
|
514
648
|
/* Simple data structure to store a query that needs to be requeued with
|
|
515
649
|
* optional server */
|
|
516
650
|
typedef struct {
|
|
517
|
-
|
|
518
|
-
|
|
651
|
+
requeue_type_t type; /* type of entry, requeue or endquery */
|
|
652
|
+
unsigned short qid; /* query id */
|
|
653
|
+
size_t serial; /* identifies the query the qid meant when
|
|
654
|
+
* this entry was appended */
|
|
655
|
+
ares_server_t *server; /* requeue only: optional */
|
|
656
|
+
ares_status_t status; /* endquery only */
|
|
657
|
+
ares_dns_record_t *dnsrec; /* endquery only: optional */
|
|
519
658
|
} ares_requeue_t;
|
|
520
659
|
|
|
521
|
-
static ares_status_t
|
|
522
|
-
|
|
523
|
-
|
|
660
|
+
static ares_status_t ares_append_requeue_int(ares_array_t **requeue,
|
|
661
|
+
requeue_type_t type,
|
|
662
|
+
ares_query_t *query,
|
|
663
|
+
ares_server_t *server,
|
|
664
|
+
ares_status_t status,
|
|
665
|
+
ares_dns_record_t *dnsrec)
|
|
524
666
|
{
|
|
525
667
|
ares_requeue_t entry;
|
|
526
668
|
|
|
@@ -533,16 +675,181 @@ static ares_status_t ares_append_requeue(ares_array_t **requeue,
|
|
|
533
675
|
|
|
534
676
|
ares_query_remove_from_conn(query);
|
|
535
677
|
|
|
678
|
+
entry.type = type;
|
|
536
679
|
entry.qid = query->qid;
|
|
680
|
+
entry.serial = query->serial;
|
|
537
681
|
entry.server = server;
|
|
682
|
+
entry.status = status;
|
|
683
|
+
entry.dnsrec = dnsrec;
|
|
538
684
|
return ares_array_insertdata_last(*requeue, &entry);
|
|
539
685
|
}
|
|
540
686
|
|
|
687
|
+
static ares_status_t ares_append_requeue(ares_array_t **requeue,
|
|
688
|
+
ares_query_t *query,
|
|
689
|
+
ares_server_t *server)
|
|
690
|
+
{
|
|
691
|
+
return ares_append_requeue_int(requeue, REQUEUE_REQUEUE, query, server, 0,
|
|
692
|
+
NULL);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
static ares_status_t ares_append_endqueue(ares_array_t **requeue,
|
|
696
|
+
ares_query_t *query,
|
|
697
|
+
ares_status_t status,
|
|
698
|
+
ares_dns_record_t *dnsrec)
|
|
699
|
+
{
|
|
700
|
+
return ares_append_requeue_int(requeue, REQUEUE_ENDQUERY, query, NULL, status,
|
|
701
|
+
dnsrec);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/*! Is the query the caller captured still the one holding \a qid?
|
|
705
|
+
*
|
|
706
|
+
* A query id is a 16-bit wire value reissued as soon as the query holding it
|
|
707
|
+
* is detached, so it names a slot rather than a query, and comparing the
|
|
708
|
+
* pointer as well does not help: the replacement is often allocated at the
|
|
709
|
+
* address the freed one had. The serial is a channel-wide counter that is
|
|
710
|
+
* never reused. */
|
|
711
|
+
static ares_bool_t ares_query_is_live(const ares_channel_t *channel,
|
|
712
|
+
unsigned short qid, size_t serial)
|
|
713
|
+
{
|
|
714
|
+
const ares_query_t *query =
|
|
715
|
+
ares_htable_szvp_get_direct(channel->queries_by_qid, qid);
|
|
716
|
+
|
|
717
|
+
if (query == NULL || query->serial != serial) {
|
|
718
|
+
return ARES_FALSE;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
return ARES_TRUE;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/*! Is this exact server object still in the channel's server list?
|
|
725
|
+
*
|
|
726
|
+
* Compares pointers only and never dereferences \a server. Deferred
|
|
727
|
+
* reclamation keeps an unlinked server readable for the rest of the call
|
|
728
|
+
* that captured it, so reading through it is no longer a use-after-free --
|
|
729
|
+
* but it has been removed from the configuration and must not be acted on,
|
|
730
|
+
* which is what this reports. A channel has a handful of servers, so the
|
|
731
|
+
* linear scan does not matter. */
|
|
732
|
+
ares_bool_t ares_server_in_channel(const ares_channel_t *channel,
|
|
733
|
+
const ares_server_t *server)
|
|
734
|
+
{
|
|
735
|
+
ares_slist_node_t *node;
|
|
736
|
+
|
|
737
|
+
if (server == NULL) {
|
|
738
|
+
return ARES_FALSE;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
for (node = ares_slist_node_first(channel->servers); node != NULL;
|
|
742
|
+
node = ares_slist_node_next(node)) {
|
|
743
|
+
if (ares_slist_node_val(node) == server) {
|
|
744
|
+
return ARES_TRUE;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
return ARES_FALSE;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/* Drain the deferred requeue/endqueue list iteratively. All flush sites
|
|
752
|
+
* (read_answers(), process_timeouts(), and ares_send_query()) funnel through
|
|
753
|
+
* here so that:
|
|
754
|
+
* 1. Retries are re-dispatched by appending to this same list and looping,
|
|
755
|
+
* rather than recursing ares_requeue_query() -> ares_send_query() until
|
|
756
|
+
* the stack is exhausted (issue #1043).
|
|
757
|
+
* 2. A query is fully detached from all lookup lists before its callback is
|
|
758
|
+
* invoked, so a reentrant ares_cancel() from within that callback cannot
|
|
759
|
+
* find and free the same query, which would otherwise double-free it
|
|
760
|
+
* (CVE-2026-33630 / GHSA-6wfj-rwm7-3542).
|
|
761
|
+
*
|
|
762
|
+
* On return the list has been fully processed, an empty-queue notification has
|
|
763
|
+
* been sent if appropriate, and *requeue has been destroyed and set to NULL. */
|
|
764
|
+
static ares_status_t ares_flush_requeue(ares_channel_t *channel,
|
|
765
|
+
const ares_timeval_t *now,
|
|
766
|
+
ares_array_t **requeue)
|
|
767
|
+
{
|
|
768
|
+
ares_status_t status = ARES_SUCCESS;
|
|
769
|
+
|
|
770
|
+
if (requeue == NULL) {
|
|
771
|
+
return status;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
while (*requeue != NULL && ares_array_len(*requeue) > 0) {
|
|
775
|
+
ares_query_t *query;
|
|
776
|
+
ares_requeue_t entry;
|
|
777
|
+
ares_status_t internal_status;
|
|
778
|
+
|
|
779
|
+
internal_status = ares_array_claim_at(&entry, sizeof(entry), *requeue, 0);
|
|
780
|
+
if (internal_status != ARES_SUCCESS) {
|
|
781
|
+
break; /* LCOV_EXCL_LINE: DefensiveCoding */
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
query = ares_htable_szvp_get_direct(channel->queries_by_qid, entry.qid);
|
|
785
|
+
|
|
786
|
+
/* A query id is a 16-bit wire value and generate_unique_qid() only avoids
|
|
787
|
+
* ids that are live when it runs. Within a single drain, a callback can
|
|
788
|
+
* cancel a query whose entry is still in this array -- releasing its id --
|
|
789
|
+
* and start a new lookup that is handed the same id. The lookup above
|
|
790
|
+
* would then resolve this entry to a completely different query: an
|
|
791
|
+
* endquery entry would deliver one lookup's answer to another and free it,
|
|
792
|
+
* a requeue entry would put an in-flight query on the wire twice. The
|
|
793
|
+
* serial is a channel-wide counter that is never reused, so it tells the
|
|
794
|
+
* two apart. */
|
|
795
|
+
if (query != NULL && query->serial != entry.serial) {
|
|
796
|
+
query = NULL;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
if (entry.type == REQUEUE_REQUEUE) {
|
|
800
|
+
/* Query disappeared (e.g. a prior callback in this drain cancelled it) */
|
|
801
|
+
if (query == NULL) {
|
|
802
|
+
continue;
|
|
803
|
+
}
|
|
804
|
+
/* entry.server is a raw pointer captured before any callback in this
|
|
805
|
+
* drain ran. A callback may legally re-enter the public API -- the
|
|
806
|
+
* channel lock is recursive -- and ares_set_servers*() destroys servers
|
|
807
|
+
* that are absent from the new configuration, so it may already be
|
|
808
|
+
* freed. The query above is revalidated by qid for exactly this
|
|
809
|
+
* reason; do the same for the server, falling back to ordinary
|
|
810
|
+
* selection when it has gone. */
|
|
811
|
+
if (!ares_server_in_channel(channel, entry.server)) {
|
|
812
|
+
entry.server = NULL;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/* Re-dispatch via the internal entrypoint so any further requeues are
|
|
816
|
+
* appended back onto this same list and drained by the loop above,
|
|
817
|
+
* rather than recursing. */
|
|
818
|
+
internal_status = ares_send_query_int(entry.server, query, now, requeue);
|
|
819
|
+
/* We only care about ARES_ENOMEM */
|
|
820
|
+
if (internal_status == ARES_ENOMEM) {
|
|
821
|
+
status = ARES_ENOMEM;
|
|
822
|
+
}
|
|
823
|
+
} else { /* REQUEUE_ENDQUERY */
|
|
824
|
+
if (query != NULL) {
|
|
825
|
+
/* Detach the query from all lookup lists BEFORE invoking the callback.
|
|
826
|
+
* Otherwise a reentrant ares_cancel() from within the callback would
|
|
827
|
+
* find this query still linked in all_queries/queries_by_qid, free it,
|
|
828
|
+
* and the ares_free_query() below would then double-free it. */
|
|
829
|
+
ares_detach_query(query);
|
|
830
|
+
query->callback(query->arg, entry.status, query->timeouts,
|
|
831
|
+
entry.dnsrec);
|
|
832
|
+
ares_free_query(query);
|
|
833
|
+
}
|
|
834
|
+
ares_dns_record_destroy(entry.dnsrec);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/* Don't forget to send notification if queue emptied */
|
|
839
|
+
if (*requeue != NULL) {
|
|
840
|
+
ares_queue_notify_empty(channel);
|
|
841
|
+
}
|
|
842
|
+
ares_array_destroy(*requeue);
|
|
843
|
+
*requeue = NULL;
|
|
844
|
+
|
|
845
|
+
return status;
|
|
846
|
+
}
|
|
847
|
+
|
|
541
848
|
static ares_status_t read_answers(ares_conn_t *conn, const ares_timeval_t *now)
|
|
542
849
|
{
|
|
543
850
|
ares_status_t status;
|
|
544
|
-
ares_channel_t *channel
|
|
545
|
-
ares_array_t *requeue
|
|
851
|
+
ares_channel_t *channel = conn->server->channel;
|
|
852
|
+
ares_array_t *requeue = NULL;
|
|
546
853
|
|
|
547
854
|
/* Process all queued answers */
|
|
548
855
|
while (1) {
|
|
@@ -590,31 +897,11 @@ static ares_status_t read_answers(ares_conn_t *conn, const ares_timeval_t *now)
|
|
|
590
897
|
}
|
|
591
898
|
|
|
592
899
|
cleanup:
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
ares_requeue_t entry;
|
|
598
|
-
ares_status_t internal_status;
|
|
599
|
-
|
|
600
|
-
internal_status = ares_array_claim_at(&entry, sizeof(entry), requeue, 0);
|
|
601
|
-
if (internal_status != ARES_SUCCESS) {
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/* Query disappeared */
|
|
606
|
-
query = ares_htable_szvp_get_direct(channel->queries_by_qid, entry.qid);
|
|
607
|
-
if (query == NULL) {
|
|
608
|
-
continue;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
internal_status = ares_send_query(entry.server, query, now);
|
|
612
|
-
/* We only care about ARES_ENOMEM */
|
|
613
|
-
if (internal_status == ARES_ENOMEM) {
|
|
614
|
-
status = ARES_ENOMEM;
|
|
615
|
-
}
|
|
900
|
+
/* Flush requeue - re-dispatch retries and invoke deferred callbacks
|
|
901
|
+
* iteratively and safely */
|
|
902
|
+
if (ares_flush_requeue(channel, now, &requeue) == ARES_ENOMEM) {
|
|
903
|
+
status = ARES_ENOMEM;
|
|
616
904
|
}
|
|
617
|
-
ares_array_destroy(requeue);
|
|
618
905
|
|
|
619
906
|
return status;
|
|
620
907
|
}
|
|
@@ -624,24 +911,39 @@ static ares_status_t process_read(ares_channel_t *channel,
|
|
|
624
911
|
const ares_timeval_t *now)
|
|
625
912
|
{
|
|
626
913
|
ares_conn_t *conn = ares_conn_from_fd(channel, read_fd);
|
|
914
|
+
ares_bool_t conn_error;
|
|
627
915
|
ares_status_t status;
|
|
628
916
|
|
|
629
917
|
if (conn == NULL) {
|
|
630
918
|
return ARES_SUCCESS;
|
|
631
919
|
}
|
|
632
920
|
|
|
633
|
-
|
|
634
|
-
* read some data, then looped and read again and got a disconnect.
|
|
635
|
-
* Right now, that would cause a resend instead of processing the data
|
|
636
|
-
* we have. This is fairly unlikely to occur due to only looping if
|
|
637
|
-
* a full buffer of 65535 bytes was read. */
|
|
638
|
-
status = read_conn_packets(conn);
|
|
921
|
+
status = read_conn_packets(conn, &conn_error);
|
|
639
922
|
|
|
640
923
|
if (status != ARES_SUCCESS) {
|
|
641
924
|
return status;
|
|
642
925
|
}
|
|
643
926
|
|
|
644
|
-
|
|
927
|
+
/* A later call to the receive function may have reconfigured the servers,
|
|
928
|
+
* tearing this connection down after earlier calls buffered answers on it.
|
|
929
|
+
* Its queries have moved to the new configuration, so drop the answers. */
|
|
930
|
+
if (conn->flags & ARES_CONN_FLAG_DEAD) {
|
|
931
|
+
return ARES_SUCCESS;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
status = read_answers(conn, now);
|
|
935
|
+
if (status != ARES_SUCCESS) {
|
|
936
|
+
return status;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
if (conn_error) {
|
|
940
|
+
conn = ares_conn_from_fd(channel, read_fd);
|
|
941
|
+
if (conn != NULL) {
|
|
942
|
+
handle_conn_error(conn, ARES_TRUE, ARES_ECONNREFUSED);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
return ARES_SUCCESS;
|
|
645
947
|
}
|
|
646
948
|
|
|
647
949
|
/* If any queries have timed out, note the timeout and move them on. */
|
|
@@ -649,7 +951,8 @@ static ares_status_t process_timeouts(ares_channel_t *channel,
|
|
|
649
951
|
const ares_timeval_t *now)
|
|
650
952
|
{
|
|
651
953
|
ares_slist_node_t *node;
|
|
652
|
-
ares_status_t status
|
|
954
|
+
ares_status_t status = ARES_SUCCESS;
|
|
955
|
+
ares_array_t *requeue = NULL;
|
|
653
956
|
|
|
654
957
|
/* Just keep popping off the first as this list will re-sort as things come
|
|
655
958
|
* and go. We don't want to try to rely on 'next' as some operation might
|
|
@@ -667,14 +970,26 @@ static ares_status_t process_timeouts(ares_channel_t *channel,
|
|
|
667
970
|
query->timeouts++;
|
|
668
971
|
|
|
669
972
|
conn = query->conn;
|
|
973
|
+
/* Retire this connection for NEW queries. A timeout suggests packets are
|
|
974
|
+
* being dropped on it, so route new queries to a fresh source port while
|
|
975
|
+
* the in-flight queries here drain (it is cleaned up once idle). This is
|
|
976
|
+
* per-connection so a transient failure doesn't stop reuse of healthy
|
|
977
|
+
* connections to the same server. */
|
|
978
|
+
conn->flags |= ARES_CONN_FLAG_NONEW;
|
|
670
979
|
server_increment_failures(conn->server, query->using_tcp);
|
|
671
|
-
status =
|
|
672
|
-
|
|
980
|
+
status =
|
|
981
|
+
ares_requeue_query(query, now, ARES_ETIMEOUT, ARES_TRUE, NULL, &requeue);
|
|
673
982
|
if (status == ARES_ENOMEM) {
|
|
674
983
|
goto done;
|
|
675
984
|
}
|
|
676
985
|
}
|
|
677
986
|
done:
|
|
987
|
+
/* Flush requeue - re-dispatch retries and invoke deferred callbacks
|
|
988
|
+
* iteratively and safely */
|
|
989
|
+
if (ares_flush_requeue(channel, now, &requeue) == ARES_ENOMEM) {
|
|
990
|
+
status = ARES_ENOMEM;
|
|
991
|
+
}
|
|
992
|
+
|
|
678
993
|
if (status == ARES_ENOMEM) {
|
|
679
994
|
return ARES_ENOMEM;
|
|
680
995
|
}
|
|
@@ -802,6 +1117,24 @@ static ares_status_t process_answer(ares_channel_t *channel,
|
|
|
802
1117
|
goto cleanup;
|
|
803
1118
|
}
|
|
804
1119
|
|
|
1120
|
+
/* RFC 5452 section 9.1: only accept a response that arrives on the
|
|
1121
|
+
* connection the query was sent on, and so from the server it was sent to.
|
|
1122
|
+
* For UDP, ares_conn_read() also drops a datagram whose source address or
|
|
1123
|
+
* port is not the server's; matching the port is hardening beyond RFC 5452
|
|
1124
|
+
* section 9.1, which only requires the address to match. Otherwise any
|
|
1125
|
+
* server we hold a connection to could answer, and get cached, a query that
|
|
1126
|
+
* was only ever sent to some other server, and the cookie check below would
|
|
1127
|
+
* run against the wrong server's cookie state. Treat it like an unknown
|
|
1128
|
+
* query id, before anything acts on it (cookies, server health, the cache).
|
|
1129
|
+
* Our caller has already consumed the message from the connection's buffer,
|
|
1130
|
+
* so TCP framing stays in sync. A query not attached to any connection
|
|
1131
|
+
* (query->conn == NULL) never matches. This also drops a late answer from
|
|
1132
|
+
* a server tried before a retry. */
|
|
1133
|
+
if (query->conn != conn) {
|
|
1134
|
+
status = ARES_SUCCESS;
|
|
1135
|
+
goto cleanup;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
805
1138
|
/* Validate DNS cookie in response. This function may need to requeue the
|
|
806
1139
|
* query. */
|
|
807
1140
|
if (ares_cookie_validate(query, rdnsrec, conn, now, requeue)
|
|
@@ -824,7 +1157,7 @@ static ares_status_t process_answer(ares_channel_t *channel,
|
|
|
824
1157
|
if (issue_might_be_edns(query->query, rdnsrec)) {
|
|
825
1158
|
status = rewrite_without_edns(query);
|
|
826
1159
|
if (status != ARES_SUCCESS) {
|
|
827
|
-
end_query(channel, server, query, status, NULL);
|
|
1160
|
+
end_query(channel, server, query, status, NULL, requeue);
|
|
828
1161
|
goto cleanup;
|
|
829
1162
|
}
|
|
830
1163
|
|
|
@@ -869,7 +1202,9 @@ static ares_status_t process_answer(ares_channel_t *channel,
|
|
|
869
1202
|
}
|
|
870
1203
|
|
|
871
1204
|
server_increment_failures(server, query->using_tcp);
|
|
872
|
-
status = ares_requeue_query(query, now, status, ARES_TRUE, rdnsrec,
|
|
1205
|
+
status = ares_requeue_query(query, now, status, ARES_TRUE, rdnsrec,
|
|
1206
|
+
requeue);
|
|
1207
|
+
rdnsrec = NULL; /* Free'd by ares_requeue_query() */
|
|
873
1208
|
|
|
874
1209
|
if (status != ARES_ENOMEM) {
|
|
875
1210
|
/* Should any of these cause a connection termination?
|
|
@@ -882,12 +1217,11 @@ static ares_status_t process_answer(ares_channel_t *channel,
|
|
|
882
1217
|
|
|
883
1218
|
/* If cache insertion was successful, it took ownership. We ignore
|
|
884
1219
|
* other cache insertion failures. */
|
|
885
|
-
|
|
886
|
-
is_cached = ARES_TRUE;
|
|
887
|
-
}
|
|
1220
|
+
ares_qcache_insert(channel, now, query, rdnsrec);
|
|
888
1221
|
|
|
889
1222
|
server_set_good(server, query->using_tcp);
|
|
890
|
-
end_query(channel, server, query, ARES_SUCCESS, rdnsrec);
|
|
1223
|
+
end_query(channel, server, query, ARES_SUCCESS, rdnsrec, requeue);
|
|
1224
|
+
rdnsrec = NULL; /* Free'd by the requeue */
|
|
891
1225
|
|
|
892
1226
|
status = ARES_SUCCESS;
|
|
893
1227
|
|
|
@@ -905,6 +1239,15 @@ static void handle_conn_error(ares_conn_t *conn, ares_bool_t critical_failure,
|
|
|
905
1239
|
{
|
|
906
1240
|
ares_server_t *server = conn->server;
|
|
907
1241
|
|
|
1242
|
+
/* Already torn down, most likely by a reconfiguration from application code
|
|
1243
|
+
* the failing call ran, such as the send function. Its queries have been
|
|
1244
|
+
* requeued, and its server did not fail -- it was removed, or the
|
|
1245
|
+
* connection was closed deliberately -- so there is nothing to record and
|
|
1246
|
+
* nothing left to close. */
|
|
1247
|
+
if (conn->flags & ARES_CONN_FLAG_DEAD) {
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
908
1251
|
/* Increment failures first before requeue so it is unlikely to requeue
|
|
909
1252
|
* to the same server */
|
|
910
1253
|
if (critical_failure) {
|
|
@@ -922,11 +1265,16 @@ static void handle_conn_error(ares_conn_t *conn, ares_bool_t critical_failure,
|
|
|
922
1265
|
ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t *now,
|
|
923
1266
|
ares_status_t status,
|
|
924
1267
|
ares_bool_t inc_try_count,
|
|
925
|
-
|
|
1268
|
+
ares_dns_record_t *dnsrec,
|
|
926
1269
|
ares_array_t **requeue)
|
|
927
1270
|
{
|
|
928
1271
|
ares_channel_t *channel = query->channel;
|
|
929
1272
|
size_t max_tries = ares_slist_len(channel->servers) * channel->tries;
|
|
1273
|
+
ares_server_t *server = NULL;
|
|
1274
|
+
|
|
1275
|
+
if (query->conn != NULL) {
|
|
1276
|
+
server = query->conn->server;
|
|
1277
|
+
}
|
|
930
1278
|
|
|
931
1279
|
ares_query_remove_from_conn(query);
|
|
932
1280
|
|
|
@@ -939,6 +1287,7 @@ ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t *now,
|
|
|
939
1287
|
}
|
|
940
1288
|
|
|
941
1289
|
if (query->try_count < max_tries && !query->no_retries) {
|
|
1290
|
+
ares_dns_record_destroy(dnsrec);
|
|
942
1291
|
if (requeue != NULL) {
|
|
943
1292
|
return ares_append_requeue(requeue, query, NULL);
|
|
944
1293
|
}
|
|
@@ -950,7 +1299,7 @@ ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t *now,
|
|
|
950
1299
|
query->error_status = ARES_ETIMEOUT;
|
|
951
1300
|
}
|
|
952
1301
|
|
|
953
|
-
end_query(channel,
|
|
1302
|
+
end_query(channel, server, query, query->error_status, dnsrec, requeue);
|
|
954
1303
|
return ARES_ETIMEOUT;
|
|
955
1304
|
}
|
|
956
1305
|
|
|
@@ -1053,22 +1402,23 @@ static void ares_probe_failed_server(ares_channel_t *channel,
|
|
|
1053
1402
|
}
|
|
1054
1403
|
|
|
1055
1404
|
/* Select the first server with failures to retry that has passed the retry
|
|
1056
|
-
* timeout and doesn't already have a pending probe
|
|
1405
|
+
* timeout and doesn't already have a pending probe. Skip the server the
|
|
1406
|
+
* triggering query was just sent to since that query is already exercising
|
|
1407
|
+
* it. */
|
|
1057
1408
|
ares_tvnow(&now);
|
|
1058
1409
|
for (node = ares_slist_node_first(channel->servers); node != NULL;
|
|
1059
1410
|
node = ares_slist_node_next(node)) {
|
|
1060
1411
|
ares_server_t *node_val = ares_slist_node_val(node);
|
|
1061
|
-
if (node_val != NULL && node_val
|
|
1062
|
-
!node_val->probe_pending &&
|
|
1412
|
+
if (node_val != NULL && node_val != server &&
|
|
1413
|
+
node_val->consec_failures > 0 && !node_val->probe_pending &&
|
|
1063
1414
|
ares_timedout(&now, &node_val->next_retry_time)) {
|
|
1064
1415
|
probe_server = node_val;
|
|
1065
1416
|
break;
|
|
1066
1417
|
}
|
|
1067
1418
|
}
|
|
1068
1419
|
|
|
1069
|
-
/*
|
|
1070
|
-
|
|
1071
|
-
if (probe_server == NULL || server == probe_server) {
|
|
1420
|
+
/* Nothing to probe */
|
|
1421
|
+
if (probe_server == NULL) {
|
|
1072
1422
|
return;
|
|
1073
1423
|
}
|
|
1074
1424
|
|
|
@@ -1099,7 +1449,12 @@ static size_t ares_calc_query_timeout(const ares_query_t *query,
|
|
|
1099
1449
|
* retry from the last retry */
|
|
1100
1450
|
rounds = (query->try_count / num_servers);
|
|
1101
1451
|
if (rounds > 0) {
|
|
1102
|
-
timeplus
|
|
1452
|
+
if (rounds >= sizeof(timeplus) * CHAR_BIT ||
|
|
1453
|
+
timeplus > (SIZE_MAX >> rounds)) {
|
|
1454
|
+
timeplus = SIZE_MAX;
|
|
1455
|
+
} else {
|
|
1456
|
+
timeplus <<= rounds;
|
|
1457
|
+
}
|
|
1103
1458
|
}
|
|
1104
1459
|
|
|
1105
1460
|
if (channel->maxtimeout && timeplus > channel->maxtimeout) {
|
|
@@ -1156,6 +1511,16 @@ static ares_conn_t *ares_fetch_connection(const ares_channel_t *channel,
|
|
|
1156
1511
|
return NULL;
|
|
1157
1512
|
}
|
|
1158
1513
|
|
|
1514
|
+
/* Don't hand new queries to a connection that has been retired (e.g. it saw
|
|
1515
|
+
* a timeout). It keeps servicing its in-flight queries and is cleaned up
|
|
1516
|
+
* once idle. Note this is a per-connection check: a server-wide failure
|
|
1517
|
+
* counter must not be used here or a single transient failure would evict
|
|
1518
|
+
* every (including healthy) connection to the server and spawn a new socket
|
|
1519
|
+
* per query. */
|
|
1520
|
+
if (conn->flags & ARES_CONN_FLAG_NONEW) {
|
|
1521
|
+
return NULL;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1159
1524
|
/* Used too many times */
|
|
1160
1525
|
if (channel->udp_max_queries > 0 &&
|
|
1161
1526
|
conn->total_queries >= channel->udp_max_queries) {
|
|
@@ -1199,6 +1564,14 @@ static ares_status_t ares_conn_query_write(ares_conn_t *conn,
|
|
|
1199
1564
|
conn->flags & ARES_CONN_FLAG_TCP) {
|
|
1200
1565
|
channel->notify_pending_write = ARES_TRUE;
|
|
1201
1566
|
channel->notify_pending_write_cb(channel->notify_pending_write_cb_data);
|
|
1567
|
+
|
|
1568
|
+
/* The callback is application code and may have reconfigured the
|
|
1569
|
+
* servers, closing this connection with the query already buffered on
|
|
1570
|
+
* it. Report it as a connection failure so the query is requeued rather
|
|
1571
|
+
* than attached to the closed connection. */
|
|
1572
|
+
if (conn->flags & ARES_CONN_FLAG_DEAD) {
|
|
1573
|
+
return ARES_ECONNREFUSED;
|
|
1574
|
+
}
|
|
1202
1575
|
return ARES_SUCCESS;
|
|
1203
1576
|
}
|
|
1204
1577
|
|
|
@@ -1207,8 +1580,44 @@ static ares_status_t ares_conn_query_write(ares_conn_t *conn,
|
|
|
1207
1580
|
return ares_conn_flush(conn);
|
|
1208
1581
|
}
|
|
1209
1582
|
|
|
1583
|
+
/* Public entrypoint. Establishes a requeue list and drives
|
|
1584
|
+
* ares_send_query_int() plus any retries/deferred callbacks it produces
|
|
1585
|
+
* iteratively, so a chain of retryable failures can never recurse until the
|
|
1586
|
+
* stack is exhausted (#1043). */
|
|
1210
1587
|
ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
1211
1588
|
ares_query_t *query, const ares_timeval_t *now)
|
|
1589
|
+
{
|
|
1590
|
+
ares_channel_t *channel = query->channel;
|
|
1591
|
+
ares_array_t *requeue = NULL;
|
|
1592
|
+
unsigned short qid = query->qid;
|
|
1593
|
+
size_t serial = query->serial;
|
|
1594
|
+
ares_status_t status;
|
|
1595
|
+
|
|
1596
|
+
status = ares_send_query_int(requested_server, query, now, &requeue);
|
|
1597
|
+
|
|
1598
|
+
/* Drain any retries/deferred callbacks this send produced.
|
|
1599
|
+
* ares_flush_requeue() always fully processes and destroys the list (even on
|
|
1600
|
+
* ENOMEM), and sends the empty-queue notification if needed. */
|
|
1601
|
+
if (ares_flush_requeue(channel, now, &requeue) == ARES_ENOMEM) {
|
|
1602
|
+
status = ARES_ENOMEM;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
/* A retry may have been deferred (returning ARES_SUCCESS from the append)
|
|
1606
|
+
* and then terminally failed while draining, in which case the query has
|
|
1607
|
+
* been freed. Do not dereference 'query' here. If it is no longer tracked
|
|
1608
|
+
* it ended, so don't report success to the caller (which would, e.g., cause
|
|
1609
|
+
* ares_send_nolock() to write to a now-freed *qid). */
|
|
1610
|
+
if (status == ARES_SUCCESS && !ares_query_is_live(channel, qid, serial)) {
|
|
1611
|
+
status = ARES_ETIMEOUT;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
return status;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
static ares_status_t ares_send_query_int(ares_server_t *requested_server,
|
|
1618
|
+
ares_query_t *query,
|
|
1619
|
+
const ares_timeval_t *now,
|
|
1620
|
+
ares_array_t **requeue)
|
|
1212
1621
|
{
|
|
1213
1622
|
ares_channel_t *channel = query->channel;
|
|
1214
1623
|
ares_server_t *server;
|
|
@@ -1216,7 +1625,9 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1216
1625
|
size_t timeplus;
|
|
1217
1626
|
ares_status_t status;
|
|
1218
1627
|
ares_bool_t probe_downed_server = ARES_TRUE;
|
|
1219
|
-
|
|
1628
|
+
/* Captured before any application callback below, which may free the query */
|
|
1629
|
+
unsigned short qid = query->qid;
|
|
1630
|
+
size_t serial = query->serial;
|
|
1220
1631
|
|
|
1221
1632
|
/* Choose the server to send the query to */
|
|
1222
1633
|
if (requested_server != NULL) {
|
|
@@ -1232,20 +1643,48 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1232
1643
|
}
|
|
1233
1644
|
|
|
1234
1645
|
if (server == NULL) {
|
|
1235
|
-
end_query(channel, server, query, ARES_ENOSERVER /* ? */, NULL);
|
|
1646
|
+
end_query(channel, server, query, ARES_ENOSERVER /* ? */, NULL, requeue);
|
|
1236
1647
|
return ARES_ENOSERVER;
|
|
1237
1648
|
}
|
|
1238
1649
|
|
|
1239
|
-
/* If a query is directed to a specific
|
|
1240
|
-
*
|
|
1241
|
-
|
|
1242
|
-
|
|
1650
|
+
/* If a query is directed to a specific server, or the query is being
|
|
1651
|
+
* retried, don't probe for downed servers. Note that the chosen server
|
|
1652
|
+
* having failures itself does NOT disable probing: when every server has
|
|
1653
|
+
* failures (e.g. during an extended outage), probes are the only way a
|
|
1654
|
+
* recovered server that sorts behind the current best can be noticed. */
|
|
1655
|
+
if (requested_server != NULL || query->try_count != 0) {
|
|
1243
1656
|
probe_downed_server = ARES_FALSE;
|
|
1244
1657
|
}
|
|
1245
1658
|
|
|
1246
1659
|
conn = ares_fetch_connection(channel, server, query);
|
|
1247
1660
|
if (conn == NULL) {
|
|
1248
1661
|
status = ares_open_connection(&conn, channel, server, query->using_tcp);
|
|
1662
|
+
|
|
1663
|
+
/* Opening a connection runs application code -- the socket-open function
|
|
1664
|
+
* from ares_set_socket_functions_ex(), and the ares_set_socket_callback()
|
|
1665
|
+
* and ares_set_socket_configure_callback() callbacks -- any of which may
|
|
1666
|
+
* reentrantly call ares_cancel() and free this query. Re-check liveness
|
|
1667
|
+
* by the qid captured at entry rather than dereferencing a possibly-freed
|
|
1668
|
+
* query. */
|
|
1669
|
+
if (!ares_query_is_live(channel, qid, serial)) {
|
|
1670
|
+
return ARES_ECANCELLED;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
/* Those same callbacks may have reconfigured the servers, which frees the
|
|
1674
|
+
* ones the new configuration omits. 'server' was captured before the
|
|
1675
|
+
* open; everything below reads it, including server_increment_failures()
|
|
1676
|
+
* on the failure paths of the switch.
|
|
1677
|
+
*
|
|
1678
|
+
* Requeue rather than return: every exit from this function must either
|
|
1679
|
+
* enqueue the query or end it, and the query is still live here -- it has
|
|
1680
|
+
* not been written, is not attached to a connection, and on a first send
|
|
1681
|
+
* has no timeout node, so returning would strand it forever.
|
|
1682
|
+
* query->conn is NULL, so this does not read through the freed server. */
|
|
1683
|
+
if (!ares_server_in_channel(channel, server)) {
|
|
1684
|
+
return ares_requeue_query(query, now, ARES_ECONNREFUSED, ARES_TRUE, NULL,
|
|
1685
|
+
requeue);
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1249
1688
|
switch (status) {
|
|
1250
1689
|
/* Good result, continue on */
|
|
1251
1690
|
case ARES_SUCCESS:
|
|
@@ -1256,17 +1695,30 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1256
1695
|
case ARES_ECONNREFUSED:
|
|
1257
1696
|
case ARES_EBADFAMILY:
|
|
1258
1697
|
server_increment_failures(server, query->using_tcp);
|
|
1259
|
-
return ares_requeue_query(query, now, status, ARES_TRUE, NULL,
|
|
1698
|
+
return ares_requeue_query(query, now, status, ARES_TRUE, NULL, requeue);
|
|
1260
1699
|
|
|
1261
1700
|
/* Anything else is not retryable, likely ENOMEM */
|
|
1262
1701
|
default:
|
|
1263
|
-
end_query(channel, server, query, status, NULL);
|
|
1702
|
+
end_query(channel, server, query, status, NULL, requeue);
|
|
1264
1703
|
return status;
|
|
1265
1704
|
}
|
|
1266
1705
|
}
|
|
1267
1706
|
|
|
1268
1707
|
/* Write the query */
|
|
1269
1708
|
status = ares_conn_query_write(conn, query, now);
|
|
1709
|
+
|
|
1710
|
+
/* Writing runs application code too: ares_conn_query_write() reaches the
|
|
1711
|
+
* send function installed by ares_set_socket_functions_ex(), which may
|
|
1712
|
+
* reentrantly call ares_cancel() with the same hazard as above. */
|
|
1713
|
+
if (!ares_query_is_live(channel, qid, serial)) {
|
|
1714
|
+
return ARES_ECANCELLED;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
/* Application code that tore this connection down during the write -- the
|
|
1718
|
+
* send function, or the pending-write callback when the write is deferred,
|
|
1719
|
+
* reconfiguring the servers, say -- surfaces here as ARES_ECONNREFUSED,
|
|
1720
|
+
* even if the send itself reported success or never happened, so the query
|
|
1721
|
+
* is requeued below rather than attached to the closed connection. */
|
|
1270
1722
|
switch (status) {
|
|
1271
1723
|
/* Good result, continue on */
|
|
1272
1724
|
case ARES_SUCCESS:
|
|
@@ -1274,7 +1726,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1274
1726
|
|
|
1275
1727
|
case ARES_ENOMEM:
|
|
1276
1728
|
/* Not retryable */
|
|
1277
|
-
end_query(channel, server, query, status, NULL);
|
|
1729
|
+
end_query(channel, server, query, status, NULL, requeue);
|
|
1278
1730
|
return status;
|
|
1279
1731
|
|
|
1280
1732
|
/* These conditions are retryable as they are server-specific
|
|
@@ -1282,7 +1734,18 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1282
1734
|
case ARES_ECONNREFUSED:
|
|
1283
1735
|
case ARES_EBADFAMILY:
|
|
1284
1736
|
handle_conn_error(conn, ARES_TRUE, status);
|
|
1285
|
-
|
|
1737
|
+
/* handle_conn_error() -> ares_close_connection() ->
|
|
1738
|
+
* ares_requeue_queries() walks conn->queries_to_conn and may terminally
|
|
1739
|
+
* end other queries on this connection. If one of their callbacks
|
|
1740
|
+
* reentrantly calls ares_cancel(), this query is freed too -- it is still
|
|
1741
|
+
* linked in all_queries, since it only joins conn->queries_to_conn on the
|
|
1742
|
+
* success path below. Re-check liveness by the qid captured at entry
|
|
1743
|
+
* rather than dereferencing a possibly-freed query. Mirrors the guard in
|
|
1744
|
+
* ares_send_query(). */
|
|
1745
|
+
if (!ares_query_is_live(channel, qid, serial)) {
|
|
1746
|
+
return ARES_ECONNREFUSED;
|
|
1747
|
+
}
|
|
1748
|
+
status = ares_requeue_query(query, now, status, ARES_TRUE, NULL, requeue);
|
|
1286
1749
|
if (status == ARES_ETIMEOUT) {
|
|
1287
1750
|
status = ARES_ECONNREFUSED;
|
|
1288
1751
|
}
|
|
@@ -1290,7 +1753,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1290
1753
|
|
|
1291
1754
|
default:
|
|
1292
1755
|
server_increment_failures(server, query->using_tcp);
|
|
1293
|
-
status = ares_requeue_query(query, now, status, ARES_TRUE, NULL,
|
|
1756
|
+
status = ares_requeue_query(query, now, status, ARES_TRUE, NULL, requeue);
|
|
1294
1757
|
return status;
|
|
1295
1758
|
}
|
|
1296
1759
|
|
|
@@ -1301,12 +1764,12 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1301
1764
|
ares_slist_node_destroy(query->node_queries_by_timeout);
|
|
1302
1765
|
query->ts = *now;
|
|
1303
1766
|
query->timeout = *now;
|
|
1304
|
-
|
|
1767
|
+
ares_timeval_add(&query->timeout, timeplus);
|
|
1305
1768
|
query->node_queries_by_timeout =
|
|
1306
1769
|
ares_slist_insert(channel->queries_by_timeout, query);
|
|
1307
1770
|
if (!query->node_queries_by_timeout) {
|
|
1308
1771
|
/* LCOV_EXCL_START: OutOfMemory */
|
|
1309
|
-
end_query(channel, server, query, ARES_ENOMEM, NULL);
|
|
1772
|
+
end_query(channel, server, query, ARES_ENOMEM, NULL, requeue);
|
|
1310
1773
|
return ARES_ENOMEM;
|
|
1311
1774
|
/* LCOV_EXCL_STOP */
|
|
1312
1775
|
}
|
|
@@ -1319,7 +1782,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1319
1782
|
|
|
1320
1783
|
if (query->node_queries_to_conn == NULL) {
|
|
1321
1784
|
/* LCOV_EXCL_START: OutOfMemory */
|
|
1322
|
-
end_query(channel, server, query, ARES_ENOMEM, NULL);
|
|
1785
|
+
end_query(channel, server, query, ARES_ENOMEM, NULL, requeue);
|
|
1323
1786
|
return ARES_ENOMEM;
|
|
1324
1787
|
/* LCOV_EXCL_STOP */
|
|
1325
1788
|
}
|
|
@@ -1333,6 +1796,10 @@ ares_status_t ares_send_query(ares_server_t *requested_server,
|
|
|
1333
1796
|
ares_probe_failed_server(channel, server, query);
|
|
1334
1797
|
}
|
|
1335
1798
|
|
|
1799
|
+
if (channel->query_enqueue_cb) {
|
|
1800
|
+
channel->query_enqueue_cb(channel->query_enqueue_cb_data);
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1336
1803
|
return ARES_SUCCESS;
|
|
1337
1804
|
}
|
|
1338
1805
|
|
|
@@ -1396,18 +1863,25 @@ done:
|
|
|
1396
1863
|
return rv;
|
|
1397
1864
|
}
|
|
1398
1865
|
|
|
1399
|
-
|
|
1866
|
+
void ares_detach_query(ares_query_t *query)
|
|
1400
1867
|
{
|
|
1401
1868
|
/* Remove the query from all the lists in which it is linked */
|
|
1402
1869
|
ares_query_remove_from_conn(query);
|
|
1403
|
-
|
|
1870
|
+
/* Only release the qid slot if it is still ours. A query detached before
|
|
1871
|
+
* its callback can have its qid reissued to a lookup started from within
|
|
1872
|
+
* that callback, and the ares_free_query() that follows detaches a second
|
|
1873
|
+
* time -- which would otherwise evict the new lookup instead. */
|
|
1874
|
+
if (ares_htable_szvp_get_direct(query->channel->queries_by_qid, query->qid) ==
|
|
1875
|
+
query) {
|
|
1876
|
+
ares_htable_szvp_remove(query->channel->queries_by_qid, query->qid);
|
|
1877
|
+
}
|
|
1404
1878
|
ares_llist_node_destroy(query->node_all_queries);
|
|
1405
1879
|
query->node_all_queries = NULL;
|
|
1406
1880
|
}
|
|
1407
1881
|
|
|
1408
1882
|
static void end_query(ares_channel_t *channel, ares_server_t *server,
|
|
1409
1883
|
ares_query_t *query, ares_status_t status,
|
|
1410
|
-
|
|
1884
|
+
ares_dns_record_t *dnsrec, ares_array_t **requeue)
|
|
1411
1885
|
{
|
|
1412
1886
|
/* If we were probing for the server to come back online, lets mark it as
|
|
1413
1887
|
* no longer being probed */
|
|
@@ -1417,6 +1891,22 @@ static void end_query(ares_channel_t *channel, ares_server_t *server,
|
|
|
1417
1891
|
|
|
1418
1892
|
ares_metrics_record(query, server, status, dnsrec);
|
|
1419
1893
|
|
|
1894
|
+
/* Delay calling the query callback */
|
|
1895
|
+
if (requeue != NULL) {
|
|
1896
|
+
ares_append_endqueue(requeue, query, status, dnsrec);
|
|
1897
|
+
return;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
/* Detach from all lookup lists before the callback, otherwise a reentrant
|
|
1901
|
+
* ares_cancel() from within it would find this query still linked, free it,
|
|
1902
|
+
* and the ares_free_query() below would double-free. Mirrors
|
|
1903
|
+
* ares_flush_requeue() for every synchronous path that reaches here with a
|
|
1904
|
+
* NULL requeue: connection teardown via handle_conn_error(), and server
|
|
1905
|
+
* removal via ares_servers_update() and ares_destroy_servers_state(), both
|
|
1906
|
+
* of which reach ares_close_sockets().
|
|
1907
|
+
* ares_detach_query() may safely run twice on the same query. */
|
|
1908
|
+
ares_detach_query(query);
|
|
1909
|
+
|
|
1420
1910
|
/* Invoke the callback. */
|
|
1421
1911
|
query->callback(query->arg, status, query->timeouts, dnsrec);
|
|
1422
1912
|
ares_free_query(query);
|
|
@@ -1424,7 +1914,8 @@ static void end_query(ares_channel_t *channel, ares_server_t *server,
|
|
|
1424
1914
|
/* Check and notify if no other queries are enqueued on the channel. This
|
|
1425
1915
|
* must come after the callback and freeing the query for 2 reasons.
|
|
1426
1916
|
* 1) The callback itself may enqueue a new query
|
|
1427
|
-
* 2)
|
|
1917
|
+
* 2) The current query is detached above, before the callback, so by this
|
|
1918
|
+
* point it is no longer tracked.
|
|
1428
1919
|
*/
|
|
1429
1920
|
ares_queue_notify_empty(channel);
|
|
1430
1921
|
}
|
|
@@ -1437,6 +1928,7 @@ void ares_free_query(ares_query_t *query)
|
|
|
1437
1928
|
query->arg = NULL;
|
|
1438
1929
|
/* Deallocate the memory associated with the query */
|
|
1439
1930
|
ares_dns_record_destroy(query->query);
|
|
1931
|
+
ares_free(query->qcache_key);
|
|
1440
1932
|
|
|
1441
1933
|
ares_free(query);
|
|
1442
1934
|
}
|