grpc 1.23.0 → 1.24.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +765 -485
  3. data/include/grpc/grpc.h +3 -1
  4. data/include/grpc/grpc_security.h +20 -4
  5. data/include/grpc/impl/codegen/grpc_types.h +6 -5
  6. data/include/grpc/impl/codegen/port_platform.h +25 -0
  7. data/src/core/ext/filters/client_channel/backend_metric.cc +78 -0
  8. data/src/core/ext/filters/client_channel/backend_metric.h +36 -0
  9. data/src/core/ext/filters/client_channel/channel_connectivity.cc +16 -2
  10. data/src/core/ext/filters/client_channel/client_channel.cc +325 -267
  11. data/src/core/ext/filters/client_channel/client_channel_factory.h +0 -4
  12. data/src/core/ext/filters/client_channel/health/health_check_client.cc +23 -32
  13. data/src/core/ext/filters/client_channel/http_proxy.cc +7 -3
  14. data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
  15. data/src/core/ext/filters/client_channel/lb_policy.h +58 -34
  16. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +46 -50
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +9 -2
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +35 -17
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +130 -215
  20. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +34 -21
  21. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +1120 -802
  22. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +8 -2
  23. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +33 -12
  24. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc +151 -40
  25. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h +184 -26
  26. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +389 -245
  27. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +98 -60
  28. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +6 -1
  29. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +89 -0
  30. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +3 -8
  31. data/src/core/ext/filters/client_channel/server_address.cc +1 -3
  32. data/src/core/ext/filters/client_channel/server_address.h +1 -1
  33. data/src/core/ext/filters/client_channel/subchannel.h +2 -1
  34. data/src/core/ext/filters/client_idle/client_idle_filter.cc +207 -29
  35. data/src/core/ext/filters/http/client/http_client_filter.cc +10 -8
  36. data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
  37. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +10 -7
  38. data/src/core/ext/filters/http/server/http_server_filter.cc +52 -26
  39. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +23 -20
  40. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +24 -21
  41. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
  42. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +37 -24
  43. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  44. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +237 -191
  45. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +29 -27
  46. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +1 -1
  47. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +19 -4
  48. data/src/core/ext/transport/chttp2/transport/hpack_table.h +13 -4
  49. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +2 -1
  50. data/src/core/ext/transport/chttp2/transport/internal.h +0 -2
  51. data/src/core/ext/transport/chttp2/transport/parsing.cc +99 -71
  52. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +222 -0
  53. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +818 -0
  54. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +314 -0
  55. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1142 -0
  56. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +53 -0
  57. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +158 -0
  58. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +34 -0
  59. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +69 -0
  60. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +49 -0
  61. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +240 -0
  62. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +110 -0
  63. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +324 -0
  64. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +235 -0
  65. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +661 -0
  66. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +84 -0
  67. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +274 -0
  68. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +175 -0
  69. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +572 -0
  70. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +150 -0
  71. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +596 -0
  72. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +35 -0
  73. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +80 -0
  74. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +95 -0
  75. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +308 -0
  76. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +128 -0
  77. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +392 -0
  78. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +91 -0
  79. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +236 -0
  80. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +88 -0
  81. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +258 -0
  82. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +111 -0
  83. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +324 -0
  84. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +23 -0
  85. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +50 -0
  86. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +52 -0
  87. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +130 -0
  88. data/src/core/ext/upb-generated/envoy/type/percent.upb.c +39 -0
  89. data/src/core/ext/upb-generated/envoy/type/percent.upb.h +87 -0
  90. data/src/core/ext/upb-generated/envoy/type/range.upb.c +39 -0
  91. data/src/core/ext/upb-generated/envoy/type/range.upb.h +85 -0
  92. data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +17 -0
  93. data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +30 -0
  94. data/src/core/ext/upb-generated/google/api/annotations.upb.c +18 -0
  95. data/src/core/ext/upb-generated/google/api/annotations.upb.h +30 -0
  96. data/src/core/ext/upb-generated/google/api/http.upb.c +66 -0
  97. data/src/core/ext/upb-generated/google/api/http.upb.h +190 -0
  98. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +27 -0
  99. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +58 -0
  100. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +485 -0
  101. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1690 -0
  102. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +27 -0
  103. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +58 -0
  104. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +22 -0
  105. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +50 -0
  106. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +79 -0
  107. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +215 -0
  108. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +27 -0
  109. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +58 -0
  110. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +106 -0
  111. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +238 -0
  112. data/src/core/ext/upb-generated/google/rpc/status.upb.c +33 -0
  113. data/src/core/ext/upb-generated/google/rpc/status.upb.h +74 -0
  114. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +49 -0
  115. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +126 -0
  116. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +209 -0
  117. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +681 -0
  118. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +42 -0
  119. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +109 -0
  120. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +36 -0
  121. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +84 -0
  122. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +133 -0
  123. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +359 -0
  124. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +58 -0
  125. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +144 -0
  126. data/src/core/ext/upb-generated/validate/validate.upb.c +443 -0
  127. data/src/core/ext/upb-generated/validate/validate.upb.h +2037 -0
  128. data/src/core/lib/channel/channel_args.cc +21 -0
  129. data/src/core/lib/channel/channel_args.h +16 -2
  130. data/src/core/lib/channel/channel_stack.h +2 -1
  131. data/src/core/lib/channel/channelz.cc +54 -56
  132. data/src/core/lib/channel/channelz.h +29 -12
  133. data/src/core/lib/compression/compression.cc +2 -1
  134. data/src/core/lib/compression/compression_internal.h +8 -0
  135. data/src/core/lib/gpr/log_linux.cc +2 -2
  136. data/src/core/lib/gpr/log_posix.cc +2 -2
  137. data/src/core/lib/gpr/time_precise.cc +123 -36
  138. data/src/core/lib/gpr/time_precise.h +37 -0
  139. data/src/core/lib/gprpp/abstract.h +10 -0
  140. data/src/core/lib/gprpp/atomic.h +4 -0
  141. data/src/core/lib/gprpp/inlined_vector.h +20 -4
  142. data/src/core/lib/gprpp/map.h +109 -6
  143. data/src/core/lib/gprpp/memory.h +6 -0
  144. data/src/core/lib/gprpp/ref_counted_ptr.h +2 -0
  145. data/src/core/lib/iomgr/ev_epollex_linux.cc +29 -54
  146. data/src/core/lib/iomgr/exec_ctx.cc +27 -17
  147. data/src/core/lib/iomgr/exec_ctx.h +3 -0
  148. data/src/core/lib/iomgr/sockaddr_utils.cc +1 -3
  149. data/src/core/lib/iomgr/tcp_posix.cc +16 -25
  150. data/src/core/lib/iomgr/tcp_server_custom.cc +1 -1
  151. data/src/core/lib/iomgr/timer_manager.cc +8 -1
  152. data/src/core/lib/iomgr/timer_manager.h +2 -0
  153. data/src/core/lib/security/credentials/credentials.h +8 -2
  154. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -0
  155. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -0
  156. data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +3 -3
  157. data/src/core/lib/security/security_connector/ssl_utils.cc +1 -12
  158. data/src/core/lib/security/security_connector/ssl_utils.h +10 -6
  159. data/src/core/lib/security/security_connector/ssl_utils_config.cc +32 -0
  160. data/src/core/lib/security/security_connector/ssl_utils_config.h +30 -0
  161. data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +161 -49
  162. data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +34 -1
  163. data/src/core/lib/slice/slice_intern.cc +17 -9
  164. data/src/core/lib/slice/slice_internal.h +34 -7
  165. data/src/core/lib/slice/slice_utils.h +7 -3
  166. data/src/core/lib/surface/call.cc +97 -57
  167. data/src/core/lib/surface/channel.cc +2 -2
  168. data/src/core/lib/surface/completion_queue.cc +10 -16
  169. data/src/core/lib/surface/init.cc +3 -0
  170. data/src/core/lib/surface/server.cc +11 -14
  171. data/src/core/lib/surface/validate_metadata.cc +4 -0
  172. data/src/core/lib/surface/version.cc +2 -2
  173. data/src/core/lib/transport/metadata.cc +4 -4
  174. data/src/core/lib/transport/metadata_batch.cc +72 -16
  175. data/src/core/lib/transport/metadata_batch.h +38 -0
  176. data/src/core/lib/transport/static_metadata.cc +814 -1023
  177. data/src/core/lib/transport/static_metadata.h +271 -213
  178. data/src/core/lib/transport/transport.h +12 -0
  179. data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
  180. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +104 -76
  181. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +34 -16
  182. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +2 -2
  183. data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +10 -6
  184. data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +4 -3
  185. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +74 -48
  186. data/src/core/tsi/alts/handshaker/transport_security_common_api.h +34 -26
  187. data/src/core/tsi/ssl_transport_security.cc +14 -6
  188. data/src/core/tsi/ssl_transport_security.h +4 -0
  189. data/src/ruby/ext/grpc/ext-export.clang +1 -0
  190. data/src/ruby/ext/grpc/ext-export.gcc +6 -0
  191. data/src/ruby/ext/grpc/extconf.rb +5 -0
  192. data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
  193. data/src/ruby/ext/grpc/rb_grpc.c +1 -42
  194. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  195. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  196. data/src/ruby/lib/grpc.rb +2 -0
  197. data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
  198. data/src/ruby/lib/grpc/errors.rb +4 -7
  199. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +9 -4
  200. data/src/ruby/lib/grpc/structs.rb +15 -0
  201. data/src/ruby/lib/grpc/version.rb +1 -1
  202. data/src/ruby/spec/errors_spec.rb +1 -0
  203. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
  204. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +34 -0
  205. data/src/ruby/spec/pb/codegen/package_option_spec.rb +53 -29
  206. data/third_party/upb/upb/decode.c +604 -0
  207. data/third_party/upb/upb/decode.h +21 -0
  208. data/third_party/upb/upb/encode.c +378 -0
  209. data/third_party/upb/upb/encode.h +21 -0
  210. data/third_party/upb/upb/generated_util.h +105 -0
  211. data/third_party/upb/upb/msg.c +111 -0
  212. data/third_party/upb/upb/msg.h +69 -0
  213. data/third_party/upb/upb/port.c +27 -0
  214. data/third_party/upb/upb/port_def.inc +152 -0
  215. data/third_party/upb/upb/port_undef.inc +21 -0
  216. data/third_party/upb/upb/table.c +911 -0
  217. data/third_party/upb/upb/table.int.h +507 -0
  218. data/third_party/upb/upb/upb.c +261 -0
  219. data/third_party/upb/upb/upb.h +364 -0
  220. metadata +129 -50
  221. data/src/core/ext/filters/client_channel/health/health.pb.c +0 -23
  222. data/src/core/ext/filters/client_channel/health/health.pb.h +0 -73
  223. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +0 -19
  224. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +0 -54
  225. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +0 -19
  226. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +0 -54
  227. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +0 -89
  228. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -164
  229. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +0 -520
  230. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +0 -323
  231. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +0 -145
  232. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +0 -149
  233. data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -47
  234. data/src/core/tsi/alts/handshaker/altscontext.pb.h +0 -63
  235. data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -122
  236. data/src/core/tsi/alts/handshaker/handshaker.pb.h +0 -254
  237. data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -49
  238. data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +0 -78
  239. data/third_party/nanopb/pb.h +0 -579
  240. data/third_party/nanopb/pb_common.c +0 -97
  241. data/third_party/nanopb/pb_common.h +0 -42
  242. data/third_party/nanopb/pb_decode.c +0 -1347
  243. data/third_party/nanopb/pb_decode.h +0 -149
  244. data/third_party/nanopb/pb_encode.c +0 -696
  245. data/third_party/nanopb/pb_encode.h +0 -154
