grpc 1.85.0 → 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.
Files changed (634) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +13 -9
  3. data/etc/roots.pem +0 -583
  4. data/include/grpc/channel_factory.h +78 -0
  5. data/include/grpc/credentials.h +21 -0
  6. data/include/grpc/grpc.h +7 -0
  7. data/include/grpc/grpc_security_constants.h +2 -0
  8. data/include/grpc/module.modulemap +1 -0
  9. data/src/core/call/call_filters.cc +4 -1
  10. data/src/core/call/call_filters.h +3 -1
  11. data/src/core/call/call_spine.h +12 -6
  12. data/src/core/call/call_state.h +3 -3
  13. data/src/core/call/client_call.cc +4 -1
  14. data/src/core/call/client_call.h +1 -0
  15. data/src/core/call/evaluate_args.cc +15 -14
  16. data/src/core/call/filter_fusion.h +2 -15
  17. data/src/core/call/interception_chain.h +2 -7
  18. data/src/core/call/metadata_batch.cc +5 -0
  19. data/src/core/call/metadata_batch.h +34 -3
  20. data/src/core/call/request_buffer.cc +1 -1
  21. data/src/core/call/server_call.cc +3 -3
  22. data/src/core/call/server_call.h +15 -0
  23. data/src/core/channelz/channelz_registry.cc +4 -4
  24. data/src/core/channelz/ztrace_collector.h +11 -2
  25. data/src/core/client_channel/backup_poller.cc +1 -2
  26. data/src/core/client_channel/channel_factory.cc +110 -0
  27. data/src/core/client_channel/channel_factory.h +45 -0
  28. data/src/core/client_channel/global_subchannel_pool.cc +2 -2
  29. data/src/core/client_channel/lame_channel.cc +59 -0
  30. data/src/core/client_channel/lame_channel.h +86 -0
  31. data/src/core/credentials/call/external/aws_request_signer.cc +2 -1
  32. data/src/core/credentials/call/external/url_external_account_credentials.cc +6 -17
  33. data/src/core/credentials/call/external/url_external_account_credentials.h +0 -1
  34. data/src/core/credentials/call/jwt/jwt_verifier.cc +25 -13
  35. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +6 -4
  36. data/src/core/credentials/call/regional_access_boundary_fetcher.cc +16 -0
  37. data/src/core/credentials/call/regional_access_boundary_fetcher.h +6 -2
  38. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +14 -0
  39. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +12 -2
  40. data/src/core/credentials/transport/tls/ssl_utils.cc +20 -0
  41. data/src/core/credentials/transport/tls/ssl_utils.h +4 -0
  42. data/src/core/credentials/transport/tls/tls_security_connector.cc +6 -2
  43. data/src/core/ext/filters/http/server/http_server_filter.cc +6 -1
  44. data/src/core/ext/filters/rbac/rbac_filter.cc +3 -41
  45. data/src/core/ext/filters/rbac/rbac_filter.h +2 -11
  46. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
  47. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +31 -24
  48. data/src/core/ext/transport/chttp2/server/chttp2_server.h +1 -2
  49. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +69 -102
  50. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -1
  51. data/src/core/ext/transport/chttp2/transport/flow_control.h +2 -2
  52. data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +1 -1
  53. data/src/core/ext/transport/chttp2/transport/frame.cc +15 -19
  54. data/src/core/ext/transport/chttp2/transport/frame.h +1 -1
  55. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +18 -61
  56. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +0 -4
  57. data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -2
  58. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +9 -0
  59. data/src/core/ext/transport/chttp2/transport/goaway.cc +1 -1
  60. data/src/core/ext/transport/chttp2/transport/goaway.h +0 -5
  61. data/src/core/ext/transport/chttp2/transport/header_assembler.h +1 -5
  62. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +3 -0
  63. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +8 -0
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +33 -0
  65. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +34 -19
  66. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +5 -2
  67. data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +134 -82
  68. data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +30 -15
  69. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +4 -3
  70. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +9 -33
  71. data/src/core/ext/transport/chttp2/transport/http2_transport.h +1 -6
  72. data/src/core/ext/transport/chttp2/transport/http2_transport_stats.h +60 -0
  73. data/src/core/ext/transport/chttp2/transport/internal.h +6 -1
  74. data/src/core/ext/transport/chttp2/transport/keepalive.h +1 -4
  75. data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -8
  76. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +35 -11
  77. data/src/core/ext/transport/chttp2/transport/ping_promise.h +52 -47
  78. data/src/core/ext/transport/chttp2/transport/read_context.h +19 -5
  79. data/src/core/ext/transport/chttp2/transport/security_frame.h +7 -6
  80. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +7 -5
  81. data/src/core/ext/transport/chttp2/transport/transport_common.cc +47 -0
  82. data/src/core/ext/transport/chttp2/transport/transport_common.h +29 -0
  83. data/src/core/ext/transport/chttp2/transport/writable_streams.h +1 -1
  84. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +1 -7
  85. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb.h +16 -0
  86. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb_minitable.c +4 -3
  87. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +129 -81
  88. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +50 -39
  89. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +411 -163
  90. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +95 -44
  91. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.h +3 -0
  92. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb.h +41 -8
  93. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb_minitable.c +8 -5
  94. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +427 -222
  95. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +97 -66
  96. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.h +1 -0
  97. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb.h +130 -99
  98. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb_minitable.c +29 -27
  99. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +49 -33
  100. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +19 -8
  101. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +95 -3
  102. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +33 -6
  103. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +1 -0
  104. data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb.h +93 -11
  105. data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb_minitable.c +8 -5
  106. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +656 -134
  107. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +117 -51
  108. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.h +2 -0
  109. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +45 -23
  110. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +19 -10
  111. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +99 -34
  112. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +12 -7
  113. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +344 -273
  114. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +62 -69
  115. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +1 -3
  116. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +53 -22
  117. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +9 -7
  118. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +108 -0
  119. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.c +26 -2
  120. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.h +1 -0
  121. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +809 -231
  122. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +183 -77
  123. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +3 -0
  124. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +151 -26
  125. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +17 -9
  126. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +24 -8
  127. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +6 -5
  128. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb.h +2 -1
  129. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb.h +224 -16
  130. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.c +83 -10
  131. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.h +2 -0
  132. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +95 -79
  133. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +23 -22
  134. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb.h +34 -18
  135. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.c +10 -9
  136. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +243 -2
  137. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +53 -5
  138. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h +3 -0
  139. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb.h +53 -22
  140. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb_minitable.c +9 -7
  141. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +23 -7
  142. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +9 -4
  143. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +516 -215
  144. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +99 -60
  145. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +1 -0
  146. 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
  147. 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
  148. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +109 -0
  149. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +32 -2
  150. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +1 -0
  151. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +37 -4
  152. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +7 -4
  153. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +65 -47
  154. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +29 -12
  155. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +20 -4
  156. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb_minitable.c +6 -3
  157. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +776 -88
  158. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +195 -35
  159. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +5 -0
  160. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb.h +23 -7
  161. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.c +10 -3
  162. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb.h +44 -0
  163. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.c +11 -2
  164. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.h +1 -0
  165. data/src/core/ext/upb-gen/envoy/type/v3/scope.upb.h +218 -0
  166. data/src/core/ext/upb-gen/envoy/type/v3/scope.upb_minitable.c +70 -0
  167. data/src/core/ext/upb-gen/envoy/type/v3/scope.upb_minitable.h +31 -0
  168. data/src/core/ext/upbdefs-gen/envoy/admin/v3/clusters.upbdefs.c +30 -24
  169. data/src/core/ext/upbdefs-gen/envoy/admin/v3/server_info.upbdefs.c +166 -152
  170. data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +467 -422
  171. data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +15 -0
  172. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +120 -110
  173. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +912 -857
  174. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.h +5 -0
  175. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/outlier_detection.upbdefs.c +26 -19
  176. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +59 -54
  177. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +356 -346
  178. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
  179. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/http_service.upbdefs.c +49 -37
  180. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +599 -483
  181. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.h +10 -0
  182. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +65 -49
  183. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +165 -161
  184. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +369 -327
  185. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -15
  186. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +129 -121
  187. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +224 -204
  188. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.h +5 -0
  189. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +2046 -1932
  190. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +15 -0
  191. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +70 -37
  192. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +7 -3
  193. data/src/core/ext/upbdefs-gen/envoy/data/accesslog/v3/accesslog.upbdefs.c +5 -3
  194. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.c +121 -78
  195. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.h +10 -0
  196. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +165 -160
  197. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +121 -118
  198. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.c +68 -37
  199. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h +15 -0
  200. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/router/v3/router.upbdefs.c +48 -40
  201. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +44 -37
  202. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +919 -870
  203. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  204. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +26 -14
  205. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +44 -36
  206. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +372 -371
  207. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +32 -28
  208. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.c +17 -15
  209. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.c +4 -1
  210. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.h +5 -0
  211. data/src/core/ext/upbdefs-gen/envoy/type/v3/scope.upbdefs.c +76 -0
  212. data/src/core/ext/upbdefs-gen/envoy/type/v3/scope.upbdefs.h +37 -0
  213. data/src/core/ext/upbdefs-gen/envoy/type/v3/token_bucket.upbdefs.c +1 -1
  214. data/src/core/filter/ext_proc/ext_proc_filter.cc +537 -259
  215. data/src/core/filter/ext_proc/ext_proc_filter.h +47 -14
  216. data/src/core/filter/ext_proc/ext_proc_messages.cc +38 -17
  217. data/src/core/filter/ext_proc/ext_proc_messages.h +19 -7
  218. data/src/core/filter/filter_args.h +5 -60
  219. data/src/core/handshaker/http_connect/http_connect_client_handshaker.cc +1 -1
  220. data/src/core/handshaker/security/pipelined_secure_endpoint.cc +23 -22
  221. data/src/core/handshaker/security/secure_endpoint.cc +16 -16
  222. data/src/core/lib/channel/channel_stack.cc +0 -12
  223. data/src/core/lib/channel/channel_stack.h +0 -8
  224. data/src/core/lib/channel/promise_based_filter.cc +57 -44
  225. data/src/core/lib/channel/promise_based_filter.h +29 -41
  226. data/src/core/lib/event_engine/ares_resolver.cc +10 -4
  227. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +1 -1
  228. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +3 -3
  229. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -5
  230. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -12
  231. data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +3 -17
  232. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +21 -1
  233. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +5 -5
  234. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +10 -12
  235. data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
  236. data/src/core/lib/event_engine/posix_engine/timer.cc +2 -2
  237. data/src/core/lib/event_engine/shim.cc +1 -6
  238. data/src/core/lib/event_engine/shim.h +0 -5
  239. data/src/core/lib/event_engine/windows/windows_engine.cc +4 -4
  240. data/src/core/lib/event_engine/windows/windows_listener.cc +1 -1
  241. data/src/core/lib/experiments/experiments.cc +144 -261
  242. data/src/core/lib/experiments/experiments.h +48 -120
  243. data/src/core/lib/iomgr/iomgr_windows.cc +1 -6
  244. data/src/core/lib/iomgr/tcp_posix.cc +21 -21
  245. data/src/core/lib/iomgr/tcp_server_posix.cc +64 -242
  246. data/src/core/lib/iomgr/tcp_server_windows.cc +0 -469
  247. data/src/core/lib/promise/activity.cc +8 -8
  248. data/src/core/lib/promise/activity.h +5 -5
  249. data/src/core/lib/promise/inter_activity_pipe.h +3 -3
  250. data/src/core/lib/promise/party.cc +5 -5
  251. data/src/core/lib/promise/status_flag.h +7 -2
  252. data/src/core/lib/resource_quota/memory_quota.cc +2 -2
  253. data/src/core/lib/security/authorization/rbac_policy.h +2 -2
  254. data/src/core/lib/surface/call.cc +13 -3
  255. data/src/core/lib/surface/call.h +23 -6
  256. data/src/core/lib/surface/channel_create.cc +7 -1
  257. data/src/core/lib/surface/channel_init.h +1 -8
  258. data/src/core/lib/surface/filter_stack_call.cc +16 -0
  259. data/src/core/lib/surface/filter_stack_call.h +1 -0
  260. data/src/core/lib/surface/init.cc +3 -3
  261. data/src/core/lib/surface/legacy_channel.cc +4 -1
  262. data/src/core/lib/surface/version.cc +2 -2
  263. data/src/core/lib/transport/transport.cc +15 -8
  264. data/src/core/lib/transport/transport_framing_endpoint_extension.h +8 -2
  265. data/src/core/load_balancing/outlier_detection/outlier_detection.cc +99 -8
  266. data/src/core/load_balancing/outlier_detection/outlier_detection_metrics.cc +38 -0
  267. data/src/core/load_balancing/outlier_detection/outlier_detection_metrics.h +55 -0
  268. data/src/core/load_balancing/ring_hash/ring_hash.cc +2 -1
  269. data/src/core/load_balancing/rls/rls.cc +21 -1
  270. data/src/core/load_balancing/xds/cds.cc +4 -51
  271. data/src/core/plugin_registry/grpc_plugin_registry.cc +10 -13
  272. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -7
  273. data/src/core/resolver/xds/xds_resolver.cc +1 -1
  274. data/src/core/server/server.cc +60 -4
  275. data/src/core/server/server_config_selector.h +4 -18
  276. data/src/core/server/server_config_selector_filter.cc +20 -146
  277. data/src/core/server/server_config_selector_filter.h +2 -2
  278. data/src/core/server/xds_server_config_fetcher.cc +5 -20
  279. data/src/core/transport/auth_context.cc +15 -5
  280. data/src/core/transport/auth_context.h +5 -0
  281. data/src/core/tsi/ssl_telemetry_utils.cc +9 -1
  282. data/src/core/tsi/ssl_transport_security.cc +158 -52
  283. data/src/core/tsi/ssl_transport_security.h +18 -2
  284. data/src/core/tsi/ssl_transport_security_utils.cc +123 -12
  285. data/src/core/tsi/ssl_transport_security_utils.h +19 -0
  286. data/src/core/util/latent_see.cc +65 -3
  287. data/src/core/util/latent_see.h +57 -12
  288. data/src/core/util/linux/cpu.cc +12 -6
  289. data/src/core/util/mpscq.cc +2 -2
  290. data/src/core/util/sync_abseil.cc +3 -3
  291. data/src/core/util/trie_lookup.h +5 -1
  292. data/src/core/util/windows/env.cc +1 -0
  293. data/src/core/util/work_serializer.cc +1 -1
  294. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +10 -9
  295. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +3 -3
  296. data/src/core/xds/grpc/streaming_call_promise_wrapper.cc +5 -2
  297. data/src/core/xds/grpc/streaming_call_promise_wrapper.h +2 -5
  298. data/src/core/xds/grpc/xds_audit_logger_registry.cc +0 -54
  299. data/src/core/xds/grpc/xds_audit_logger_registry.h +0 -8
  300. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +2 -28
  301. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +0 -20
  302. data/src/core/xds/grpc/xds_client_grpc.cc +4 -4
  303. data/src/core/xds/grpc/xds_client_grpc.h +1 -1
  304. data/src/core/xds/grpc/xds_cluster_parser.cc +5 -1
  305. data/src/core/xds/grpc/xds_common_types_parser.cc +12 -0
  306. data/src/core/xds/grpc/xds_endpoint_parser.cc +3 -3
  307. data/src/core/xds/grpc/xds_http_composite_filter.cc +0 -5
  308. data/src/core/xds/grpc/xds_http_composite_filter.h +1 -27
  309. data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +1 -5
  310. data/src/core/xds/grpc/xds_http_ext_proc_filter.h +3 -29
  311. data/src/core/xds/grpc/xds_http_fault_filter.cc +0 -4
  312. data/src/core/xds/grpc/xds_http_fault_filter.h +0 -26
  313. data/src/core/xds/grpc/xds_http_filter.h +1 -63
  314. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +0 -5
  315. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +1 -27
  316. data/src/core/xds/grpc/xds_http_rbac_filter.cc +0 -527
  317. data/src/core/xds/grpc/xds_http_rbac_filter.h +0 -15
  318. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +0 -5
  319. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +0 -26
  320. data/src/core/xds/grpc/xds_listener.cc +0 -2
  321. data/src/core/xds/grpc/xds_listener.h +0 -2
  322. data/src/core/xds/grpc/xds_listener_parser.cc +0 -7
  323. data/src/core/xds/grpc/xds_matcher.cc +17 -11
  324. data/src/core/xds/grpc/xds_matcher.h +2 -1
  325. data/src/core/xds/grpc/xds_matcher_context.cc +11 -0
  326. data/src/core/xds/grpc/xds_matcher_context.h +3 -2
  327. data/src/core/xds/grpc/xds_matcher_input.cc +19 -1
  328. data/src/core/xds/grpc/xds_matcher_parse.cc +3 -2
  329. data/src/core/xds/grpc/xds_route_config.cc +0 -2
  330. data/src/core/xds/grpc/xds_route_config.h +0 -2
  331. data/src/core/xds/grpc/xds_route_config_parser.cc +0 -5
  332. data/src/core/xds/grpc/xds_routing.cc +22 -112
  333. data/src/core/xds/grpc/xds_routing.h +2 -27
  334. data/src/core/xds/grpc/xds_transport_factory_grpc.cc +236 -0
  335. data/src/core/xds/grpc/xds_transport_factory_grpc.h +95 -0
  336. data/src/core/xds/grpc/xds_transport_grpc.cc +78 -241
  337. data/src/core/xds/grpc/xds_transport_grpc.h +41 -51
  338. data/src/core/xds/xds_client/lrs_client.cc +3 -5
  339. data/src/core/xds/xds_client/lrs_client.h +2 -1
  340. data/src/core/xds/xds_client/xds_client.cc +36 -23
  341. data/src/core/xds/xds_client/xds_client.h +6 -5
  342. data/src/core/xds/xds_client/xds_transport.h +110 -108
  343. data/src/core/xds/xds_client/xds_transport_factory.h +43 -0
  344. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  345. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  346. data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
  347. data/src/ruby/lib/grpc/version.rb +1 -1
  348. data/third_party/boringssl-with-bazel/crypto/asn1/a_type.cc +54 -19
  349. data/third_party/boringssl-with-bazel/crypto/asn1/asn1_lib.cc +1 -1
  350. data/third_party/boringssl-with-bazel/crypto/asn1/internal.h +58 -12
  351. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_dec.cc +13 -13
  352. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_enc.cc +13 -11
  353. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_fre.cc +14 -18
  354. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_new.cc +31 -35
  355. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_typ.cc +0 -2
  356. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_utl.cc +17 -24
  357. data/third_party/boringssl-with-bazel/crypto/bio/bio.cc +0 -1
  358. data/third_party/boringssl-with-bazel/crypto/bio/bio_mem.cc +9 -3
  359. data/third_party/boringssl-with-bazel/crypto/bio/connect.cc +3 -3
  360. data/third_party/boringssl-with-bazel/crypto/bio/fd.cc +0 -1
  361. data/third_party/boringssl-with-bazel/crypto/bio/file.cc +0 -1
  362. data/third_party/boringssl-with-bazel/crypto/bio/internal.h +2 -3
  363. data/third_party/boringssl-with-bazel/crypto/bio/pair.cc +0 -1
  364. data/third_party/boringssl-with-bazel/crypto/bio/socket.cc +1 -1
  365. data/third_party/boringssl-with-bazel/crypto/bytestring/cbb.cc +70 -45
  366. data/third_party/boringssl-with-bazel/crypto/bytestring/cbs.cc +15 -34
  367. data/third_party/boringssl-with-bazel/crypto/bytestring/internal.h +5 -0
  368. data/third_party/boringssl-with-bazel/crypto/cipher/e_aesgcmsiv.cc +20 -165
  369. data/third_party/boringssl-with-bazel/crypto/cipher/e_tls.cc +7 -4
  370. data/third_party/boringssl-with-bazel/crypto/cipher/internal.h +159 -0
  371. data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519.cc +295 -16
  372. data/third_party/boringssl-with-bazel/crypto/curve25519/internal.h +25 -14
  373. data/third_party/boringssl-with-bazel/crypto/dh/params.cc +1 -1
  374. data/third_party/boringssl-with-bazel/crypto/ec/hash_to_curve.cc +208 -36
  375. data/third_party/boringssl-with-bazel/crypto/err/err.cc +3 -2
  376. data/third_party/boringssl-with-bazel/crypto/evp/evp.cc +3 -0
  377. data/third_party/boringssl-with-bazel/crypto/evp/evp_kem.cc +25 -6
  378. data/third_party/boringssl-with-bazel/crypto/evp/internal.h +15 -11
  379. data/third_party/boringssl-with-bazel/crypto/evp/p_ec.cc +121 -0
  380. data/third_party/boringssl-with-bazel/crypto/evp/p_mlkem.cc +34 -9
  381. data/third_party/boringssl-with-bazel/crypto/evp/p_rsa.cc +76 -8
  382. data/third_party/boringssl-with-bazel/crypto/evp/p_xwing.cc +47 -20
  383. data/third_party/boringssl-with-bazel/crypto/ex_data.cc +1 -1
  384. data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/aes_nohw.cc.inc +1 -1
  385. data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/gcm.cc.inc +2 -2
  386. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bcm.cc +1 -0
  387. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/add.cc.inc +9 -4
  388. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +4 -4
  389. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/exponentiation.cc.inc +2 -2
  390. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/internal.h +12 -6
  391. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/jacobi.cc.inc +1 -1
  392. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/montgomery_inv.cc.inc +4 -4
  393. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/prime.cc.inc +3 -3
  394. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/rsaz_exp.cc.inc +6 -6
  395. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/sqrt.cc.inc +21 -21
  396. data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/aead.cc.inc +4 -2
  397. data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/cipher.cc.inc +97 -132
  398. data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/internal.h +7 -6
  399. data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/dh.cc.inc +3 -3
  400. data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/internal.h +1 -1
  401. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec.cc.inc +77 -17
  402. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec_montgomery.cc.inc +13 -13
  403. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/felem.cc.inc +117 -34
  404. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/internal.h +67 -18
  405. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/oct.cc.inc +29 -151
  406. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.cc.inc +740 -0
  407. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.h +207 -0
  408. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256.cc.inc +407 -519
  409. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/simple.cc.inc +27 -28
  410. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +1 -1
  411. data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/jitter.cc.inc +1 -1
  412. data/third_party/boringssl-with-bazel/crypto/fipsmodule/fips_shared_support.cc +4 -4
  413. data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/internal.h +70 -1
  414. data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/keccak.cc.inc +292 -52
  415. data/third_party/boringssl-with-bazel/crypto/fipsmodule/mldsa/mldsa.cc.inc +226 -69
  416. data/third_party/boringssl-with-bazel/crypto/fipsmodule/mlkem/mlkem.cc.inc +238 -83
  417. data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/rsa_impl.cc.inc +6 -6
  418. data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha1.cc.inc +2 -2
  419. data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/fors.cc.inc +1 -1
  420. data/third_party/boringssl-with-bazel/crypto/hpke/hpke.cc +327 -272
  421. data/third_party/boringssl-with-bazel/crypto/hrss/hrss.cc +14 -14
  422. data/third_party/boringssl-with-bazel/crypto/internal.h +63 -0
  423. data/third_party/boringssl-with-bazel/crypto/mem_internal.h +38 -3
  424. data/third_party/boringssl-with-bazel/crypto/obj/obj_dat.h +97 -1
  425. data/third_party/boringssl-with-bazel/crypto/pem/internal.h +86 -0
  426. data/third_party/boringssl-with-bazel/crypto/pem/pem_all.cc +8 -5
  427. data/third_party/boringssl-with-bazel/crypto/pem/pem_lib.cc +41 -73
  428. data/third_party/boringssl-with-bazel/crypto/pem/pem_pk8.cc +3 -0
  429. data/third_party/boringssl-with-bazel/crypto/pem/pem_pkey.cc +10 -4
  430. data/third_party/boringssl-with-bazel/crypto/pem/pem_x509.cc +3 -0
  431. data/third_party/boringssl-with-bazel/crypto/pem/pem_xaux.cc +3 -0
  432. data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7.cc +1 -1
  433. data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7_x509.cc +2 -2
  434. data/third_party/boringssl-with-bazel/crypto/pkcs8/pkcs8_x509.cc +1 -1
  435. data/third_party/boringssl-with-bazel/crypto/poly1305/internal.h +17 -0
  436. data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_arm.cc +1 -13
  437. data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_vec.cc +3 -3
  438. data/third_party/boringssl-with-bazel/crypto/slhdsa/slhdsa.cc +23 -6
  439. data/third_party/boringssl-with-bazel/crypto/stack/stack.cc +7 -0
  440. data/third_party/boringssl-with-bazel/crypto/trust_token/internal.h +1 -1
  441. data/third_party/boringssl-with-bazel/crypto/x509/a_verify.cc +14 -7
  442. data/third_party/boringssl-with-bazel/crypto/x509/internal.h +110 -76
  443. data/third_party/boringssl-with-bazel/crypto/x509/name_print.cc +1 -1
  444. data/third_party/boringssl-with-bazel/crypto/x509/rsa_pss.cc +1 -1
  445. data/third_party/boringssl-with-bazel/crypto/x509/t_req.cc +1 -1
  446. data/third_party/boringssl-with-bazel/crypto/x509/t_x509.cc +6 -5
  447. data/third_party/boringssl-with-bazel/crypto/x509/v3_crld.cc +11 -53
  448. data/third_party/boringssl-with-bazel/crypto/x509/v3_ncons.cc +5 -5
  449. data/third_party/boringssl-with-bazel/crypto/x509/v3_purp.cc +16 -39
  450. data/third_party/boringssl-with-bazel/crypto/x509/v3_skey.cc +1 -1
  451. data/third_party/boringssl-with-bazel/crypto/x509/v3_utl.cc +12 -16
  452. data/third_party/boringssl-with-bazel/crypto/x509/x509_cmp.cc +9 -11
  453. data/third_party/boringssl-with-bazel/crypto/x509/x509_mtc.cc +598 -0
  454. data/third_party/boringssl-with-bazel/crypto/x509/x509_obj.cc +9 -8
  455. data/third_party/boringssl-with-bazel/crypto/x509/x509_set.cc +14 -18
  456. data/third_party/boringssl-with-bazel/crypto/x509/x509_vfy.cc +315 -390
  457. data/third_party/boringssl-with-bazel/crypto/x509/x509_vpm.cc +1 -1
  458. data/third_party/boringssl-with-bazel/crypto/x509/x509name.cc +31 -29
  459. data/third_party/boringssl-with-bazel/crypto/x509/x_all.cc +10 -9
  460. data/third_party/boringssl-with-bazel/crypto/x509/x_crl.cc +3 -53
  461. data/third_party/boringssl-with-bazel/crypto/x509/x_name.cc +37 -59
  462. data/third_party/boringssl-with-bazel/crypto/x509/x_pubkey.cc +29 -47
  463. data/third_party/boringssl-with-bazel/crypto/x509/x_req.cc +2 -1
  464. data/third_party/boringssl-with-bazel/crypto/x509/x_x509.cc +53 -53
  465. data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +24 -0
  466. data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +24 -0
  467. data/third_party/boringssl-with-bazel/gen/crypto/err_data.cc +509 -497
  468. data/third_party/boringssl-with-bazel/include/openssl/aead.h +7 -19
  469. data/third_party/boringssl-with-bazel/include/openssl/asm_base.h +1 -1
  470. data/third_party/boringssl-with-bazel/include/openssl/asn1.h +6 -10
  471. data/third_party/boringssl-with-bazel/include/openssl/base.h +43 -16
  472. data/third_party/boringssl-with-bazel/include/openssl/bio.h +25 -10
  473. data/third_party/boringssl-with-bazel/include/openssl/bytestring.h +33 -1
  474. data/third_party/boringssl-with-bazel/include/openssl/cipher.h +11 -9
  475. data/third_party/boringssl-with-bazel/include/openssl/configuration.h +18 -0
  476. data/third_party/boringssl-with-bazel/include/openssl/curve25519.h +36 -0
  477. data/third_party/boringssl-with-bazel/include/openssl/digest.h +4 -4
  478. data/third_party/boringssl-with-bazel/include/openssl/ec.h +35 -1
  479. data/third_party/boringssl-with-bazel/include/openssl/ec_key.h +2 -2
  480. data/third_party/boringssl-with-bazel/include/openssl/evp.h +120 -3
  481. data/third_party/boringssl-with-bazel/include/openssl/evp_errors.h +1 -0
  482. data/third_party/boringssl-with-bazel/include/openssl/hmac.h +2 -2
  483. data/third_party/boringssl-with-bazel/include/openssl/hpke.h +38 -7
  484. data/third_party/boringssl-with-bazel/include/openssl/mem.h +5 -5
  485. data/third_party/boringssl-with-bazel/include/openssl/nid.h +42 -0
  486. data/third_party/boringssl-with-bazel/include/openssl/pem.h +650 -351
  487. data/third_party/boringssl-with-bazel/include/openssl/posix_time.h +4 -4
  488. data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols.h +130 -4
  489. data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_S.h +48 -0
  490. data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_c.h +24 -0
  491. data/third_party/boringssl-with-bazel/include/openssl/rsa.h +1 -1
  492. data/third_party/boringssl-with-bazel/include/openssl/slhdsa.h +25 -1
  493. data/third_party/boringssl-with-bazel/include/openssl/ssl.h +256 -87
  494. data/third_party/boringssl-with-bazel/include/openssl/stack.h +9 -0
  495. data/third_party/boringssl-with-bazel/include/openssl/types.h +18 -0
  496. data/third_party/boringssl-with-bazel/include/openssl/x509.h +40 -21
  497. data/third_party/boringssl-with-bazel/ssl/bio_ssl.cc +3 -5
  498. data/third_party/boringssl-with-bazel/ssl/d1_both.cc +146 -81
  499. data/third_party/boringssl-with-bazel/ssl/d1_lib.cc +39 -34
  500. data/third_party/boringssl-with-bazel/ssl/d1_pkt.cc +6 -6
  501. data/third_party/boringssl-with-bazel/ssl/d1_srtp.cc +10 -8
  502. data/third_party/boringssl-with-bazel/ssl/dtls_method.cc +4 -4
  503. data/third_party/boringssl-with-bazel/ssl/dtls_record.cc +15 -14
  504. data/third_party/boringssl-with-bazel/ssl/encrypted_client_hello.cc +41 -25
  505. data/third_party/boringssl-with-bazel/ssl/extensions.cc +153 -171
  506. data/third_party/boringssl-with-bazel/ssl/handoff.cc +79 -64
  507. data/third_party/boringssl-with-bazel/ssl/handshake.cc +15 -16
  508. data/third_party/boringssl-with-bazel/ssl/handshake_client.cc +35 -78
  509. data/third_party/boringssl-with-bazel/ssl/handshake_server.cc +75 -155
  510. data/third_party/boringssl-with-bazel/ssl/internal.h +419 -308
  511. data/third_party/boringssl-with-bazel/ssl/s3_both.cc +17 -150
  512. data/third_party/boringssl-with-bazel/ssl/s3_lib.cc +2 -3
  513. data/third_party/boringssl-with-bazel/ssl/s3_pkt.cc +10 -9
  514. data/third_party/boringssl-with-bazel/ssl/ssl_asn1.cc +13 -13
  515. data/third_party/boringssl-with-bazel/ssl/ssl_buffer.cc +8 -8
  516. data/third_party/boringssl-with-bazel/ssl/ssl_cert.cc +58 -24
  517. data/third_party/boringssl-with-bazel/ssl/ssl_cipher.cc +198 -26
  518. data/third_party/boringssl-with-bazel/ssl/ssl_credential.cc +164 -37
  519. data/third_party/boringssl-with-bazel/ssl/ssl_file.cc +10 -8
  520. data/third_party/boringssl-with-bazel/ssl/ssl_key_share.cc +2 -95
  521. data/third_party/boringssl-with-bazel/ssl/ssl_lib.cc +785 -472
  522. data/third_party/boringssl-with-bazel/ssl/ssl_privkey.cc +78 -67
  523. data/third_party/boringssl-with-bazel/ssl/ssl_session.cc +187 -150
  524. data/third_party/boringssl-with-bazel/ssl/ssl_stat.cc +6 -3
  525. data/third_party/boringssl-with-bazel/ssl/ssl_transcript.cc +1 -1
  526. data/third_party/boringssl-with-bazel/ssl/ssl_versions.cc +25 -19
  527. data/third_party/boringssl-with-bazel/ssl/ssl_x509.cc +148 -114
  528. data/third_party/boringssl-with-bazel/ssl/t1_enc.cc +28 -19
  529. data/third_party/boringssl-with-bazel/ssl/tls13_both.cc +24 -22
  530. data/third_party/boringssl-with-bazel/ssl/tls13_client.cc +30 -30
  531. data/third_party/boringssl-with-bazel/ssl/tls13_enc.cc +17 -16
  532. data/third_party/boringssl-with-bazel/ssl/tls13_server.cc +55 -63
  533. data/third_party/boringssl-with-bazel/ssl/tls_method.cc +12 -12
  534. data/third_party/boringssl-with-bazel/ssl/tls_record.cc +23 -20
  535. data/third_party/boringssl-with-bazel/third_party/fiat/p256_64.h +38 -0
  536. data/third_party/boringssl-with-bazel/third_party/fiat/p256_64_msvc.h +2 -0
  537. data/third_party/boringssl-with-bazel/third_party/fiat/p256_field.c.inc +26 -0
  538. data/third_party/boringssl-with-bazel/third_party/fiat/p256_point.br.c.inc +0 -54
  539. data/third_party/cares/cares/include/ares.h +8 -0
  540. data/third_party/cares/cares/include/ares_dns_record.h +3 -2
  541. data/third_party/cares/cares/include/ares_version.h +3 -3
  542. data/third_party/cares/cares/src/lib/ares_addrinfo_localhost.c +20 -20
  543. data/third_party/cares/cares/src/lib/ares_cancel.c +17 -8
  544. data/third_party/cares/cares/src/lib/ares_close_sockets.c +81 -16
  545. data/third_party/cares/cares/src/lib/ares_conn.c +256 -10
  546. data/third_party/cares/cares/src/lib/ares_conn.h +40 -3
  547. data/third_party/cares/cares/src/lib/ares_cookie.c +2 -2
  548. data/third_party/cares/cares/src/lib/ares_destroy.c +75 -10
  549. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +85 -10
  550. data/third_party/cares/cares/src/lib/ares_gethostbyaddr.c +5 -0
  551. data/third_party/cares/cares/src/lib/ares_gethostbyname.c +4 -0
  552. data/third_party/cares/cares/src/lib/ares_getnameinfo.c +10 -2
  553. data/third_party/cares/cares/src/lib/ares_hosts_file.c +8 -0
  554. data/third_party/cares/cares/src/lib/ares_inet_net_pton.h +28 -0
  555. data/third_party/cares/cares/src/lib/ares_init.c +55 -10
  556. data/third_party/cares/cares/src/lib/ares_library_init.c +25 -7
  557. data/third_party/cares/cares/src/lib/ares_options.c +38 -10
  558. data/third_party/cares/cares/src/lib/ares_parse_into_addrinfo.c +1 -1
  559. data/third_party/cares/cares/src/lib/ares_private.h +186 -27
  560. data/third_party/cares/cares/src/lib/ares_process.c +604 -112
  561. data/third_party/cares/cares/src/lib/ares_qcache.c +200 -36
  562. data/third_party/cares/cares/src/lib/ares_query.c +5 -0
  563. data/third_party/cares/cares/src/lib/ares_search.c +10 -0
  564. data/third_party/cares/cares/src/lib/ares_send.c +81 -10
  565. data/third_party/cares/cares/src/lib/ares_set_socket_functions.c +3 -1
  566. data/third_party/cares/cares/src/lib/ares_socket.c +28 -0
  567. data/third_party/cares/cares/src/lib/ares_socket.h +23 -0
  568. data/third_party/cares/cares/src/lib/ares_sysconfig.c +6 -3
  569. data/third_party/cares/cares/src/lib/ares_sysconfig_files.c +33 -11
  570. data/third_party/cares/cares/src/lib/ares_sysconfig_win.c +132 -80
  571. data/third_party/cares/cares/src/lib/ares_timeout.c +11 -0
  572. data/third_party/cares/cares/src/lib/ares_update_servers.c +55 -11
  573. data/third_party/cares/cares/src/lib/dsa/ares_array.c +20 -5
  574. data/third_party/cares/cares/src/lib/dsa/ares_htable.c +8 -4
  575. data/third_party/cares/cares/src/lib/dsa/ares_htable_dict.c +2 -0
  576. data/third_party/cares/cares/src/lib/dsa/ares_llist.c +4 -1
  577. data/third_party/cares/cares/src/lib/event/ares_event_configchg.c +5 -2
  578. data/third_party/cares/cares/src/lib/event/ares_event_select.c +14 -1
  579. data/third_party/cares/cares/src/lib/event/ares_event_thread.c +8 -0
  580. data/third_party/cares/cares/src/lib/event/ares_event_wake_pipe.c +7 -1
  581. data/third_party/cares/cares/src/lib/event/ares_event_win32.c +3 -0
  582. data/third_party/cares/cares/src/lib/include/ares_mem.h +3 -0
  583. data/third_party/cares/cares/src/lib/include/ares_str.h +17 -0
  584. data/third_party/cares/cares/src/lib/inet_net_pton.c +37 -28
  585. data/third_party/cares/cares/src/lib/legacy/ares_expand_name.c +1 -1
  586. data/third_party/cares/cares/src/lib/legacy/ares_parse_a_reply.c +5 -2
  587. data/third_party/cares/cares/src/lib/legacy/ares_parse_aaaa_reply.c +5 -2
  588. data/third_party/cares/cares/src/lib/legacy/ares_parse_ns_reply.c +2 -2
  589. data/third_party/cares/cares/src/lib/legacy/ares_parse_ptr_reply.c +2 -2
  590. data/third_party/cares/cares/src/lib/legacy/ares_parse_uri_reply.c +1 -1
  591. data/third_party/cares/cares/src/lib/record/ares_dns_mapping.c +19 -4
  592. data/third_party/cares/cares/src/lib/record/ares_dns_multistring.c +3 -1
  593. data/third_party/cares/cares/src/lib/record/ares_dns_name.c +67 -4
  594. data/third_party/cares/cares/src/lib/record/ares_dns_parse.c +62 -34
  595. data/third_party/cares/cares/src/lib/record/ares_dns_private.h +4 -0
  596. data/third_party/cares/cares/src/lib/record/ares_dns_record.c +47 -7
  597. data/third_party/cares/cares/src/lib/record/ares_dns_write.c +13 -5
  598. data/third_party/cares/cares/src/lib/str/ares_buf.c +33 -16
  599. data/third_party/cares/cares/src/lib/str/ares_str.c +54 -0
  600. data/third_party/cares/cares/src/lib/util/ares_iface_ips.c +22 -10
  601. data/third_party/cares/cares/src/lib/util/ares_iface_ips.h +1 -0
  602. data/third_party/cares/cares/src/lib/util/ares_math.c +17 -2
  603. data/third_party/cares/cares/src/lib/util/ares_math.h +32 -7
  604. data/third_party/cares/cares/src/lib/util/ares_rand.c +4 -4
  605. data/third_party/cares/cares/src/lib/util/ares_threads.c +1 -2
  606. data/third_party/cares/cares/src/lib/util/ares_time.h +1 -0
  607. data/third_party/cares/cares/src/lib/util/ares_uri.c +9 -3
  608. data/third_party/zlib/compress.c +34 -10
  609. data/third_party/zlib/crc32.c +49 -115
  610. data/third_party/zlib/deflate.c +107 -61
  611. data/third_party/zlib/deflate.h +7 -1
  612. data/third_party/zlib/gzguts.h +33 -31
  613. data/third_party/zlib/infback.c +20 -67
  614. data/third_party/zlib/inffast.c +7 -6
  615. data/third_party/zlib/inffixed.h +91 -91
  616. data/third_party/zlib/inflate.c +38 -151
  617. data/third_party/zlib/inflate.h +1 -1
  618. data/third_party/zlib/inftrees.c +134 -9
  619. data/third_party/zlib/inftrees.h +3 -1
  620. data/third_party/zlib/trees.c +14 -12
  621. data/third_party/zlib/uncompr.c +39 -23
  622. data/third_party/zlib/zconf.h +27 -19
  623. data/third_party/zlib/zlib.h +215 -96
  624. data/third_party/zlib/zutil.c +49 -35
  625. data/third_party/zlib/zutil.h +87 -10
  626. metadata +4095 -4049
  627. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +0 -916
  628. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +0 -84
  629. data/src/core/server/xds_channel_stack_modifier.cc +0 -108
  630. data/src/core/server/xds_channel_stack_modifier.h +0 -62
  631. data/src/core/server/xds_server_config_fetcher_legacy.cc +0 -1340
  632. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256_internal.h +0 -193
  633. data/third_party/boringssl-with-bazel/crypto/kyber/internal.h +0 -165
  634. data/third_party/boringssl-with-bazel/crypto/kyber/kyber.cc +0 -870
