grpc 1.36.0 → 1.37.0.pre1
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.
- checksums.yaml +4 -4
- data/Makefile +65 -37
- data/include/grpc/grpc.h +15 -1
- data/include/grpc/impl/codegen/port_platform.h +2 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +327 -305
- data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -1
- data/src/core/ext/filters/client_channel/config_selector.h +8 -0
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +9 -4
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -142
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +15 -10
- data/src/core/ext/filters/client_channel/lb_policy.cc +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +23 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +27 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +7 -22
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +27 -67
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +10 -9
- data/src/core/ext/filters/client_channel/resolver.cc +3 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +3 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +5 -9
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +18 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +295 -91
- data/src/core/ext/filters/client_channel/server_address.cc +3 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +69 -146
- data/src/core/ext/filters/client_channel/subchannel.h +63 -95
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +16 -2
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +10 -8
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +1 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +495 -0
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +39 -0
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +189 -0
- data/src/core/ext/filters/fault_injection/service_config_parser.h +85 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +3 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +3 -2
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +457 -170
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +39 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +12 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +5 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +1 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +406 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +1459 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +350 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +1348 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +6 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +25 -0
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +144 -0
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +488 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +141 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +452 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +15 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +44 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +79 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +268 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +78 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +281 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +41 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +113 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +6 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +13 -9
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +93 -0
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +323 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +90 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +46 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +124 -0
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +33 -0
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +77 -0
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +354 -0
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +140 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +383 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +115 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +10 -7
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +141 -0
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +141 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +13 -7
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +102 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +120 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +76 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +21 -20
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +130 -0
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +63 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +44 -0
- data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +35 -0
- data/src/core/ext/xds/xds_api.cc +1591 -279
- data/src/core/ext/xds/xds_api.h +279 -39
- data/src/core/ext/xds/xds_bootstrap.cc +21 -5
- data/src/core/ext/xds/xds_bootstrap.h +5 -1
- data/src/core/ext/xds/xds_client.cc +168 -23
- data/src/core/ext/xds/xds_client.h +26 -0
- data/src/core/ext/xds/xds_client_stats.h +2 -2
- data/src/core/ext/xds/xds_http_fault_filter.cc +226 -0
- data/src/core/ext/xds/xds_http_fault_filter.h +63 -0
- data/src/core/ext/xds/xds_http_filters.cc +114 -0
- data/src/core/ext/xds/xds_http_filters.h +130 -0
- data/src/core/ext/xds/xds_server_config_fetcher.cc +391 -126
- data/src/core/lib/channel/channel_stack.cc +12 -0
- data/src/core/lib/channel/channel_stack.h +7 -0
- data/src/core/lib/channel/channelz.cc +92 -4
- data/src/core/lib/channel/channelz.h +30 -1
- data/src/core/lib/channel/channelz_registry.cc +14 -0
- data/src/core/lib/channel/handshaker.cc +0 -39
- data/src/core/lib/channel/handshaker.h +0 -17
- data/src/core/lib/channel/status_util.cc +12 -2
- data/src/core/lib/channel/status_util.h +5 -0
- data/src/core/lib/gpr/sync_abseil.cc +3 -6
- data/src/core/lib/gpr/sync_windows.cc +2 -2
- data/src/core/lib/gprpp/atomic.h +3 -3
- data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +2 -0
- data/src/core/lib/gprpp/thd.h +1 -1
- data/src/core/lib/iomgr/buffer_list.h +1 -1
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -2
- data/src/core/lib/iomgr/error.h +1 -1
- data/src/core/lib/iomgr/ev_apple.cc +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -3
- data/src/core/lib/iomgr/ev_posix.cc +3 -3
- data/src/core/lib/iomgr/exec_ctx.cc +6 -2
- data/src/core/lib/iomgr/resource_quota.cc +1 -1
- data/src/core/lib/iomgr/sockaddr_utils.cc +120 -0
- data/src/core/lib/iomgr/sockaddr_utils.h +25 -0
- data/src/core/lib/iomgr/tcp_posix.cc +1 -4
- data/src/core/lib/iomgr/tcp_uv.cc +2 -2
- data/src/core/lib/iomgr/timer_generic.cc +2 -2
- data/src/core/lib/iomgr/timer_manager.cc +1 -1
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
- data/src/core/lib/{security/authorization → matchers}/matchers.cc +8 -8
- data/src/core/lib/{security/authorization → matchers}/matchers.h +14 -12
- data/src/core/lib/security/security_connector/ssl_utils.cc +6 -4
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +6 -0
- data/src/core/lib/security/transport/security_handshaker.cc +32 -2
- data/src/core/lib/slice/slice_intern.cc +6 -7
- data/src/core/lib/surface/channel.h +3 -3
- data/src/core/lib/surface/completion_queue.cc +1 -1
- data/src/core/lib/surface/lame_client.cc +38 -19
- data/src/core/lib/surface/lame_client.h +4 -3
- data/src/core/lib/surface/server.cc +40 -33
- data/src/core/lib/surface/server.h +74 -15
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/metadata_batch.cc +27 -0
- data/src/core/lib/transport/metadata_batch.h +14 -0
- data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -3
- data/src/core/tsi/fake_transport_security.cc +10 -1
- data/src/ruby/ext/grpc/extconf.rb +9 -1
- data/src/ruby/ext/grpc/rb_channel.c +10 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.c +11 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -1
- data/src/ruby/ext/grpc/rb_server.c +13 -1
- data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
- data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +32 -0
- data/src/ruby/spec/channel_spec.rb +17 -6
- data/src/ruby/spec/client_auth_spec.rb +27 -1
- data/src/ruby/spec/errors_spec.rb +1 -1
- data/src/ruby/spec/generic/active_call_spec.rb +2 -2
- data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
- data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
- data/src/ruby/spec/server_credentials_spec.rb +25 -0
- data/src/ruby/spec/server_spec.rb +22 -0
- data/third_party/boringssl-with-bazel/err_data.c +255 -255
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +11 -2
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +21 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +0 -28
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +22 -17
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +22 -32
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +25 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +0 -1
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +33 -19
- data/third_party/xxhash/xxhash.h +5443 -0
- metadata +93 -49
- data/src/core/lib/security/authorization/authorization_engine.cc +0 -177
- data/src/core/lib/security/authorization/authorization_engine.h +0 -84
- data/src/core/lib/security/authorization/evaluate_args.cc +0 -148
- data/src/core/lib/security/authorization/evaluate_args.h +0 -59
- data/src/core/lib/security/authorization/mock_cel/activation.h +0 -57
- data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +0 -44
- data/src/core/lib/security/authorization/mock_cel/cel_expression.h +0 -69
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +0 -99
- data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +0 -67
- data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +0 -57
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -504
- data/third_party/upb/upb/json_decode.c +0 -1443
- data/third_party/upb/upb/json_decode.h +0 -23
- data/third_party/upb/upb/json_encode.c +0 -713
- data/third_party/upb/upb/json_encode.h +0 -36
@@ -12,8 +12,8 @@
|
|
12
12
|
// See the License for the specific language governing permissions and
|
13
13
|
// limitations under the License.
|
14
14
|
|
15
|
-
#ifndef
|
16
|
-
#define
|
15
|
+
#ifndef GRPC_CORE_LIB_MATCHERS_MATCHERS_H
|
16
|
+
#define GRPC_CORE_LIB_MATCHERS_MATCHERS_H
|
17
17
|
|
18
18
|
#include <grpc/support/port_platform.h>
|
19
19
|
|
@@ -40,7 +40,7 @@ class StringMatcher {
|
|
40
40
|
|
41
41
|
// Creates StringMatcher instance. Returns error status on failure.
|
42
42
|
static absl::StatusOr<StringMatcher> Create(Type type,
|
43
|
-
|
43
|
+
absl::string_view matcher,
|
44
44
|
bool case_sensitive = true);
|
45
45
|
|
46
46
|
StringMatcher() = default;
|
@@ -65,7 +65,7 @@ class StringMatcher {
|
|
65
65
|
bool case_sensitive() const { return case_sensitive_; }
|
66
66
|
|
67
67
|
private:
|
68
|
-
StringMatcher(Type type,
|
68
|
+
StringMatcher(Type type, absl::string_view matcher, bool case_sensitive);
|
69
69
|
StringMatcher(std::unique_ptr<RE2> regex_matcher, bool case_sensitive);
|
70
70
|
|
71
71
|
Type type_ = Type::EXACT;
|
@@ -106,10 +106,12 @@ class HeaderMatcher {
|
|
106
106
|
"");
|
107
107
|
|
108
108
|
// Creates HeaderMatcher instance. Returns error status on failure.
|
109
|
-
static absl::StatusOr<HeaderMatcher> Create(
|
110
|
-
|
111
|
-
|
112
|
-
|
109
|
+
static absl::StatusOr<HeaderMatcher> Create(absl::string_view name, Type type,
|
110
|
+
absl::string_view matcher,
|
111
|
+
int64_t range_start = 0,
|
112
|
+
int64_t range_end = 0,
|
113
|
+
bool present_match = false,
|
114
|
+
bool invert_match = false);
|
113
115
|
|
114
116
|
HeaderMatcher() = default;
|
115
117
|
HeaderMatcher(const HeaderMatcher& other);
|
@@ -136,13 +138,13 @@ class HeaderMatcher {
|
|
136
138
|
|
137
139
|
private:
|
138
140
|
// For StringMatcher.
|
139
|
-
HeaderMatcher(
|
141
|
+
HeaderMatcher(absl::string_view name, Type type, StringMatcher matcher,
|
140
142
|
bool invert_match);
|
141
143
|
// For RangeMatcher.
|
142
|
-
HeaderMatcher(
|
144
|
+
HeaderMatcher(absl::string_view name, int64_t range_start, int64_t range_end,
|
143
145
|
bool invert_match);
|
144
146
|
// For PresentMatcher.
|
145
|
-
HeaderMatcher(
|
147
|
+
HeaderMatcher(absl::string_view name, bool present_match, bool invert_match);
|
146
148
|
|
147
149
|
std::string name_;
|
148
150
|
Type type_ = Type::EXACT;
|
@@ -155,4 +157,4 @@ class HeaderMatcher {
|
|
155
157
|
|
156
158
|
} // namespace grpc_core
|
157
159
|
|
158
|
-
#endif /*
|
160
|
+
#endif /* GRPC_CORE_LIB_MATCHERS_MATCHERS_H */
|
@@ -41,11 +41,13 @@
|
|
41
41
|
|
42
42
|
/* -- Constants. -- */
|
43
43
|
|
44
|
-
#
|
45
|
-
static const char* installed_roots_path =
|
46
|
-
#
|
44
|
+
#if defined(GRPC_ROOT_PEM_PATH)
|
45
|
+
static const char* installed_roots_path = GRPC_ROOT_PEM_PATH;
|
46
|
+
#elif defined(INSTALL_PREFIX)
|
47
47
|
static const char* installed_roots_path =
|
48
|
-
INSTALL_PREFIX "/share/grpc/roots.pem";
|
48
|
+
INSTALL_PREFIX "/usr/share/grpc/roots.pem";
|
49
|
+
#else
|
50
|
+
static const char* installed_roots_path = "/usr/share/grpc/roots.pem";
|
49
51
|
#endif
|
50
52
|
|
51
53
|
#ifndef TSI_OPENSSL_ALPN_SUPPORT
|
@@ -318,6 +318,12 @@ int TlsChannelSecurityConnector::cmp(
|
|
318
318
|
bool TlsChannelSecurityConnector::check_call_host(
|
319
319
|
absl::string_view host, grpc_auth_context* auth_context,
|
320
320
|
grpc_closure* /*on_call_host_checked*/, grpc_error** error) {
|
321
|
+
if (options_->server_verification_option() ==
|
322
|
+
GRPC_TLS_SKIP_HOSTNAME_VERIFICATION ||
|
323
|
+
options_->server_verification_option() ==
|
324
|
+
GRPC_TLS_SKIP_ALL_SERVER_VERIFICATION) {
|
325
|
+
return true;
|
326
|
+
}
|
321
327
|
return grpc_ssl_check_call_host(host, target_name_.c_str(),
|
322
328
|
overridden_target_name_.c_str(), auth_context,
|
323
329
|
error);
|
@@ -29,6 +29,7 @@
|
|
29
29
|
#include <grpc/support/log.h>
|
30
30
|
|
31
31
|
#include "src/core/lib/channel/channel_args.h"
|
32
|
+
#include "src/core/lib/channel/channelz.h"
|
32
33
|
#include "src/core/lib/channel/handshaker.h"
|
33
34
|
#include "src/core/lib/channel/handshaker_registry.h"
|
34
35
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
@@ -199,6 +200,31 @@ void SecurityHandshaker::HandshakeFailedLocked(grpc_error* error) {
|
|
199
200
|
ExecCtx::Run(DEBUG_LOCATION, on_handshake_done_, error);
|
200
201
|
}
|
201
202
|
|
203
|
+
namespace {
|
204
|
+
|
205
|
+
RefCountedPtr<channelz::SocketNode::Security>
|
206
|
+
MakeChannelzSecurityFromAuthContext(grpc_auth_context* auth_context) {
|
207
|
+
RefCountedPtr<channelz::SocketNode::Security> security =
|
208
|
+
MakeRefCounted<channelz::SocketNode::Security>();
|
209
|
+
// TODO(yashykt): Currently, we are assuming TLS by default and are only able
|
210
|
+
// to fill in the remote certificate but we should ideally be able to fill in
|
211
|
+
// other fields in
|
212
|
+
// https://github.com/grpc/grpc/blob/fcd43e90304862a823316b224ee733d17a8cfd90/src/proto/grpc/channelz/channelz.proto#L326
|
213
|
+
// from grpc_auth_context.
|
214
|
+
security->type = channelz::SocketNode::Security::ModelType::kTls;
|
215
|
+
security->tls = absl::make_optional<channelz::SocketNode::Security::Tls>();
|
216
|
+
grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name(
|
217
|
+
auth_context, GRPC_X509_PEM_CERT_PROPERTY_NAME);
|
218
|
+
const grpc_auth_property* prop = grpc_auth_property_iterator_next(&it);
|
219
|
+
if (prop != nullptr) {
|
220
|
+
security->tls->remote_certificate =
|
221
|
+
std::string(prop->value, prop->value_length);
|
222
|
+
}
|
223
|
+
return security;
|
224
|
+
}
|
225
|
+
|
226
|
+
} // namespace
|
227
|
+
|
202
228
|
void SecurityHandshaker::OnPeerCheckedInner(grpc_error* error) {
|
203
229
|
MutexLock lock(&mu_);
|
204
230
|
if (error != GRPC_ERROR_NONE || is_shutdown_) {
|
@@ -251,9 +277,13 @@ void SecurityHandshaker::OnPeerCheckedInner(grpc_error* error) {
|
|
251
277
|
tsi_handshaker_result_destroy(handshaker_result_);
|
252
278
|
handshaker_result_ = nullptr;
|
253
279
|
// Add auth context to channel args.
|
254
|
-
grpc_arg
|
280
|
+
absl::InlinedVector<grpc_arg, 2> args_to_add;
|
281
|
+
args_to_add.push_back(grpc_auth_context_to_arg(auth_context_.get()));
|
282
|
+
auto security = MakeChannelzSecurityFromAuthContext(auth_context_.get());
|
283
|
+
args_to_add.push_back(security->MakeChannelArg());
|
255
284
|
grpc_channel_args* tmp_args = args_->args;
|
256
|
-
args_->args = grpc_channel_args_copy_and_add(tmp_args,
|
285
|
+
args_->args = grpc_channel_args_copy_and_add(tmp_args, args_to_add.data(),
|
286
|
+
args_to_add.size());
|
257
287
|
grpc_channel_args_destroy(tmp_args);
|
258
288
|
// Invoke callback.
|
259
289
|
ExecCtx::Run(DEBUG_LOCATION, on_handshake_done_, GRPC_ERROR_NONE);
|
@@ -44,13 +44,13 @@
|
|
44
44
|
using grpc_core::InternedSliceRefcount;
|
45
45
|
|
46
46
|
typedef struct slice_shard {
|
47
|
-
|
47
|
+
grpc_core::Mutex mu;
|
48
48
|
InternedSliceRefcount** strs;
|
49
49
|
size_t count;
|
50
50
|
size_t capacity;
|
51
51
|
} slice_shard;
|
52
52
|
|
53
|
-
static slice_shard g_shards
|
53
|
+
static slice_shard* g_shards;
|
54
54
|
|
55
55
|
struct static_metadata_hash_ent {
|
56
56
|
uint32_t hash;
|
@@ -69,7 +69,7 @@ static bool g_forced_hash_seed = false;
|
|
69
69
|
|
70
70
|
InternedSliceRefcount::~InternedSliceRefcount() {
|
71
71
|
slice_shard* shard = &g_shards[SHARD_IDX(this->hash)];
|
72
|
-
|
72
|
+
MutexLock lock(&shard->mu);
|
73
73
|
InternedSliceRefcount** prev_next;
|
74
74
|
InternedSliceRefcount* cur;
|
75
75
|
for (prev_next = &shard->strs[TABLE_IDX(this->hash, shard->capacity)],
|
@@ -259,13 +259,12 @@ template <typename SliceArgs>
|
|
259
259
|
static InternedSliceRefcount* FindOrCreateInternedSlice(uint32_t hash,
|
260
260
|
const SliceArgs& args) {
|
261
261
|
slice_shard* shard = &g_shards[SHARD_IDX(hash)];
|
262
|
-
|
262
|
+
grpc_core::MutexLock lock(&shard->mu);
|
263
263
|
const size_t idx = TABLE_IDX(hash, shard->capacity);
|
264
264
|
InternedSliceRefcount* s = MatchInternedSliceLocked(hash, idx, args);
|
265
265
|
if (s == nullptr) {
|
266
266
|
s = InternNewStringLocked(shard, idx, hash, args);
|
267
267
|
}
|
268
|
-
gpr_mu_unlock(&shard->mu);
|
269
268
|
return s;
|
270
269
|
}
|
271
270
|
|
@@ -312,9 +311,9 @@ void grpc_slice_intern_init(void) {
|
|
312
311
|
grpc_core::g_hash_seed =
|
313
312
|
static_cast<uint32_t>(gpr_now(GPR_CLOCK_REALTIME).tv_nsec);
|
314
313
|
}
|
314
|
+
g_shards = new slice_shard[SHARD_COUNT];
|
315
315
|
for (size_t i = 0; i < SHARD_COUNT; i++) {
|
316
316
|
slice_shard* shard = &g_shards[i];
|
317
|
-
gpr_mu_init(&shard->mu);
|
318
317
|
shard->count = 0;
|
319
318
|
shard->capacity = INITIAL_SHARD_CAPACITY;
|
320
319
|
shard->strs = static_cast<InternedSliceRefcount**>(
|
@@ -352,7 +351,6 @@ void grpc_slice_intern_init(void) {
|
|
352
351
|
void grpc_slice_intern_shutdown(void) {
|
353
352
|
for (size_t i = 0; i < SHARD_COUNT; i++) {
|
354
353
|
slice_shard* shard = &g_shards[i];
|
355
|
-
gpr_mu_destroy(&shard->mu);
|
356
354
|
/* TODO(ctiller): GPR_ASSERT(shard->count == 0); */
|
357
355
|
if (shard->count != 0) {
|
358
356
|
gpr_log(GPR_DEBUG, "WARNING: %" PRIuPTR " metadata strings were leaked",
|
@@ -371,4 +369,5 @@ void grpc_slice_intern_shutdown(void) {
|
|
371
369
|
}
|
372
370
|
gpr_free(shard->strs);
|
373
371
|
}
|
372
|
+
delete[] g_shards;
|
374
373
|
}
|
@@ -94,9 +94,9 @@ struct CallRegistrationTable {
|
|
94
94
|
// The map key should be owned strings rather than unowned char*'s to
|
95
95
|
// guarantee that it outlives calls on the core channel (which may outlast the
|
96
96
|
// C++ or other wrapped language Channel that registered these calls).
|
97
|
-
std::map<std::pair<std::string, std::string>, RegisteredCall>
|
98
|
-
|
99
|
-
int method_registration_attempts
|
97
|
+
std::map<std::pair<std::string, std::string>, RegisteredCall> map
|
98
|
+
ABSL_GUARDED_BY(mu);
|
99
|
+
int method_registration_attempts ABSL_GUARDED_BY(mu) = 0;
|
100
100
|
};
|
101
101
|
|
102
102
|
} // namespace grpc_core
|
@@ -705,7 +705,7 @@ static void cq_end_op_for_next(
|
|
705
705
|
6, (cq, tag, errmsg, done, done_arg, storage));
|
706
706
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_operation_failures) &&
|
707
707
|
error != GRPC_ERROR_NONE) {
|
708
|
-
gpr_log(
|
708
|
+
gpr_log(GPR_INFO, "Operation failed: tag=%p, error=%s", tag, errmsg);
|
709
709
|
}
|
710
710
|
}
|
711
711
|
cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
|
@@ -35,12 +35,20 @@
|
|
35
35
|
#include "src/core/lib/transport/connectivity_state.h"
|
36
36
|
#include "src/core/lib/transport/static_metadata.h"
|
37
37
|
|
38
|
+
#define GRPC_ARG_LAME_FILTER_ERROR "grpc.lame_filter_error"
|
39
|
+
|
38
40
|
namespace grpc_core {
|
39
41
|
|
40
42
|
namespace {
|
41
43
|
|
42
44
|
struct ChannelData {
|
43
|
-
ChannelData(
|
45
|
+
explicit ChannelData(grpc_channel_element_args* args)
|
46
|
+
: state_tracker("lame_channel", GRPC_CHANNEL_SHUTDOWN) {
|
47
|
+
grpc_error* err = grpc_channel_args_find_pointer<grpc_error>(
|
48
|
+
args->channel_args, GRPC_ARG_LAME_FILTER_ERROR);
|
49
|
+
if (err != nullptr) error = GRPC_ERROR_REF(err);
|
50
|
+
}
|
51
|
+
|
44
52
|
~ChannelData() { GRPC_ERROR_UNREF(error); }
|
45
53
|
|
46
54
|
grpc_error* error = GRPC_ERROR_NONE;
|
@@ -105,9 +113,7 @@ static void lame_destroy_call_elem(grpc_call_element* /*elem*/,
|
|
105
113
|
|
106
114
|
static grpc_error* lame_init_channel_elem(grpc_channel_element* elem,
|
107
115
|
grpc_channel_element_args* args) {
|
108
|
-
|
109
|
-
GPR_ASSERT(args->is_last);
|
110
|
-
new (elem->channel_data) ChannelData;
|
116
|
+
new (elem->channel_data) ChannelData(args);
|
111
117
|
return GRPC_ERROR_NONE;
|
112
118
|
}
|
113
119
|
|
@@ -116,12 +122,25 @@ static void lame_destroy_channel_elem(grpc_channel_element* elem) {
|
|
116
122
|
chand->~ChannelData();
|
117
123
|
}
|
118
124
|
|
125
|
+
// Channel arg vtable for a grpc_error*.
|
126
|
+
void* ErrorCopy(void* p) {
|
127
|
+
grpc_error* error = static_cast<grpc_error*>(p);
|
128
|
+
return GRPC_ERROR_REF(error);
|
129
|
+
}
|
130
|
+
void ErrorDestroy(void* p) {
|
131
|
+
grpc_error* error = static_cast<grpc_error*>(p);
|
132
|
+
GRPC_ERROR_UNREF(error);
|
133
|
+
}
|
134
|
+
int ErrorCompare(void* p, void* q) { return GPR_ICMP(p, q); }
|
135
|
+
const grpc_arg_pointer_vtable kLameFilterErrorArgVtable = {
|
136
|
+
ErrorCopy, ErrorDestroy, ErrorCompare};
|
137
|
+
|
119
138
|
} // namespace
|
120
139
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
140
|
+
grpc_arg MakeLameClientErrorArg(grpc_error* error) {
|
141
|
+
return grpc_channel_arg_pointer_create(
|
142
|
+
const_cast<char*>(GRPC_ARG_LAME_FILTER_ERROR), error,
|
143
|
+
&kLameFilterErrorArgVtable);
|
125
144
|
}
|
126
145
|
|
127
146
|
} // namespace grpc_core
|
@@ -146,20 +165,20 @@ grpc_channel* grpc_lame_client_channel_create(const char* target,
|
|
146
165
|
grpc_status_code error_code,
|
147
166
|
const char* error_message) {
|
148
167
|
grpc_core::ExecCtx exec_ctx;
|
149
|
-
grpc_channel_element* elem;
|
150
|
-
grpc_channel* channel =
|
151
|
-
grpc_channel_create(target, nullptr, GRPC_CLIENT_LAME_CHANNEL, nullptr);
|
152
|
-
elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
|
153
168
|
GRPC_API_TRACE(
|
154
169
|
"grpc_lame_client_channel_create(target=%s, error_code=%d, "
|
155
170
|
"error_message=%s)",
|
156
171
|
3, (target, (int)error_code, error_message));
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
172
|
+
grpc_error* error = grpc_error_set_str(
|
173
|
+
grpc_error_set_int(
|
174
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("lame client channel"),
|
175
|
+
GRPC_ERROR_INT_GRPC_STATUS, error_code),
|
176
|
+
GRPC_ERROR_STR_GRPC_MESSAGE,
|
177
|
+
grpc_slice_from_static_string(error_message));
|
178
|
+
grpc_arg error_arg = grpc_core::MakeLameClientErrorArg(error);
|
179
|
+
grpc_channel_args args = {1, &error_arg};
|
180
|
+
grpc_channel* channel =
|
181
|
+
grpc_channel_create(target, &args, GRPC_CLIENT_LAME_CHANNEL, nullptr);
|
182
|
+
GRPC_ERROR_UNREF(error);
|
164
183
|
return channel;
|
165
184
|
}
|
@@ -23,10 +23,11 @@
|
|
23
23
|
|
24
24
|
#include "src/core/lib/channel/channel_stack.h"
|
25
25
|
|
26
|
-
extern const grpc_channel_filter grpc_lame_filter;
|
27
|
-
|
28
26
|
namespace grpc_core {
|
29
|
-
|
27
|
+
// Does NOT take ownership of error.
|
28
|
+
grpc_arg MakeLameClientErrorArg(grpc_error* error);
|
30
29
|
} // namespace grpc_core
|
31
30
|
|
31
|
+
extern const grpc_channel_filter grpc_lame_filter;
|
32
|
+
|
32
33
|
#endif /* GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H */
|
@@ -318,7 +318,8 @@ class Server::RealRequestMatcher : public RequestMatcherInterface {
|
|
318
318
|
// advance or queue up any incoming RPC for later match. Instead, MatchOrQueue
|
319
319
|
// will call out to an allocation function passed in at the construction of the
|
320
320
|
// object. These request matchers are designed for the C++ callback API, so they
|
321
|
-
// only support 1 completion queue (passed in at the constructor).
|
321
|
+
// only support 1 completion queue (passed in at the constructor). They are also
|
322
|
+
// used for the sync API.
|
322
323
|
class Server::AllocatingRequestMatcherBase : public RequestMatcherInterface {
|
323
324
|
public:
|
324
325
|
AllocatingRequestMatcherBase(Server* server, grpc_completion_queue* cq)
|
@@ -370,15 +371,20 @@ class Server::AllocatingRequestMatcherBatch
|
|
370
371
|
|
371
372
|
void MatchOrQueue(size_t /*start_request_queue_index*/,
|
372
373
|
CallData* calld) override {
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
374
|
+
if (server()->ShutdownRefOnRequest()) {
|
375
|
+
BatchCallAllocation call_info = allocator_();
|
376
|
+
GPR_ASSERT(server()->ValidateServerRequest(
|
377
|
+
cq(), static_cast<void*>(call_info.tag), nullptr,
|
378
|
+
nullptr) == GRPC_CALL_OK);
|
379
|
+
RequestedCall* rc = new RequestedCall(
|
380
|
+
static_cast<void*>(call_info.tag), call_info.cq, call_info.call,
|
381
|
+
call_info.initial_metadata, call_info.details);
|
382
|
+
calld->SetState(CallData::CallState::ACTIVATED);
|
383
|
+
calld->Publish(cq_idx(), rc);
|
384
|
+
} else {
|
385
|
+
calld->FailCallCreation();
|
386
|
+
}
|
387
|
+
server()->ShutdownUnrefOnRequest();
|
382
388
|
}
|
383
389
|
|
384
390
|
private:
|
@@ -398,17 +404,21 @@ class Server::AllocatingRequestMatcherRegistered
|
|
398
404
|
|
399
405
|
void MatchOrQueue(size_t /*start_request_queue_index*/,
|
400
406
|
CallData* calld) override {
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
407
|
+
if (server()->ShutdownRefOnRequest()) {
|
408
|
+
RegisteredCallAllocation call_info = allocator_();
|
409
|
+
GPR_ASSERT(server()->ValidateServerRequest(
|
410
|
+
cq(), call_info.tag, call_info.optional_payload,
|
411
|
+
registered_method_) == GRPC_CALL_OK);
|
412
|
+
RequestedCall* rc =
|
413
|
+
new RequestedCall(call_info.tag, call_info.cq, call_info.call,
|
414
|
+
call_info.initial_metadata, registered_method_,
|
415
|
+
call_info.deadline, call_info.optional_payload);
|
416
|
+
calld->SetState(CallData::CallState::ACTIVATED);
|
417
|
+
calld->Publish(cq_idx(), rc);
|
418
|
+
} else {
|
419
|
+
calld->FailCallCreation();
|
420
|
+
}
|
421
|
+
server()->ShutdownUnrefOnRequest();
|
412
422
|
}
|
413
423
|
|
414
424
|
private:
|
@@ -711,7 +721,7 @@ void Server::FailCall(size_t cq_idx, RequestedCall* rc, grpc_error* error) {
|
|
711
721
|
// Before calling MaybeFinishShutdown(), we must hold mu_global_ and not
|
712
722
|
// hold mu_call_.
|
713
723
|
void Server::MaybeFinishShutdown() {
|
714
|
-
if (!
|
724
|
+
if (!ShutdownReady() || shutdown_published_) {
|
715
725
|
return;
|
716
726
|
}
|
717
727
|
{
|
@@ -805,19 +815,18 @@ void Server::ShutdownAndNotify(grpc_completion_queue* cq, void* tag) {
|
|
805
815
|
return;
|
806
816
|
}
|
807
817
|
shutdown_tags_.emplace_back(tag, cq);
|
808
|
-
if (
|
818
|
+
if (ShutdownCalled()) {
|
809
819
|
return;
|
810
820
|
}
|
811
821
|
last_shutdown_message_time_ = gpr_now(GPR_CLOCK_REALTIME);
|
812
822
|
broadcaster.FillChannelsLocked(GetChannelsLocked());
|
813
|
-
shutdown_flag_.store(true, std::memory_order_release);
|
814
823
|
// Collect all unregistered then registered calls.
|
815
824
|
{
|
816
825
|
MutexLock lock(&mu_call_);
|
817
826
|
KillPendingWorkLocked(
|
818
827
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
|
819
828
|
}
|
820
|
-
|
829
|
+
ShutdownUnrefOnShutdownCall();
|
821
830
|
}
|
822
831
|
// Shutdown listeners.
|
823
832
|
for (auto& listener : listeners_) {
|
@@ -849,8 +858,7 @@ void Server::CancelAllCalls() {
|
|
849
858
|
void Server::Orphan() {
|
850
859
|
{
|
851
860
|
MutexLock lock(&mu_global_);
|
852
|
-
GPR_ASSERT(
|
853
|
-
listeners_.empty());
|
861
|
+
GPR_ASSERT(ShutdownCalled() || listeners_.empty());
|
854
862
|
GPR_ASSERT(listeners_destroyed_ == listeners_.size());
|
855
863
|
}
|
856
864
|
if (default_resource_user_ != nullptr) {
|
@@ -869,7 +877,7 @@ grpc_call_error Server::ValidateServerRequest(
|
|
869
877
|
(rm->payload_handling == GRPC_SRM_PAYLOAD_NONE)))) {
|
870
878
|
return GRPC_CALL_ERROR_PAYLOAD_TYPE_MISMATCH;
|
871
879
|
}
|
872
|
-
if (grpc_cq_begin_op(cq_for_notification, tag)
|
880
|
+
if (!grpc_cq_begin_op(cq_for_notification, tag)) {
|
873
881
|
return GRPC_CALL_ERROR_COMPLETION_QUEUE_SHUTDOWN;
|
874
882
|
}
|
875
883
|
return GRPC_CALL_OK;
|
@@ -897,7 +905,7 @@ grpc_call_error Server::ValidateServerRequestAndCq(
|
|
897
905
|
}
|
898
906
|
|
899
907
|
grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) {
|
900
|
-
if (
|
908
|
+
if (ShutdownCalled()) {
|
901
909
|
FailCall(cq_idx, rc,
|
902
910
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
|
903
911
|
return GRPC_CALL_OK;
|
@@ -1066,7 +1074,7 @@ void Server::ChannelData::InitTransport(RefCountedPtr<Server> server,
|
|
1066
1074
|
op->set_accept_stream_fn = AcceptStream;
|
1067
1075
|
op->set_accept_stream_user_data = this;
|
1068
1076
|
op->start_connectivity_watch = MakeOrphanable<ConnectivityWatcher>(this);
|
1069
|
-
if (server_->
|
1077
|
+
if (server_->ShutdownCalled()) {
|
1070
1078
|
op->disconnect_with_error =
|
1071
1079
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server shutdown");
|
1072
1080
|
}
|
@@ -1282,8 +1290,7 @@ void Server::CallData::PublishNewRpc(void* arg, grpc_error* error) {
|
|
1282
1290
|
auto* chand = static_cast<Server::ChannelData*>(call_elem->channel_data);
|
1283
1291
|
RequestMatcherInterface* rm = calld->matcher_;
|
1284
1292
|
Server* server = rm->server();
|
1285
|
-
if (error != GRPC_ERROR_NONE ||
|
1286
|
-
server->shutdown_flag_.load(std::memory_order_acquire)) {
|
1293
|
+
if (error != GRPC_ERROR_NONE || server->ShutdownCalled()) {
|
1287
1294
|
calld->state_.Store(CallState::ZOMBIED, MemoryOrder::RELAXED);
|
1288
1295
|
calld->KillZombie();
|
1289
1296
|
return;
|
@@ -1307,7 +1314,7 @@ void Server::CallData::KillZombie() {
|
|
1307
1314
|
|
1308
1315
|
void Server::CallData::StartNewRpc(grpc_call_element* elem) {
|
1309
1316
|
auto* chand = static_cast<ChannelData*>(elem->channel_data);
|
1310
|
-
if (server_->
|
1317
|
+
if (server_->ShutdownCalled()) {
|
1311
1318
|
state_.Store(CallState::ZOMBIED, MemoryOrder::RELAXED);
|
1312
1319
|
KillZombie();
|
1313
1320
|
return;
|