@@ -0,0 +1,30 @@
1
+ /*
2
+ *
3
+ * Copyright 2019 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H
20
+ #define GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H
21
+
22
+ #include <grpc/support/port_platform.h>
23
+
24
+ #include "src/core/lib/gprpp/global_config.h"
25
+
26
+ GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_default_ssl_roots_file_path);
27
+ GPR_GLOBAL_CONFIG_DECLARE_BOOL(grpc_not_use_system_ssl_roots);
28
+
29
+ #endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H \
30
+ */
@@ -38,6 +38,8 @@
38
38
  #include "src/core/tsi/ssl_transport_security.h"
39
39
  #include "src/core/tsi/transport_security.h"
40
40
 
41
+ namespace grpc_core {
42
+
41
43
  namespace {
42
44
 
43
45
  tsi_ssl_pem_key_cert_pair* ConvertToTsiPemKeyCertPair(
@@ -58,42 +60,55 @@ tsi_ssl_pem_key_cert_pair* ConvertToTsiPemKeyCertPair(
58
60
  return tsi_pairs;
59
61
  }
60
62
 
61
- /** -- Util function to populate SPIFFE server/channel credentials. -- */
62
- grpc_core::RefCountedPtr<grpc_tls_key_materials_config>
63
- PopulateSpiffeCredentials(const grpc_tls_credentials_options& options) {
64
- GPR_ASSERT(options.credential_reload_config() != nullptr ||
65
- options.key_materials_config() != nullptr);
66
- grpc_core::RefCountedPtr<grpc_tls_key_materials_config> key_materials_config;
63
+ } // namespace
64
+
65
+ /** -- Util function to fetch SPIFFE server/channel credentials. -- */
66
+ grpc_status_code TlsFetchKeyMaterials(
67
+ const grpc_core::RefCountedPtr<grpc_tls_key_materials_config>&
68
+ key_materials_config,
69
+ const grpc_tls_credentials_options& options,
70
+ grpc_ssl_certificate_config_reload_status* reload_status) {
71
+ GPR_ASSERT(key_materials_config != nullptr);
72
+ bool is_key_materials_empty =
73
+ key_materials_config->pem_key_cert_pair_list().empty();
74
+ if (options.credential_reload_config() == nullptr && is_key_materials_empty) {
75
+ gpr_log(GPR_ERROR,
76
+ "Either credential reload config or key materials should be "
77
+ "provisioned.");
78
+ return GRPC_STATUS_FAILED_PRECONDITION;
79
+ }
80
+ grpc_status_code status = GRPC_STATUS_OK;
67
81
  /* Use credential reload config to fetch credentials. */
68
82
  if (options.credential_reload_config() != nullptr) {
69
83
  grpc_tls_credential_reload_arg* arg =
70
84
  grpc_core::New<grpc_tls_credential_reload_arg>();
71
- key_materials_config = grpc_tls_key_materials_config_create()->Ref();
72
85
  arg->key_materials_config = key_materials_config.get();
73
86
  int result = options.credential_reload_config()->Schedule(arg);
74
87
  if (result) {
75
88
  /* Do not support async credential reload. */
76
89
  gpr_log(GPR_ERROR, "Async credential reload is unsupported now.");
90
+ status =
91
+ is_key_materials_empty ? GRPC_STATUS_UNIMPLEMENTED : GRPC_STATUS_OK;
77
92
  } else {
78
- grpc_ssl_certificate_config_reload_status status = arg->status;
79
- if (status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED) {
93
+ GPR_ASSERT(reload_status != nullptr);
94
+ *reload_status = arg->status;
95
+ if (arg->status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED) {
96
+ /* Key materials is not empty. */
80
97
  gpr_log(GPR_DEBUG, "Credential does not change after reload.");
81
- } else if (status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL) {
82
- gpr_log(GPR_ERROR, "Credential reload failed with an error: %s",
83
- arg->error_details);
98
+ } else if (arg->status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL) {
99
+ gpr_log(GPR_ERROR, "Credential reload failed with an error:");
100
+ if (arg->error_details != nullptr) {
101
+ gpr_log(GPR_ERROR, "%s", arg->error_details);
102
+ }
103
+ status = is_key_materials_empty ? GRPC_STATUS_INTERNAL : GRPC_STATUS_OK;
84
104
  }
85
105
  }
86
106
  gpr_free((void*)arg->error_details);
87
107
  grpc_core::Delete(arg);
88
- /* Use existing key materials config. */
89
- } else {
90
- key_materials_config = options.key_materials_config()->Ref();
91
108
  }
92
- return key_materials_config;
109
+ return status;
93
110
  }
94
111
 
95
- } // namespace
96
-
97
112
  SpiffeChannelSecurityConnector::SpiffeChannelSecurityConnector(
98
113
  grpc_core::RefCountedPtr<grpc_channel_credentials> channel_creds,
99
114
  grpc_core::RefCountedPtr<grpc_call_credentials> request_metadata_creds,
@@ -104,6 +119,7 @@ SpiffeChannelSecurityConnector::SpiffeChannelSecurityConnector(
104
119
  overridden_target_name_(overridden_target_name == nullptr
105
120
  ? nullptr
106
121
  : gpr_strdup(overridden_target_name)) {
122
+ key_materials_config_ = grpc_tls_key_materials_config_create()->Ref();
107
123
  check_arg_ = ServerAuthorizationCheckArgCreate(this);
108
124
  grpc_core::StringView host;
109
125
  grpc_core::StringView port;
@@ -115,12 +131,19 @@ SpiffeChannelSecurityConnector::~SpiffeChannelSecurityConnector() {
115
131
  if (client_handshaker_factory_ != nullptr) {
116
132
  tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
117
133
  }
134
+ if (key_materials_config_.get() != nullptr) {
135
+ key_materials_config_.get()->Unref();
136
+ }
118
137
  ServerAuthorizationCheckArgDestroy(check_arg_);
119
138
  }
120
139
 
121
140
  void SpiffeChannelSecurityConnector::add_handshakers(
122
141
  grpc_pollset_set* interested_parties,
123
142
  grpc_core::HandshakeManager* handshake_mgr) {
143
+ if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) {
144
+ gpr_log(GPR_ERROR, "Handshaker factory refresh failed.");
145
+ return;
146
+ }
124
147
  // Instantiate TSI handshaker.
125
148
  tsi_handshaker* tsi_hs = nullptr;
126
149
  tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker(
@@ -239,32 +262,75 @@ SpiffeChannelSecurityConnector::CreateSpiffeChannelSecurityConnector(
239
262
  std::move(channel_creds), std::move(request_metadata_creds),
240
263
  target_name, overridden_target_name);
241
264
  if (c->InitializeHandshakerFactory(ssl_session_cache) != GRPC_SECURITY_OK) {
265
+ gpr_log(GPR_ERROR, "Could not initialize client handshaker factory.");
242
266
  return nullptr;
243
267
  }
244
268
  return c;
245
269
  }
246
270
 
247
- grpc_security_status
248
- SpiffeChannelSecurityConnector::InitializeHandshakerFactory(
271
+ grpc_security_status SpiffeChannelSecurityConnector::ReplaceHandshakerFactory(
249
272
  tsi_ssl_session_cache* ssl_session_cache) {
250
- const SpiffeCredentials* creds =
251
- static_cast<const SpiffeCredentials*>(channel_creds());
252
- auto key_materials_config = PopulateSpiffeCredentials(creds->options());
253
- if (key_materials_config->pem_key_cert_pair_list().empty()) {
254
- key_materials_config->Unref();
255
- return GRPC_SECURITY_ERROR;
273
+ /* Free the client handshaker factory if exists. */
274
+ if (client_handshaker_factory_) {
275
+ tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
256
276
  }
277
+ GPR_ASSERT(!key_materials_config_->pem_key_cert_pair_list().empty());
257
278
  tsi_ssl_pem_key_cert_pair* pem_key_cert_pair = ConvertToTsiPemKeyCertPair(
258
- key_materials_config->pem_key_cert_pair_list());
279
+ key_materials_config_->pem_key_cert_pair_list());
259
280
  grpc_security_status status = grpc_ssl_tsi_client_handshaker_factory_init(
260
- pem_key_cert_pair, key_materials_config->pem_root_certs(),
281
+ pem_key_cert_pair, key_materials_config_->pem_root_certs(),
261
282
  ssl_session_cache, &client_handshaker_factory_);
262
- // Free memory.
263
- key_materials_config->Unref();
283
+ /* Free memory. */
264
284
  grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pair, 1);
265
285
  return status;
266
286
  }
267
287
 
288
+ grpc_security_status
289
+ SpiffeChannelSecurityConnector::InitializeHandshakerFactory(
290
+ tsi_ssl_session_cache* ssl_session_cache) {
291
+ grpc_core::MutexLock lock(&mu_);
292
+ const SpiffeCredentials* creds =
293
+ static_cast<const SpiffeCredentials*>(channel_creds());
294
+ grpc_tls_key_materials_config* key_materials_config =
295
+ creds->options().key_materials_config();
296
+ /* Copy key materials config from credential options. */
297
+ if (key_materials_config != nullptr) {
298
+ grpc_tls_key_materials_config::PemKeyCertPairList cert_pair_list =
299
+ key_materials_config->pem_key_cert_pair_list();
300
+ auto pem_root_certs = grpc_core::UniquePtr<char>(
301
+ gpr_strdup(key_materials_config->pem_root_certs()));
302
+ key_materials_config_->set_key_materials(std::move(pem_root_certs),
303
+ std::move(cert_pair_list));
304
+ }
305
+ grpc_ssl_certificate_config_reload_status reload_status =
306
+ GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
307
+ if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
308
+ &reload_status) != GRPC_STATUS_OK) {
309
+ /* Raise an error if key materials are not populated. */
310
+ return GRPC_SECURITY_ERROR;
311
+ }
312
+ return ReplaceHandshakerFactory(ssl_session_cache);
313
+ }
314
+
315
+ grpc_security_status
316
+ SpiffeChannelSecurityConnector::RefreshHandshakerFactory() {
317
+ grpc_core::MutexLock lock(&mu_);
318
+ const SpiffeCredentials* creds =
319
+ static_cast<const SpiffeCredentials*>(channel_creds());
320
+ grpc_ssl_certificate_config_reload_status reload_status =
321
+ GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
322
+ if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
323
+ &reload_status) != GRPC_STATUS_OK) {
324
+ return GRPC_SECURITY_ERROR;
325
+ }
326
+ if (reload_status != GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW) {
327
+ // Re-use existing handshaker factory.
328
+ return GRPC_SECURITY_OK;
329
+ } else {
330
+ return ReplaceHandshakerFactory(nullptr);
331
+ }
332
+ }
333
+
268
334
  void SpiffeChannelSecurityConnector::ServerAuthorizationCheckDone(
269
335
  grpc_tls_server_authorization_check_arg* arg) {
270
336
  GPR_ASSERT(arg != nullptr);
@@ -332,19 +398,28 @@ void SpiffeChannelSecurityConnector::ServerAuthorizationCheckArgDestroy(
332
398
  SpiffeServerSecurityConnector::SpiffeServerSecurityConnector(
333
399
  grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
334
400
  : grpc_server_security_connector(GRPC_SSL_URL_SCHEME,
335
- std::move(server_creds)) {}
401
+ std::move(server_creds)) {
402
+ key_materials_config_ = grpc_tls_key_materials_config_create()->Ref();
403
+ }
336
404
 
337
405
  SpiffeServerSecurityConnector::~SpiffeServerSecurityConnector() {
338
406
  if (server_handshaker_factory_ != nullptr) {
339
407
  tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
340
408
  }
409
+ if (key_materials_config_.get() != nullptr) {
410
+ key_materials_config_.get()->Unref();
411
+ }
341
412
  }
342
413
 
343
414
  void SpiffeServerSecurityConnector::add_handshakers(
344
415
  grpc_pollset_set* interested_parties,
345
416
  grpc_core::HandshakeManager* handshake_mgr) {
417
+ /* Refresh handshaker factory if needed. */
418
+ if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) {
419
+ gpr_log(GPR_ERROR, "Handshaker factory refresh failed.");
420
+ return;
421
+ }
346
422
  /* Create a TLS SPIFFE TSI handshaker for server. */
347
- RefreshServerHandshakerFactory();
348
423
  tsi_handshaker* tsi_hs = nullptr;
349
424
  tsi_result result = tsi_ssl_server_handshaker_factory_create_handshaker(
350
425
  server_handshaker_factory_, &tsi_hs);
@@ -384,39 +459,76 @@ SpiffeServerSecurityConnector::CreateSpiffeServerSecurityConnector(
384
459
  grpc_core::RefCountedPtr<SpiffeServerSecurityConnector> c =
385
460
  grpc_core::MakeRefCounted<SpiffeServerSecurityConnector>(
386
461
  std::move(server_creds));
387
- if (c->RefreshServerHandshakerFactory() != GRPC_SECURITY_OK) {
462
+ if (c->InitializeHandshakerFactory() != GRPC_SECURITY_OK) {
463
+ gpr_log(GPR_ERROR, "Could not initialize server handshaker factory.");
388
464
  return nullptr;
389
465
  }
390
466
  return c;
391
467
  }
392
468
 
393
- grpc_security_status
394
- SpiffeServerSecurityConnector::RefreshServerHandshakerFactory() {
469
+ grpc_security_status SpiffeServerSecurityConnector::ReplaceHandshakerFactory() {
395
470
  const SpiffeServerCredentials* creds =
396
471
  static_cast<const SpiffeServerCredentials*>(server_creds());
397
- auto key_materials_config = PopulateSpiffeCredentials(creds->options());
398
- /* Credential reload does NOT take effect and we need to keep using
399
- * the existing handshaker factory. */
400
- if (key_materials_config->pem_key_cert_pair_list().empty()) {
401
- key_materials_config->Unref();
402
- return GRPC_SECURITY_ERROR;
403
- }
404
- /* Credential reload takes effect and we need to free the existing
405
- * handshaker library. */
472
+ /* Free the server handshaker factory if exists. */
406
473
  if (server_handshaker_factory_) {
407
474
  tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
408
475
  }
476
+ GPR_ASSERT(!key_materials_config_->pem_key_cert_pair_list().empty());
409
477
  tsi_ssl_pem_key_cert_pair* pem_key_cert_pairs = ConvertToTsiPemKeyCertPair(
410
- key_materials_config->pem_key_cert_pair_list());
478
+ key_materials_config_->pem_key_cert_pair_list());
411
479
  size_t num_key_cert_pairs =
412
- key_materials_config->pem_key_cert_pair_list().size();
480
+ key_materials_config_->pem_key_cert_pair_list().size();
413
481
  grpc_security_status status = grpc_ssl_tsi_server_handshaker_factory_init(
414
482
  pem_key_cert_pairs, num_key_cert_pairs,
415
- key_materials_config->pem_root_certs(),
483
+ key_materials_config_->pem_root_certs(),
416
484
  creds->options().cert_request_type(), &server_handshaker_factory_);
417
- // Free memory.
418
- key_materials_config->Unref();
485
+ /* Free memory. */
419
486
  grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pairs,
420
487
  num_key_cert_pairs);
421
488
  return status;
422
489
  }
490
+
491
+ grpc_security_status
492
+ SpiffeServerSecurityConnector::InitializeHandshakerFactory() {
493
+ grpc_core::MutexLock lock(&mu_);
494
+ const SpiffeServerCredentials* creds =
495
+ static_cast<const SpiffeServerCredentials*>(server_creds());
496
+ grpc_tls_key_materials_config* key_materials_config =
497
+ creds->options().key_materials_config();
498
+ if (key_materials_config != nullptr) {
499
+ grpc_tls_key_materials_config::PemKeyCertPairList cert_pair_list =
500
+ key_materials_config->pem_key_cert_pair_list();
501
+ auto pem_root_certs = grpc_core::UniquePtr<char>(
502
+ gpr_strdup(key_materials_config->pem_root_certs()));
503
+ key_materials_config_->set_key_materials(std::move(pem_root_certs),
504
+ std::move(cert_pair_list));
505
+ }
506
+ grpc_ssl_certificate_config_reload_status reload_status =
507
+ GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
508
+ if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
509
+ &reload_status) != GRPC_STATUS_OK) {
510
+ /* Raise an error if key materials are not populated. */
511
+ return GRPC_SECURITY_ERROR;
512
+ }
513
+ return ReplaceHandshakerFactory();
514
+ }
515
+
516
+ grpc_security_status SpiffeServerSecurityConnector::RefreshHandshakerFactory() {
517
+ grpc_core::MutexLock lock(&mu_);
518
+ const SpiffeServerCredentials* creds =
519
+ static_cast<const SpiffeServerCredentials*>(server_creds());
520
+ grpc_ssl_certificate_config_reload_status reload_status =
521
+ GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
522
+ if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
523
+ &reload_status) != GRPC_STATUS_OK) {
524
+ return GRPC_SECURITY_ERROR;
525
+ }
526
+ if (reload_status != GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW) {
527
+ /* At this point, we should have key materials populated. */
528
+ return GRPC_SECURITY_OK;
529
+ } else {
530
+ return ReplaceHandshakerFactory();
531
+ }
532
+ }
533
+
534
+ } // namespace grpc_core
@@ -21,11 +21,14 @@
21
21
 