@@ -38,7 +38,7 @@ typedef struct {
38
38
  time_t insert_ts;
39
39
  } ares_qcache_entry_t;
40
40
 
41
- static char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
41
+ char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
42
42
  {
43
43
  ares_buf_t *buf = ares_buf_create();
44
44
  size_t i;
@@ -49,7 +49,22 @@ static char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
49
49
  return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */
50
50
  }
51
51
 
52
- /* Format is OPCODE|FLAGS[|QTYPE1|QCLASS1|QNAME1]... */
52
+ /* Format is
53
+ * OPCODE|FLAGS[|EDNS|VER|FLAGS[|ID:HEX]...]|QDCOUNT[|TYPE|CLASS|LEN:QNAME]...
54
+ *
55
+ * The EDNS section matters: an answer fetched under one set of EDNS options
56
+ * is not interchangeable with one fetched under another. A request with no
57
+ * OPT record appends nothing; note that EDNS is on by default, so ordinary
58
+ * lookups do carry one and their keys did change with this.
59
+ *
60
+ * Everything a caller does not control is emitted before the questions, so
61
+ * the names are always last. A name reaches the key unescaped, so anything
62
+ * keyed after it could otherwise be imitated by a name containing that same
63
+ * text, giving two different requests one key. The question count is part
64
+ * of that: without it, a request with two questions and a request with one
65
+ * whose name spells out the second produce identical keys. Each name is
66
+ * also length-prefixed, so adjacent names cannot be made to run together
67
+ * even when the question counts match. */
53
68
 