22
22
  #include <grpc/support/port_platform.h>
23
23
 
24
+ #include "src/core/lib/gprpp/sync.h"
24
25
  #include "src/core/lib/security/context/security_context.h"
25
26
  #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h"
26
27
 
27
28
  #define GRPC_TLS_SPIFFE_TRANSPORT_SECURITY_TYPE "spiffe"
28
29
 
30
+ namespace grpc_core {
31
+
29
32
  // Spiffe channel security connector.
30
33
  class SpiffeChannelSecurityConnector final
31
34
  : public grpc_channel_security_connector {
@@ -66,6 +69,11 @@ class SpiffeChannelSecurityConnector final
66
69
  grpc_security_status InitializeHandshakerFactory(
67
70
  tsi_ssl_session_cache* ssl_session_cache);
68
71
 
72
+ // A util function to create a new client handshaker factory to replace
73
+ // the existing one if exists.
74
+ grpc_security_status ReplaceHandshakerFactory(
75
+ tsi_ssl_session_cache* ssl_session_cache);
76
+
69
77
  // gRPC-provided callback executed by application, which servers to bring the
70
78
  // control back to gRPC core.
71
79
  static void ServerAuthorizationCheckDone(
@@ -83,11 +91,17 @@ class SpiffeChannelSecurityConnector final
83
91
  static void ServerAuthorizationCheckArgDestroy(
84
92
  grpc_tls_server_authorization_check_arg* arg);
85
93
 
94
+ // A util function to refresh SSL TSI client handshaker factory with a valid
95
+ // credential.
96
+ grpc_security_status RefreshHandshakerFactory();
97
+
98
+ grpc_core::Mutex mu_;
86
99
  grpc_closure* on_peer_checked_;
87
100
  grpc_core::UniquePtr<char> target_name_;
88
101
  grpc_core::UniquePtr<char> overridden_target_name_;
89
102
  tsi_ssl_client_handshaker_factory* client_handshaker_factory_ = nullptr;
90
103
  grpc_tls_server_authorization_check_arg* check_arg_;
104
+ grpc_core::RefCountedPtr<grpc_tls_key_materials_config> key_materials_config_;
91
105
  };
92
106
 
93
107
  // Spiffe server security connector.
@@ -113,11 +127,30 @@ class SpiffeServerSecurityConnector final
113
127
  int cmp(const grpc_security_connector* other) const override;
114
128
 
115
129
  private:
130
+ // Initialize SSL TSI server handshaker factory.
131
+ grpc_security_status InitializeHandshakerFactory();
132
+
133
+ // A util function to create a new server handshaker factory to replace the
134
+ // existing once if exists.
135
+ grpc_security_status ReplaceHandshakerFactory();
136
+
116
137
  // A util function to refresh SSL TSI server handshaker factory with a valid
117
138
  // credential.
118
- grpc_security_status RefreshServerHandshakerFactory();
139
+ grpc_security_status RefreshHandshakerFactory();
140
+
141
+ grpc_core::Mutex mu_;
119
142
  tsi_ssl_server_handshaker_factory* server_handshaker_factory_ = nullptr;
143
+ grpc_core::RefCountedPtr<grpc_tls_key_materials_config> key_materials_config_;
120
144
  };
121
145
 
146
+ // Exposed for testing only.
147
+ grpc_status_code TlsFetchKeyMaterials(
148
+ const grpc_core::RefCountedPtr<grpc_tls_key_materials_config>&
149
+ key_materials_config,
150
+ const grpc_tls_credentials_options& options,
151
+ grpc_ssl_certificate_config_reload_status* status);
152
+
153
+ } // namespace grpc_core
154
+
122
155
  #endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_TLS_SPIFFE_SECURITY_CONNECTOR_H \
123
156
  */
@@ -138,11 +138,12 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice,
138
138
  for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) {
139
139
  static_metadata_hash_ent ent =
140
140
  static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)];
141
+ const grpc_core::StaticMetadataSlice* static_slice_table =
142
+ grpc_static_slice_table();
141
143
  if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT &&
142
- grpc_slice_eq_static_interned(slice,
143
- grpc_static_slice_table[ent.idx])) {
144
+ grpc_slice_eq_static_interned(slice, static_slice_table[ent.idx])) {
144
145
  *returned_slice_is_different = true;
145
- return grpc_static_slice_table[ent.idx];
146
+ return static_slice_table[ent.idx];
146
147
  }
147
148
  }
148
149
 
@@ -168,10 +169,11 @@ static const grpc_core::StaticMetadataSlice* MatchStaticSlice(
168
169
  for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) {
169
170
  static_metadata_hash_ent ent =
170
171
  static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)];
172
+ const grpc_core::StaticMetadataSlice* static_slice_table =
173
+ grpc_static_slice_table();
171
174
  if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT &&
172
- grpc_static_slice_table[ent.idx].Equals(
173
- std::forward<SliceArgs>(args)...)) {
174
- return &grpc_static_slice_table[ent.idx];
175
+ static_slice_table[ent.idx].Equals(std::forward<SliceArgs>(args)...)) {
176
+ return &static_slice_table[ent.idx];
175
177
  }