54
69
  status = ares_buf_append_str(
55
70
  buf, ares_dns_opcode_tostr(ares_dns_record_get_opcode(dnsrec)));
@@ -63,7 +78,11 @@ static char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
63
78
  }
64
79
 
65
80
  flags = ares_dns_record_get_flags(dnsrec);
66
- /* Only care about RD and CD */
81
+ /* RD, CD and AD. AD is here because RFC 6840 section 5.7 defines it in a
82
+ * request as a signal that the requester wants the AD bit evaluated in the
83
+ * response, and section 5.8 says a validating resolver should only set AD
84
+ * in a response when the request carried DO or AD -- so an answer fetched
85
+ * without it can legitimately differ from one fetched with it. */
67
86
  if (flags & ARES_FLAG_RD) {
68
87
  status = ares_buf_append_str(buf, "rd");
69
88
  if (status != ARES_SUCCESS) {
@@ -76,6 +95,95 @@ static char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
76
95
  goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
77
96
  }
78
97
  }
98
+ if (flags & ARES_FLAG_AD) {
99
+ status = ares_buf_append_str(buf, "ad");
100
+ if (status != ARES_SUCCESS) {
101
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
102
+ }
103
+ }
104
+
105
+ /* EDNS state. Skipped entirely when the request carries no OPT record. */
106
+ {
107
+ const ares_dns_rr_t *opt = ares_dns_get_opt_rr_const(dnsrec);
108
+
109
+ if (opt != NULL) {
110
+ size_t opt_cnt = ares_dns_rr_get_opt_cnt(opt, ARES_RR_OPT_OPTIONS);
111
+ size_t j;
112
+
113
+ status = ares_buf_append_str(buf, "|EDNS|");
114
+ if (status != ARES_SUCCESS) {
115
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
116
+ }
117
+ status = ares_buf_append_num_hex(
118
+ buf, ares_dns_rr_get_u8(opt, ARES_RR_OPT_VERSION), 0);
119
+ if (status != ARES_SUCCESS) {
120
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
121
+ }
122
+ status = ares_buf_append_byte(buf, '|');
123
+ if (status != ARES_SUCCESS) {
124
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
125
+ }
126
+ /* Carries the DO bit, so a DNSSEC-aware request cannot be served an
127
+ * answer that was fetched without it. */
128
+ status = ares_buf_append_num_hex(
129
+ buf, ares_dns_rr_get_u16(opt, ARES_RR_OPT_FLAGS), 0);
130
+ if (status != ARES_SUCCESS) {
131
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
132
+ }
133
+
134
+ /* The advertised UDP payload size is deliberately excluded: it
135
+ * constrains how a response is transported, not what it says. A server
136
+ * that cannot fit the additional section may omit it without setting
137
+ * the TC bit (RFC 2181 section 9), so two sizes can produce answers
138
+ * that differ outside the answer section; that is accepted here. */
139
+ for (j = 0; j < opt_cnt; j++) {
140
+ const unsigned char *val = NULL;
141
+ size_t val_len = 0;
142
+ unsigned short optid =
143
+ ares_dns_rr_get_opt(opt, ARES_RR_OPT_OPTIONS, j, &val, &val_len);
144
+
145
+ /* DNS cookies are per-server transport state and say nothing about
146
+ * the content of an answer. A cookie c-ares adds never reaches here
147
+ * -- ares_cookie_apply() writes to query->query, after this key has
148
+ * been derived -- so this only ever skips one the caller supplied. */
149
+ if (optid == ARES_OPT_PARAM_COOKIE) {
150
+ continue;
151
+ }
152
+
153
+ status = ares_buf_append_byte(buf, '|');
154
+ if (status != ARES_SUCCESS) {
155
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
156
+ }
157
+ status = ares_buf_append_num_hex(buf, optid, 0);
158
+ if (status != ARES_SUCCESS) {
159
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
160
+ }
161
+ status = ares_buf_append_byte(buf, ':');
162
+ if (status != ARES_SUCCESS) {
163
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
164
+ }
165
+ if (val != NULL) {
166
+ size_t k;
167
+ for (k = 0; k < val_len; k++) {
168
+ status = ares_buf_append_num_hex(buf, val[k], 2);
169
+ if (status != ARES_SUCCESS) {
170
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ status = ares_buf_append_byte(buf, '|');
179
+ if (status != ARES_SUCCESS) {
180
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
181
+ }
182
+
183
+ status = ares_buf_append_num_dec(buf, ares_dns_record_query_cnt(dnsrec), 0);
184
+ if (status != ARES_SUCCESS) {
185
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
186
+ }
79
187
 
80
188
  for (i = 0; i < ares_dns_record_query_cnt(dnsrec); i++) {
81
189
  const char *name;
@@ -93,7 +201,13 @@ static char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
93
201
  goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
94
202
  }
95
203
 
96
- status = ares_buf_append_str(buf, ares_dns_rec_type_tostr(qtype));
204
+ /* Numeric, not the mnemonic: ares_dns_rec_type_tostr() returns "UNKNOWN"
205
+ * for every type outside its table, and ares_dns_record_query_add() does
206
+ * not validate the type, so any 16-bit value reaches here through the
207
+ * ordinary public API. Two such lookups -- LOC and DNAME, say -- would
208
+ * otherwise key identically and be answered with each other's records.
209
+ * The key only has to be injective, not readable. */
210
+ status = ares_buf_append_num_dec(buf, (size_t)qtype, 0);
97
211
  if (status != ARES_SUCCESS) {
98
212
  goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
99
213
  }
@@ -103,7 +217,10 @@ static char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
103
217
  goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
104
218
  }
105
219
 
106
- status = ares_buf_append_str(buf, ares_dns_class_tostr(qclass));
220
+ /* Numeric for the same reason. ares_dns_record_query_add() does reject
221
+ * classes outside its list today, so the mnemonic is safe -- but the key
222
+ * should not depend on that validation staying where it is. */
223
+ status = ares_buf_append_num_dec(buf, (size_t)qclass, 0);
107
224
  if (status != ARES_SUCCESS) {
108
225
  goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
109
226
  }
@@ -121,6 +238,21 @@ static char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
121
238
  name_len--;
122
239
  }
123
240
 
241
+ /* Length-prefix the name so it is self-delimiting. The question count
242
+ * above stops one question imitating two, but with the counts equal the
243
+ * boundary between adjacent names is still guessable, since names reach
244
+ * the key unescaped separated only by '|'. A length makes each name
245
+ * unambiguous for any question count. */
246
+ status = ares_buf_append_num_dec(buf, name_len, 0);
247
+ if (status != ARES_SUCCESS) {
248
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
249
+ }
250
+
251
+ status = ares_buf_append_byte(buf, ':');
252
+ if (status != ARES_SUCCESS) {
253
+ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
254
+ }
255
+
124
256
  if (name_len > 0) {
125
257
  status = ares_buf_append(buf, (const unsigned char *)name, name_len);
126
258
  if (status != ARES_SUCCESS) {
@@ -301,10 +433,10 @@ static unsigned int ares_qcache_soa_minimum(ares_dns_record_t *dnsrec)
301
433
  }
302
434
 
303
435
  /* On success, takes ownership of dnsrec */
304
- static ares_status_t ares_qcache_insert_int(ares_qcache_t *qcache,
305
- ares_dns_record_t *qresp,
306
- const ares_dns_record_t *qreq,
307
- const ares_timeval_t *now)
436
+ static ares_status_t ares_qcache_insert_int(ares_qcache_t *qcache,
437
+ ares_dns_record_t *qresp,
438
+ const char *key,
439
+ const ares_timeval_t *now)
308
440
  {
309
441
  ares_qcache_entry_t *entry;
310
442
  unsigned int ttl;
@@ -350,11 +482,11 @@ static ares_status_t ares_qcache_insert_int(ares_qcache_t *qcache,
350
482
  entry->expire_ts = (time_t)now->sec + (time_t)ttl;
351
483
  entry->insert_ts = (time_t)now->sec;
352
484
 
353
- /* We can't guarantee the server responded with the same flags as the
354
- * request had, so we have to re-parse the request in order to generate the
355
- * key for caching, but we'll only do this once we know for sure we really
356
- * want to cache it */
357
- entry->key = ares_qcache_calc_key(qreq);
485
+ /* The key was derived from the caller's request when the query was created.
486
+ * It must not be recomputed from query->query here: the EDNS fallback path
487
+ * strips the OPT record from that record before a successful retry, so a
488
+ * key derived from it would not match the one a later lookup computes. */
489
+ entry->key = ares_strdup(key);
358
490
  if (entry->key == NULL) {
359
491
  goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
360
492
  }
@@ -371,40 +503,36 @@ static ares_status_t ares_qcache_insert_int(ares_qcache_t *qcache,
371
503
 
372
504
  /* LCOV_EXCL_START: OutOfMemory */
373
505
  fail:
374
- if (entry != NULL && entry->key != NULL) {
375
- ares_htable_strvp_remove(qcache->cache, entry->key);
376
- ares_free(entry->key);
506
+ if (entry != NULL) {
507
+ if (entry->key != NULL) {
508
+ ares_htable_strvp_remove(qcache->cache, entry->key);
509
+ ares_free(entry->key);
510
+ }
377
511
  ares_free(entry);
378
512
  }
379
513
  return ARES_ENOMEM;
380
514
  /* LCOV_EXCL_STOP */
381
515
  }
382
516
 
383
- ares_status_t ares_qcache_fetch(ares_channel_t *channel,
384
- const ares_timeval_t *now,
385
- const ares_dns_record_t *dnsrec,
386
- const ares_dns_record_t **dnsrec_resp)
517
+ ares_status_t ares_qcache_fetch(ares_channel_t *channel,
518
+ const ares_timeval_t *now, const char *key,
519
+ ares_dns_record_t **dnsrec_resp)
387
520
  {
388
- char *key = NULL;
389
521
  ares_qcache_entry_t *entry;
390
522
  ares_status_t status = ARES_SUCCESS;
391
523
 
392
- if (channel == NULL || dnsrec == NULL || dnsrec_resp == NULL) {
524
+ if (channel == NULL || key == NULL || dnsrec_resp == NULL) {
393
525
  return ARES_EFORMERR;
394
526
  }
395
527
 
528
+ *dnsrec_resp = NULL;
529
+
396
530
  if (channel->qcache == NULL) {
397
531
  return ARES_ENOTFOUND;
398
532
  }
399
533
 
400
534
  ares_qcache_expire(channel->qcache, now);
401
535
 
402
- key = ares_qcache_calc_key(dnsrec);
403
- if (key == NULL) {
404
- status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
405
- goto done; /* LCOV_EXCL_LINE: OutOfMemory */
406
- }
407
-
408
536
  entry = ares_htable_strvp_get_direct(channel->qcache->cache, key);
409
537
  if (entry == NULL) {
410
538
  status = ARES_ENOTFOUND;
@@ -414,17 +542,53 @@ ares_status_t ares_qcache_fetch(ares_channel_t *channel,
414
542
  ares_dns_record_ttl_decrement(entry->dnsrec,
415
543
  (unsigned int)(now->sec - entry->insert_ts));
416
544
 
417
- *dnsrec_resp = entry->dnsrec;
545
+ /* Hand back a copy the caller owns rather than the cache's own record.
546
+ * This is passed straight into an application callback, and that callback
547
+ * is allowed to re-enter c-ares. Any lookup it starts runs the expiry
548
+ * reaper first, and changing the server list flushes the cache outright --
549
+ * either would destroy this entry while the callback still held a pointer
550
+ * into it. Mirrors the ownership fix already made on the insert side. */
551
+ status = ares_dns_record_duplicate_ex(dnsrec_resp, entry->dnsrec);
552
+ if (status != ARES_SUCCESS) {
553
+ /* Could not hand back a private copy. Report a miss so the lookup falls
554
+ * through to a real query rather than failing outright: duplication
555
+ * writes and re-parses the record, so it can fail for reasons other than
556
+ * memory exhaustion, and none of them are a reason to fail a lookup that
557
+ * would have gone to a server a moment earlier. */
558
+ status = ARES_ENOTFOUND; /* LCOV_EXCL_LINE: UntestablePath */
559
+ goto done; /* LCOV_EXCL_LINE: UntestablePath */
560
+ }
418
561
 
419
562
  done:
420
- ares_free(key);
421
563
  return status;
422
564
  }
423
565
 
424
- ares_status_t ares_qcache_insert(ares_channel_t *channel,
425
- const ares_timeval_t *now,
426
- const ares_query_t *query,
427
- ares_dns_record_t *dnsrec)
566
+ ares_status_t ares_qcache_insert(ares_channel_t *channel,
567
+ const ares_timeval_t *now,
568
+ const ares_query_t *query,
569
+ const ares_dns_record_t *dnsrec)
428
570
  {
429
- return ares_qcache_insert_int(channel->qcache, dnsrec, query->query, now);
571
+ ares_dns_record_t *dupdns;
572
+ ares_status_t status;
573
+
574
+ /* Checked before the duplicate below, which is a full write and re-parse:
575
+ * no key means caching is switched off, so the copy would be thrown away.
576
+ * ares_init_options() always creates the cache object -- it is disabled by
577
+ * a zero maximum TTL, not by a NULL pointer -- so this is the only place
578
+ * the distinction is visible here. */
579
+ if (query->qcache_key == NULL) {
580
+ return ARES_ENOTIMP;
581
+ }
582
+
583
+ dupdns = ares_dns_record_duplicate(dnsrec);
584
+ if (dupdns == NULL) {
585
+ return ARES_ENOMEM;
586
+ }
587
+
588
+ status =
589
+ ares_qcache_insert_int(channel->qcache, dupdns, query->qcache_key, now);
590
+ if (status != ARES_SUCCESS) {
591
+ ares_dns_record_destroy(dupdns);
592
+ }
593
+ return status;
430
594
  }
@@ -125,7 +125,12 @@ ares_status_t ares_query_dnsrec(ares_channel_t *channel, const char *name,
125
125
  }
126
126
 
127
127
  ares_channel_lock(channel);
128
+ /* Notifications raised along the way are delivered once this whole call
129
+ * has unwound, not from inside the internals it runs. See
130
+ * ares_deferred_cb_enter(). */
131
+ ares_deferred_cb_enter(channel);
128
132
  status = ares_query_nolock(channel, name, dnsclass, type, callback, arg, qid);
133
+ ares_deferred_cb_leave(channel);
129
134
  ares_channel_unlock(channel);
130
135
  return status;
131
136
  }
@@ -463,7 +463,12 @@ void ares_search(ares_channel_t *channel, const char *name, int dnsclass,
463
463
  }
464
464
 
465
465
  ares_channel_lock(channel);
466
+ /* Notifications raised along the way are delivered once this whole call
467
+ * has unwound, not from inside the internals it runs. See
468
+ * ares_deferred_cb_enter(). */
469
+ ares_deferred_cb_enter(channel);
466
470
  ares_search_int(channel, dnsrec, ares_dnsrec_convert_cb, carg);
471
+ ares_deferred_cb_leave(channel);
467
472
  ares_channel_unlock(channel);
468
473
 
469
474
  ares_dns_record_destroy(dnsrec);
@@ -481,7 +486,12 @@ ares_status_t ares_search_dnsrec(ares_channel_t *channel,
481
486
  }
482
487
 
483
488
  ares_channel_lock(channel);
489
+ /* Notifications raised along the way are delivered once this whole call
490
+ * has unwound, not from inside the internals it runs. See
491
+ * ares_deferred_cb_enter(). */
492
+ ares_deferred_cb_enter(channel);
484
493
  status = ares_search_int(channel, dnsrec, callback, arg);
494
+ ares_deferred_cb_leave(channel);
485
495
  ares_channel_unlock(channel);
486
496
 
487
497
  return status;
@@ -111,11 +111,33 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
111
111
  ares_callback_dnsrec callback, void *arg,
112
112
  unsigned short *qid)
113
113
  {
114
- ares_query_t *query;
115
- ares_timeval_t now;
116
- ares_status_t status;
117
- unsigned short id = generate_unique_qid(channel);
118
- const ares_dns_record_t *dnsrec_resp = NULL;
114
+ ares_query_t *query;
115
+ ares_timeval_t now;
116
+ ares_status_t status;
117
+ unsigned short id = generate_unique_qid(channel);
118
+ ares_dns_record_t *dnsrec_resp = NULL;
119
+ char *qcache_key = NULL;
120
+
121
+ /* A channel being destroyed accepts no new queries. ares_destroy(3)
122
+ * documents that a callback must not add new requests to a channel being
123
+ * destroyed. Refuse it, but still notify: ARES_EDESTRUCTION is documented
124
+ * in ares_query(3), ares_send(3), ares_search(3) and ares_getaddrinfo(3) as
125
+ * a status delivered to the callback, and every caller frees its own
126
+ * context from there.
127
+ *
128
+ * Not notified if we are already inside such a notification: an application
129
+ * whose callback starts a replacement lookup on every invocation would
130
+ * otherwise re-enter here from within the callback without bound and
131
+ * exhaust the stack. At that depth it is already past the contract
132
+ * ares_destroy(3) documents. */
133
+ if (!channel->sys_up) {
134
+ if (!channel->in_shutdown_refusal) {
135
+ channel->in_shutdown_refusal = ARES_TRUE;
136
+ callback(arg, ARES_EDESTRUCTION, 0, NULL);
137
+ channel->in_shutdown_refusal = ARES_FALSE;
138
+ }
139
+ return ARES_EDESTRUCTION;
140
+ }
119
141
 
120
142
  ares_tvnow(&now);
121
143
 
@@ -124,13 +146,28 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
124
146
  return ARES_ENOSERVER;
125
147
  }
126
148
 
127
- if (!(flags & ARES_SEND_FLAG_NOCACHE)) {
149
+ /* Derive the cache key once, from the caller's request, and only when the
150
+ * cache is actually on. The send path may mutate query->query afterwards
151
+ * -- the EDNS fallback strips its OPT record -- and a key derived from it
152
+ * later would not match. ares_init_options() always creates the cache
153
+ * object, so a zero maximum TTL is what "off" means. */
154
+ if (channel->qcache_max_ttl > 0) {
155
+ qcache_key = ares_qcache_calc_key(dnsrec);
156
+ if (qcache_key == NULL) {
157
+ callback(arg, ARES_ENOMEM, 0, NULL); /* LCOV_EXCL_LINE: OutOfMemory */
158
+ return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
159
+ }
160
+ }
161
+
162
+ if (qcache_key != NULL && !(flags & ARES_SEND_FLAG_NOCACHE)) {
128
163
  /* Check query cache */
129
- status = ares_qcache_fetch(channel, &now, dnsrec, &dnsrec_resp);
164
+ status = ares_qcache_fetch(channel, &now, qcache_key, &dnsrec_resp);
130
165
  if (status != ARES_ENOTFOUND) {
131
166
  /* ARES_SUCCESS means we retrieved the cache, anything else is a critical
132
167
  * failure, all result in termination */
168
+ ares_free(qcache_key);
133
169
  callback(arg, status, 0, dnsrec_resp);
170
+ ares_dns_record_destroy(dnsrec_resp);
134
171
  return status;
135
172
  }
136
173
  }
@@ -138,19 +175,27 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
138
175
  /* Allocate space for query and allocated fields. */
139
176
  query = ares_malloc(sizeof(ares_query_t));
140
177
  if (!query) {
141
- callback(arg, ARES_ENOMEM, 0, NULL); /* LCOV_EXCL_LINE: OutOfMemory */
142
- return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
178
+ /* LCOV_EXCL_START: OutOfMemory */
179
+ ares_free(qcache_key);
180
+ callback(arg, ARES_ENOMEM, 0, NULL);
181
+ return ARES_ENOMEM;
182
+ /* LCOV_EXCL_STOP */
143
183
  }
144
184
  memset(query, 0, sizeof(*query));
145
185
 
146
186
  query->channel = channel;
147
187
  query->qid = id;
188
+ query->serial = ++channel->query_serial;
148
189
  query->timeout.sec = 0;
149
190
  query->timeout.usec = 0;
150
191
  query->using_tcp =
151
192
  (channel->flags & ARES_FLAG_USEVC) ? ARES_TRUE : ARES_FALSE;
152
193
 
153
194
  /* Duplicate Query */
195
+ /* The query adopts the key derived above; ares_free_query() releases it. */
196
+ query->qcache_key = qcache_key;
197
+ qcache_key = NULL;
198
+
154
199
  status = ares_dns_record_duplicate_ex(&query->query, dnsrec);
155
200
  if (status != ARES_SUCCESS) {
156
201
  /* Sometimes we might get a EBADRESP response from duplicate due to
@@ -158,7 +203,11 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
158
203
  if (status == ARES_EBADRESP) {
159
204
  status = ARES_EBADQUERY;
160
205
  }
161
- ares_free(query);
206
+ /* ares_free_query() rather than ares_free(): the query was zeroed above,
207
+ * so detaching finds every node NULL and the qid not yet registered, and
208
+ * it also releases qcache_key. Reachable without memory pressure -- a
209
+ * name that is not a valid hostname fails the duplicate. */
210
+ ares_free_query(query);
162
211
  callback(arg, status, 0, NULL);
163
212
  return status;
164
213
  }
@@ -209,6 +258,12 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
209
258
  */
210
259
  if (!ares_htable_szvp_insert(channel->queries_by_qid, query->qid, query)) {
211
260
  /* LCOV_EXCL_START: OutOfMemory */
261
+ /* The query is already chained into all_queries, so a reentrant
262
+ * ares_cancel() from the callback below would find it, run the
263
+ * application callback a second time for one lookup, and free it -- and
264
+ * the ares_free_query() here would then double-free. Same ordering as
265
+ * ares_cancel() and ares_destroy(): unlink first, notify second. */
266
+ ares_detach_query(query);
212
267
  callback(arg, ARES_ENOMEM, 0, NULL);
213
268
  ares_free_query(query);
214
269
  return ARES_ENOMEM;
@@ -217,10 +272,21 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
217
272
 
218
273
  /* Perform the first query action. */
219
274
 
275
+ /* Sending opens and writes to connections and can mark a server down, both
276
+ * of which notify. This bracket keeps any connection or server unlinked
277
+ * during the send readable until it returns. It is never the outermost
278
+ * one: every public entry point that can get here, and query processing,
279
+ * holds its own, so delivery waits until the caller -- which may still be
280
+ * holding its own lookup state, as ares_getaddrinfo() does -- has unwound
281
+ * too. */
282
+ ares_deferred_cb_enter(channel);
220
283
  status = ares_send_query(server, query, &now);
284
+ ares_deferred_cb_leave(channel);
285
+
221
286
  if (status == ARES_SUCCESS && qid) {
222
287
  *qid = id;
223
288
  }
289
+
224
290
  return status;
225
291
  }
226
292
 
@@ -236,9 +302,14 @@ ares_status_t ares_send_dnsrec(ares_channel_t *channel,
236
302
  }
237
303
 
238
304
  ares_channel_lock(channel);
305
+ /* Notifications raised along the way are delivered once this whole call
306
+ * has unwound, not from inside the internals it runs. See
307
+ * ares_deferred_cb_enter(). */
308
+ ares_deferred_cb_enter(channel);
239
309
 
240
310
  status = ares_send_nolock(channel, NULL, 0, dnsrec, callback, arg, qid);
241
311
 
312
+ ares_deferred_cb_leave(channel);
242
313
  ares_channel_unlock(channel);
243
314
 
244
315
  return status;
@@ -61,7 +61,7 @@
61
61
  # define TFO_USE_SENDTO 0
62
62
  # define TFO_USE_CONNECTX 0
63
63
  # define TFO_CLIENT_SOCKOPT TCP_FASTOPEN_CONNECT
64
- #elif defined(__FreeBSD__) && defined(TCP_FASTOPEN)
64
+ #elif (defined(__MidnightBSD__) || defined(__FreeBSD__)) && defined(TCP_FASTOPEN)
65
65
  # define TFO_SUPPORTED 1
66
66
  # define TFO_SKIP_CONNECT 1
67
67
  # define TFO_USE_SENDTO 1
@@ -127,6 +127,8 @@ ares_status_t
127
127
  channel->sock_funcs.asendto = funcs->asendto;
128
128
  channel->sock_funcs.agetsockname = funcs->agetsockname;
129
129
  channel->sock_funcs.abind = funcs->abind;
130
+ channel->sock_funcs.aif_nametoindex = funcs->aif_nametoindex;
131
+ channel->sock_funcs.aif_indextoname = funcs->aif_indextoname;
130
132
  }
131
133
 
132
134
  /* Implement newer versions here ...*/
@@ -127,6 +127,32 @@ ares_bool_t ares_sockaddr_addr_eq(const struct sockaddr *sa,
127
127
  return ARES_FALSE; /* different */
128
128
  }
129
129
 
130
+ ares_bool_t ares_sockaddr_addr_port_eq(const struct sockaddr *sa,
131
+ const struct ares_addr *aa,
132
+ unsigned short port)
133
+ {
134
+ unsigned short sa_port;
135
+
136
+ if (!ares_sockaddr_addr_eq(sa, aa)) {
137
+ return ARES_FALSE;
138
+ }
139
+
140
+ /* ares_sockaddr_addr_eq() only matches AF_INET and AF_INET6 */
141
+ if (sa->sa_family == AF_INET) {
142
+ sa_port = (CARES_INADDR_CAST(const struct sockaddr_in *, sa))->sin_port;
143
+ } else {
144
+ sa_port = (CARES_INADDR_CAST(const struct sockaddr_in6 *, sa))->sin6_port;
145
+ }
146
+
147
+ /* A port of 0 means the source port was not reported, so only the address
148
+ * can be checked. */
149
+ if (sa_port != 0 && ntohs(sa_port) != port) {
150
+ return ARES_FALSE;
151
+ }
152
+
153
+ return ARES_TRUE;
154
+ }
155
+
130
156
  ares_conn_err_t ares_socket_write(ares_channel_t *channel, ares_socket_t fd,
131
157
  const void *data, size_t len, size_t *written,
132
158
  const struct sockaddr *sa,
@@ -188,6 +214,8 @@ ares_conn_err_t ares_socket_recvfrom(ares_channel_t *channel, ares_socket_t s,
188
214
  {
189
215
  ares_ssize_t rv;
190
216
 
217
+ *read_bytes = 0;
218
+
191
219
  rv = channel->sock_funcs.arecvfrom(s, data, data_len, flags, from, from_len,
192
220
  channel->sock_func_cb_data);
193
221
 
@@ -139,8 +139,31 @@ typedef enum {
139
139
  ARES_CONN_ERR_FAILURE = 99 /*!< Generic failure */
140
140
  } ares_conn_err_t;
141
141
 
142
+ /*! Compare the IP address of a socket address with an ares_addr. The port
143
+ * in the socket address is ignored.
144
+ *
145
+ * \param[in] sa Socket address (AF_INET or AF_INET6)
146
+ * \param[in] aa Address to compare against
147
+ * \return ARES_TRUE if the address families and IP addresses are equal,
148
+ * ARES_FALSE otherwise
149
+ */
142
150
  ares_bool_t ares_sockaddr_addr_eq(const struct sockaddr *sa,
143
151
  const struct ares_addr *aa);
152
+
153
+ /*! Compare the IP address and port of a socket address with an ares_addr and
154
+ * port. A port of 0 in the socket address means the port is unknown, so it
155
+ * matches any port.
156
+ *
157
+ * \param[in] sa Socket address (AF_INET or AF_INET6)
158
+ * \param[in] aa Address to compare against
159
+ * \param[in] port Port to compare against, in host byte order
160
+ * \return ARES_TRUE if the address families and IP addresses are equal and
161
+ * the ports are equal or the socket address port is 0, ARES_FALSE
162
+ * otherwise
163
+ */
164
+ ares_bool_t ares_sockaddr_addr_port_eq(const struct sockaddr *sa,
165
+ const struct ares_addr *aa,
166
+ unsigned short port);
144
167
  ares_status_t ares_socket_configure(ares_channel_t *channel, int family,
145
168
  ares_bool_t is_tcp, ares_socket_t fd);
146
169
  ares_conn_err_t ares_socket_enable_tfo(const ares_channel_t *channel,
@@ -218,13 +218,16 @@ static ares_status_t ares_init_sysconfig_android(const ares_channel_t *channel,
218
218
  status = ares_sconfig_append_fromstr(channel, &sysconfig->sconfig,
219
219
  dns_servers[i], ARES_TRUE);
220
220
  if (status != ARES_SUCCESS) {
221
- return status;
221
+ break;
222
222
  }
223
223
  }
224
224
  for (i = 0; i < num_servers; i++) {
225
225
  ares_free(dns_servers[i]);
226
226
  }
227
227
  ares_free(dns_servers);
228
+ if (status != ARES_SUCCESS) {
229
+ return status;
230
+ }
228
231
  }
229
232
 
230
233
  domains = ares_get_android_search_domains_list();
@@ -273,7 +276,7 @@ static ares_status_t
273
276
  * 3. if confstr(_CS_DOMAIN, ...) this is the domain name. Use this as
274
277
  * preference over anything else found.
275
278
  */
276
- ares_buf_t *buf = ares_buf_create();
279
+ ares_buf_t *buf = NULL;
277
280
  unsigned char *data = NULL;
278
281
  size_t data_size = 0;
279
282
  ares_bool_t process_resolvconf = ARES_TRUE;
@@ -330,7 +333,7 @@ static ares_status_t
330
333
  char domain[256];
331
334
  size_t domain_len;
332
335
 
333
- domain_len = confstr(_CS_DOMAIN, domain, sizeof(domain_len));
336
+ domain_len = confstr(_CS_DOMAIN, domain, sizeof(domain));
334
337
  if (domain_len != 0) {
335
338
  ares_strsplit_free(sysconfig->domains, sysconfig->ndomains);
336
339
  sysconfig->domains = ares_strsplit(domain, ", ", &sysconfig->ndomains);