176
178
  }
177
179
  return nullptr;
@@ -206,7 +208,11 @@ static InternedSliceRefcount* InternNewStringLocked(slice_shard* shard,
206
208
  InternedSliceRefcount* s =
207
209
  static_cast<InternedSliceRefcount*>(gpr_malloc(sizeof(*s) + len));
208
210
  new (s) grpc_core::InternedSliceRefcount(len, hash, shard->strs[shard_idx]);
209
- memcpy(reinterpret_cast<char*>(s + 1), buffer, len);
211
+ // TODO(arjunroy): Investigate why hpack tried to intern the nullptr string.
212
+ // https://github.com/grpc/grpc/pull/20110#issuecomment-526729282
213
+ if (len > 0) {
214
+ memcpy(reinterpret_cast<char*>(s + 1), buffer, len);
215
+ }
210
216
  shard->strs[shard_idx] = s;
211
217
  shard->count++;
212
218
  if (shard->count > shard->capacity * 2) {
@@ -318,9 +324,11 @@ void grpc_slice_intern_init(void) {
318
324
  static_metadata_hash[i].idx = GRPC_STATIC_MDSTR_COUNT;
319
325
  }
320
326
  max_static_metadata_hash_probe = 0;
327
+ const grpc_core::StaticMetadataSlice* static_slice_table =
328
+ grpc_static_slice_table();
321
329
  for (size_t i = 0; i < GRPC_STATIC_MDSTR_COUNT; i++) {
322
330
  grpc_static_metadata_hash_values[i] =
323
- grpc_slice_default_hash_internal(grpc_static_slice_table[i]);
331
+ grpc_slice_default_hash_internal(static_slice_table[i]);
324
332
  for (size_t j = 0; j < GPR_ARRAY_SIZE(static_metadata_hash); j++) {
325
333
  size_t slot = (grpc_static_metadata_hash_values[i] + j) %
326
334
  GPR_ARRAY_SIZE(static_metadata_hash);
@@ -336,7 +344,7 @@ void grpc_slice_intern_init(void) {
336
344
  }
337
345
  // Handle KV hash for all static mdelems.
338
346
  for (size_t i = 0; i < GRPC_STATIC_MDELEM_COUNT; ++i) {
339
- grpc_static_mdelem_table[i].HashInit();
347
+ grpc_static_mdelem_table()[i].HashInit();
340
348
  }
341
349
  }
342
350