grpc 1.35.0 → 1.36.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.
- checksums.yaml +4 -4
- data/Makefile +60 -57
- data/include/grpc/grpc_security.h +16 -11
- data/src/core/ext/filters/client_channel/client_channel.cc +32 -26
- data/src/core/ext/filters/client_channel/client_channel.h +0 -2
- data/src/core/ext/filters/client_channel/config_selector.h +1 -1
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +3 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +8 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +289 -170
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +5 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +1 -3
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +231 -109
- data/src/core/ext/filters/client_channel/resolver.cc +2 -5
- data/src/core/ext/filters/client_channel/resolver.h +1 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +36 -45
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +29 -41
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +16 -14
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +18 -15
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +362 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +22 -74
- data/src/core/ext/filters/client_channel/server_address.cc +6 -0
- data/src/core/ext/filters/client_channel/server_address.h +31 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +2 -2
- data/src/core/ext/filters/max_age/max_age_filter.cc +35 -32
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +47 -22
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +11 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +11 -1
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +62 -18
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +11 -16
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +42 -59
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +15 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +25 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +75 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +9 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +28 -13
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +41 -7
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +23 -21
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +122 -77
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +13 -9
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +37 -5
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +11 -9
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +44 -27
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +42 -16
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +106 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +29 -0
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +67 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +13 -16
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +51 -42
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +16 -13
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +50 -18
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +4 -7
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +0 -17
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +30 -23
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +85 -73
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +0 -3
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +0 -3
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +0 -2
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +0 -1
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +21 -4
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +29 -0
- data/src/core/ext/upb-generated/{udpa/core/v1 → xds/core/v3}/authority.upb.c +5 -5
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +60 -0
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +52 -0
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +143 -0
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +42 -0
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +84 -0
- data/src/core/ext/upb-generated/{udpa/core/v1 → xds/core/v3}/resource.upb.c +9 -9
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +94 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +54 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +166 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +36 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +85 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +168 -171
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +405 -420
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +2 -2
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +12 -9
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +177 -171
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +88 -88
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +153 -153
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +4 -7
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +33 -20
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +56 -59
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +116 -111
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +129 -121
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +21 -24
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +17 -13
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +747 -724
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +22 -25
- data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +51 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +369 -376
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +12 -16
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +112 -108
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +45 -53
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +177 -180
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +92 -102
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +32 -42
- data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +30 -40
- data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +4 -7
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +38 -44
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +30 -33
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +14 -11
- data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +42 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +62 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +45 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +49 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +67 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +50 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.h +35 -0
- data/src/core/ext/xds/xds_api.cc +738 -567
- data/src/core/ext/xds/xds_api.h +46 -84
- data/src/core/ext/xds/xds_bootstrap.cc +59 -40
- data/src/core/ext/xds/xds_bootstrap.h +12 -4
- data/src/core/ext/xds/xds_certificate_provider.cc +180 -74
- data/src/core/ext/xds/xds_certificate_provider.h +83 -44
- data/src/core/ext/xds/xds_client.cc +13 -11
- data/src/core/ext/xds/xds_client.h +3 -0
- data/src/core/ext/xds/xds_client_stats.cc +2 -1
- data/src/core/ext/xds/xds_server_config_fetcher.cc +147 -11
- data/src/core/lib/channel/handshaker.cc +2 -5
- data/src/core/lib/channel/handshaker.h +1 -1
- data/src/core/lib/gpr/log.cc +6 -1
- data/src/core/lib/gprpp/mpscq.cc +2 -2
- data/src/core/lib/gprpp/ref_counted.h +1 -1
- data/src/core/lib/gprpp/sync.h +129 -40
- data/src/core/lib/gprpp/time_util.cc +77 -0
- data/src/core/lib/gprpp/time_util.h +42 -0
- data/src/core/lib/http/httpcli_security_connector.cc +2 -2
- data/src/core/lib/iomgr/ev_apple.cc +10 -7
- data/src/core/lib/iomgr/ev_epollex_linux.cc +4 -4
- data/src/core/lib/iomgr/iomgr_posix.cc +0 -1
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -1
- data/src/core/lib/iomgr/sockaddr_utils.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +4 -4
- data/src/core/lib/security/authorization/matchers.cc +339 -0
- data/src/core/lib/security/authorization/matchers.h +158 -0
- data/src/core/lib/security/authorization/mock_cel/activation.h +1 -1
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +9 -7
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +2 -1
- data/src/core/lib/security/credentials/alts/alts_credentials.h +1 -1
- data/src/core/lib/security/credentials/credentials.h +2 -1
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +1 -1
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -2
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +1 -1
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +1 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +7 -6
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +2 -2
- data/src/core/lib/security/credentials/jwt/json_token.cc +0 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +0 -3
- data/src/core/lib/security/credentials/local/local_credentials.cc +2 -1
- data/src/core/lib/security/credentials/local/local_credentials.h +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +2 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +1 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +2 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.h +1 -1
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +128 -59
- data/src/core/lib/security/credentials/xds/xds_credentials.h +3 -3
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +5 -5
- data/src/core/lib/security/security_connector/ssl_utils.cc +3 -0
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +26 -14
- data/src/core/lib/security/transport/security_handshaker.cc +1 -3
- data/src/core/lib/slice/slice_intern.cc +1 -1
- data/src/core/lib/surface/init.cc +13 -15
- data/src/core/lib/surface/server.cc +3 -3
- data/src/core/lib/surface/server.h +3 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata.cc +6 -2
- data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +17 -20
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +16 -21
- data/src/core/tsi/fake_transport_security.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +2 -4
- data/src/core/tsi/ssl_transport_security.cc +0 -3
- data/src/core/tsi/ssl_transport_security.h +0 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +7 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +1 -0
- data/third_party/boringssl-with-bazel/err_data.c +725 -723
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -10
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +15 -14
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_locl.h +30 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +28 -79
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +39 -85
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +5 -16
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +10 -61
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +158 -0
- data/third_party/boringssl-with-bazel/src/crypto/bn_extra/bn_asn1.c +3 -10
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +8 -9
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +60 -45
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_chacha20poly1305.c +6 -81
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +87 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-aarch64-win.c +41 -0
- data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/dh_asn1.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/params.c +179 -0
- data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +2 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +3 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/bn.c +13 -20
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/check.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/dh.c +136 -213
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +12 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +28 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +128 -38
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +0 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +51 -32
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +147 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +18 -29
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +13 -4
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +10 -7
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_arm.c +13 -11
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_vec.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +34 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +7 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +5 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +10 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_r2x.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +29 -23
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +1 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pkey.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +39 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +11 -10
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +25 -25
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +40 -20
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ia5.c +3 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +25 -36
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +6 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +6 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +3 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +652 -545
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +0 -167
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +10 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +62 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +22 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +15 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +56 -26
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +15 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +12 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +2 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +42 -24
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +27 -8
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +287 -98
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +139 -36
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +4 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +11 -20
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +10 -5
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +37 -16
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +0 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -8
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +20 -14
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +7 -8
- data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +5 -7
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +329 -31
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +48 -15
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +66 -24
- metadata +77 -65
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +0 -60
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +0 -52
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +0 -143
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +0 -42
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +0 -84
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +0 -94
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +0 -54
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +0 -173
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +0 -36
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +0 -92
- data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.c +0 -42
- data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.h +0 -35
- data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.c +0 -62
- data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.h +0 -40
- data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.c +0 -45
- data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.h +0 -40
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.c +0 -49
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.h +0 -35
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.c +0 -68
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.h +0 -40
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.c +0 -51
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.h +0 -35
- data/src/core/lib/iomgr/iomgr_posix.h +0 -26
@@ -25,8 +25,10 @@
|
|
25
25
|
#include <memory>
|
26
26
|
|
27
27
|
#include "absl/container/inlined_vector.h"
|
28
|
+
#include "absl/strings/str_format.h"
|
28
29
|
|
29
30
|
#include "src/core/lib/channel/channel_args.h"
|
31
|
+
#include "src/core/lib/gpr/useful.h"
|
30
32
|
#include "src/core/lib/iomgr/resolve_address.h"
|
31
33
|
|
32
34
|
namespace grpc_core {
|
@@ -108,6 +110,35 @@ class ServerAddress {
|
|
108
110
|
|
109
111
|
typedef absl::InlinedVector<ServerAddress, 1> ServerAddressList;
|
110
112
|
|
113
|
+
//
|
114
|
+
// ServerAddressWeightAttribute
|
115
|
+
//
|
116
|
+
class ServerAddressWeightAttribute : public ServerAddress::AttributeInterface {
|
117
|
+
public:
|
118
|
+
static const char* kServerAddressWeightAttributeKey;
|
119
|
+
|
120
|
+
explicit ServerAddressWeightAttribute(uint32_t weight) : weight_(weight) {}
|
121
|
+
|
122
|
+
uint32_t weight() const { return weight_; }
|
123
|
+
|
124
|
+
std::unique_ptr<AttributeInterface> Copy() const override {
|
125
|
+
return absl::make_unique<ServerAddressWeightAttribute>(weight_);
|
126
|
+
}
|
127
|
+
|
128
|
+
int Cmp(const AttributeInterface* other) const override {
|
129
|
+
const auto* other_locality_attr =
|
130
|
+
static_cast<const ServerAddressWeightAttribute*>(other);
|
131
|
+
return GPR_ICMP(weight_, other_locality_attr->weight_);
|
132
|
+
}
|
133
|
+
|
134
|
+
std::string ToString() const override {
|
135
|
+
return absl::StrFormat("%d", weight_);
|
136
|
+
}
|
137
|
+
|
138
|
+
private:
|
139
|
+
uint32_t weight_;
|
140
|
+
};
|
141
|
+
|
111
142
|
} // namespace grpc_core
|
112
143
|
|
113
144
|
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVER_ADDRESS_H */
|
@@ -1023,9 +1023,9 @@ void Subchannel::OnRetryAlarm(void* arg, grpc_error* error) {
|
|
1023
1023
|
if (error == GRPC_ERROR_NONE) {
|
1024
1024
|
gpr_log(GPR_INFO, "Failed to connect to channel, retrying");
|
1025
1025
|
c->ContinueConnectingLocked();
|
1026
|
-
lock.
|
1026
|
+
lock.Release();
|
1027
1027
|
} else {
|
1028
|
-
lock.
|
1028
|
+
lock.Release();
|
1029
1029
|
GRPC_SUBCHANNEL_WEAK_UNREF(c, "connecting");
|
1030
1030
|
}
|
1031
1031
|
GRPC_ERROR_UNREF(error);
|
@@ -54,16 +54,16 @@ struct channel_data {
|
|
54
54
|
grpc_channel_stack* channel_stack;
|
55
55
|
/* Guards access to max_age_timer, max_age_timer_pending, max_age_grace_timer
|
56
56
|
and max_age_grace_timer_pending */
|
57
|
-
|
57
|
+
grpc_core::Mutex max_age_timer_mu;
|
58
58
|
/* True if the max_age timer callback is currently pending */
|
59
|
-
bool max_age_timer_pending;
|
59
|
+
bool max_age_timer_pending ABSL_GUARDED_BY(max_age_timer_mu) = false;
|
60
60
|
/* True if the max_age_grace timer callback is currently pending */
|
61
|
-
bool max_age_grace_timer_pending;
|
61
|
+
bool max_age_grace_timer_pending ABSL_GUARDED_BY(max_age_timer_mu) = false;
|
62
62
|
/* The timer for checking if the channel has reached its max age */
|
63
|
-
grpc_timer max_age_timer;
|
63
|
+
grpc_timer max_age_timer ABSL_GUARDED_BY(max_age_timer_mu);
|
64
64
|
/* The timer for checking if the max-aged channel has uesed up the grace
|
65
65
|
period */
|
66
|
-
grpc_timer max_age_grace_timer;
|
66
|
+
grpc_timer max_age_grace_timer ABSL_GUARDED_BY(max_age_timer_mu);
|
67
67
|
/* The timer for checking if the channel's idle duration reaches
|
68
68
|
max_connection_idle */
|
69
69
|
grpc_timer max_idle_timer;
|
@@ -260,13 +260,15 @@ class ConnectivityWatcher : public AsyncConnectivityStateWatcherInterface {
|
|
260
260
|
|
261
261
|
static void start_max_age_timer_after_init(void* arg, grpc_error* /*error*/) {
|
262
262
|
channel_data* chand = static_cast<channel_data*>(arg);
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
263
|
+
{
|
264
|
+
grpc_core::MutexLock lock(&chand->max_age_timer_mu);
|
265
|
+
chand->max_age_timer_pending = true;
|
266
|
+
GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age max_age_timer");
|
267
|
+
grpc_timer_init(
|
268
|
+
&chand->max_age_timer,
|
269
|
+
grpc_core::ExecCtx::Get()->Now() + chand->max_connection_age,
|
270
|
+
&chand->close_max_age_channel);
|
271
|
+
}
|
270
272
|
grpc_transport_op* op = grpc_make_transport_op(nullptr);
|
271
273
|
op->start_connectivity_watch.reset(new grpc_core::ConnectivityWatcher(chand));
|
272
274
|
op->start_connectivity_watch_state = GRPC_CHANNEL_IDLE;
|
@@ -278,16 +280,17 @@ static void start_max_age_timer_after_init(void* arg, grpc_error* /*error*/) {
|
|
278
280
|
static void start_max_age_grace_timer_after_goaway_op(void* arg,
|
279
281
|
grpc_error* /*error*/) {
|
280
282
|
channel_data* chand = static_cast<channel_data*>(arg);
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
283
|
+
{
|
284
|
+
grpc_core::MutexLock lock(&chand->max_age_timer_mu);
|
285
|
+
chand->max_age_grace_timer_pending = true;
|
286
|
+
GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age max_age_grace_timer");
|
287
|
+
grpc_timer_init(&chand->max_age_grace_timer,
|
288
|
+
chand->max_connection_age_grace == GRPC_MILLIS_INF_FUTURE
|
289
|
+
? GRPC_MILLIS_INF_FUTURE
|
290
|
+
: grpc_core::ExecCtx::Get()->Now() +
|
291
|
+
chand->max_connection_age_grace,
|
292
|
+
&chand->force_close_max_age_channel);
|
293
|
+
}
|
291
294
|
GRPC_CHANNEL_STACK_UNREF(chand->channel_stack,
|
292
295
|
"max_age start_max_age_grace_timer_after_goaway_op");
|
293
296
|
}
|
@@ -350,9 +353,10 @@ static void max_idle_timer_cb(void* arg, grpc_error* error) {
|
|
350
353
|
|
351
354
|
static void close_max_age_channel(void* arg, grpc_error* error) {
|
352
355
|
channel_data* chand = static_cast<channel_data*>(arg);
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
+
{
|
357
|
+
grpc_core::MutexLock lock(&chand->max_age_timer_mu);
|
358
|
+
chand->max_age_timer_pending = false;
|
359
|
+
}
|
356
360
|
if (error == GRPC_ERROR_NONE) {
|
357
361
|
GRPC_CHANNEL_STACK_REF(chand->channel_stack,
|
358
362
|
"max_age start_max_age_grace_timer_after_goaway_op");
|
@@ -372,9 +376,10 @@ static void close_max_age_channel(void* arg, grpc_error* error) {
|
|
372
376
|
|
373
377
|
static void force_close_max_age_channel(void* arg, grpc_error* error) {
|
374
378
|
channel_data* chand = static_cast<channel_data*>(arg);
|
375
|
-
|
376
|
-
|
377
|
-
|
379
|
+
{
|
380
|
+
grpc_core::MutexLock lock(&chand->max_age_timer_mu);
|
381
|
+
chand->max_age_grace_timer_pending = false;
|
382
|
+
}
|
378
383
|
if (error == GRPC_ERROR_NONE) {
|
379
384
|
grpc_transport_op* op = grpc_make_transport_op(nullptr);
|
380
385
|
op->disconnect_with_error =
|
@@ -426,9 +431,7 @@ static void max_age_destroy_call_elem(
|
|
426
431
|
static grpc_error* max_age_init_channel_elem(grpc_channel_element* elem,
|
427
432
|
grpc_channel_element_args* args) {
|
428
433
|
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
429
|
-
|
430
|
-
chand->max_age_timer_pending = false;
|
431
|
-
chand->max_age_grace_timer_pending = false;
|
434
|
+
new (chand) channel_data();
|
432
435
|
chand->channel_stack = args->channel_stack;
|
433
436
|
chand->max_connection_age =
|
434
437
|
add_random_max_connection_age_jitter_and_convert_to_grpc_millis(
|
@@ -513,7 +516,7 @@ static grpc_error* max_age_init_channel_elem(grpc_channel_element* elem,
|
|
513
516
|
/* Destructor for channel_data. */
|
514
517
|
static void max_age_destroy_channel_elem(grpc_channel_element* elem) {
|
515
518
|
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
516
|
-
|
519
|
+
chand->~channel_data();
|
517
520
|
}
|
518
521
|
|
519
522
|
const grpc_channel_filter grpc_max_age_filter = {
|
@@ -220,7 +220,7 @@ void Chttp2Connector::OnReceiveSettings(void* arg, grpc_error* error) {
|
|
220
220
|
self->Unref();
|
221
221
|
}
|
222
222
|
|
223
|
-
void Chttp2Connector::OnTimeout(void* arg, grpc_error* error) {
|
223
|
+
void Chttp2Connector::OnTimeout(void* arg, grpc_error* /*error*/) {
|
224
224
|
Chttp2Connector* self = static_cast<Chttp2Connector*>(arg);
|
225
225
|
{
|
226
226
|
MutexLock lock(&self->mu_);
|
@@ -62,13 +62,17 @@ const char kUnixAbstractUriPrefix[] = "unix-abstract:";
|
|
62
62
|
class Chttp2ServerListener : public Server::ListenerInterface {
|
63
63
|
public:
|
64
64
|
static grpc_error* Create(Server* server, grpc_resolved_address* addr,
|
65
|
-
grpc_channel_args* args,
|
65
|
+
grpc_channel_args* args,
|
66
|
+
Chttp2ServerArgsModifier args_modifier,
|
67
|
+
int* port_num);
|
66
68
|
|
67
69
|
static grpc_error* CreateWithAcceptor(Server* server, const char* name,
|
68
|
-
grpc_channel_args* args
|
70
|
+
grpc_channel_args* args,
|
71
|
+
Chttp2ServerArgsModifier args_modifier);
|
69
72
|
|
70
73
|
// Do not instantiate directly. Use one of the factory methods above.
|
71
|
-
Chttp2ServerListener(Server* server, grpc_channel_args* args
|
74
|
+
Chttp2ServerListener(Server* server, grpc_channel_args* args,
|
75
|
+
Chttp2ServerArgsModifier args_modifier);
|
72
76
|
~Chttp2ServerListener() override;
|
73
77
|
|
74
78
|
void Start(Server* server,
|
@@ -92,9 +96,15 @@ class Chttp2ServerListener : public Server::ListenerInterface {
|
|
92
96
|
void UpdateConfig(grpc_channel_args* args) override {
|
93
97
|
{
|
94
98
|
MutexLock lock(&listener_->mu_);
|
95
|
-
|
96
|
-
|
97
|
-
|
99
|
+
grpc_channel_args_destroy(listener_->args_);
|
100
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
101
|
+
args = listener_->args_modifier_(args, &error);
|
102
|
+
if (error != GRPC_ERROR_NONE) {
|
103
|
+
// TODO(yashykt): Set state to close down connections immediately
|
104
|
+
// after accepting.
|
105
|
+
GPR_ASSERT(0);
|
106
|
+
}
|
107
|
+
listener_->args_ = args;
|
98
108
|
if (!listener_->shutdown_) return; // Already started listening.
|
99
109
|
}
|
100
110
|
int port_temp;
|
@@ -157,10 +167,11 @@ class Chttp2ServerListener : public Server::ListenerInterface {
|
|
157
167
|
grpc_closure* destroy_done);
|
158
168
|
|
159
169
|
Server* const server_;
|
160
|
-
grpc_channel_args* const args_;
|
161
170
|
grpc_tcp_server* tcp_server_;
|
162
171
|
grpc_resolved_address resolved_address_;
|
172
|
+
Chttp2ServerArgsModifier args_modifier_;
|
163
173
|
Mutex mu_;
|
174
|
+
grpc_channel_args* args_; // guarded by mu_
|
164
175
|
ConfigFetcherWatcher* config_fetcher_watcher_ = nullptr;
|
165
176
|
bool shutdown_ = true;
|
166
177
|
grpc_closure tcp_server_shutdown_complete_;
|
@@ -328,13 +339,14 @@ void Chttp2ServerListener::ConnectionState::OnHandshakeDone(void* arg,
|
|
328
339
|
grpc_error* Chttp2ServerListener::Create(Server* server,
|
329
340
|
grpc_resolved_address* addr,
|
330
341
|
grpc_channel_args* args,
|
342
|
+
Chttp2ServerArgsModifier args_modifier,
|
331
343
|
int* port_num) {
|
332
344
|
Chttp2ServerListener* listener = nullptr;
|
333
345
|
// The bulk of this method is inside of a lambda to make cleanup
|
334
346
|
// easier without using goto.
|
335
347
|
grpc_error* error = [&]() {
|
336
348
|
// Create Chttp2ServerListener.
|
337
|
-
listener = new Chttp2ServerListener(server, args);
|
349
|
+
listener = new Chttp2ServerListener(server, args, args_modifier);
|
338
350
|
error = grpc_tcp_server_create(&listener->tcp_server_shutdown_complete_,
|
339
351
|
args, &listener->tcp_server_);
|
340
352
|
if (error != GRPC_ERROR_NONE) return error;
|
@@ -374,10 +386,11 @@ grpc_error* Chttp2ServerListener::Create(Server* server,
|
|
374
386
|
return error;
|
375
387
|
}
|
376
388
|
|
377
|
-
grpc_error* Chttp2ServerListener::CreateWithAcceptor(
|
378
|
-
|
379
|
-
|
380
|
-
Chttp2ServerListener* listener =
|
389
|
+
grpc_error* Chttp2ServerListener::CreateWithAcceptor(
|
390
|
+
Server* server, const char* name, grpc_channel_args* args,
|
391
|
+
Chttp2ServerArgsModifier args_modifier) {
|
392
|
+
Chttp2ServerListener* listener =
|
393
|
+
new Chttp2ServerListener(server, args, args_modifier);
|
381
394
|
grpc_error* error = grpc_tcp_server_create(
|
382
395
|
&listener->tcp_server_shutdown_complete_, args, &listener->tcp_server_);
|
383
396
|
if (error != GRPC_ERROR_NONE) {
|
@@ -392,9 +405,10 @@ grpc_error* Chttp2ServerListener::CreateWithAcceptor(Server* server,
|
|
392
405
|
return GRPC_ERROR_NONE;
|
393
406
|
}
|
394
407
|
|
395
|
-
Chttp2ServerListener::Chttp2ServerListener(
|
396
|
-
|
397
|
-
|
408
|
+
Chttp2ServerListener::Chttp2ServerListener(
|
409
|
+
Server* server, grpc_channel_args* args,
|
410
|
+
Chttp2ServerArgsModifier args_modifier)
|
411
|
+
: server_(server), args_modifier_(args_modifier), args_(args) {
|
398
412
|
GRPC_CLOSURE_INIT(&tcp_server_shutdown_complete_, TcpServerShutdownComplete,
|
399
413
|
this, grpc_schedule_on_exec_ctx);
|
400
414
|
}
|
@@ -407,13 +421,16 @@ Chttp2ServerListener::~Chttp2ServerListener() {
|
|
407
421
|
void Chttp2ServerListener::Start(
|
408
422
|
Server* /*server*/, const std::vector<grpc_pollset*>* /* pollsets */) {
|
409
423
|
if (server_->config_fetcher() != nullptr) {
|
424
|
+
grpc_channel_args* args = nullptr;
|
410
425
|
auto watcher = absl::make_unique<ConfigFetcherWatcher>(this);
|
411
426
|
{
|
412
427
|
MutexLock lock(&mu_);
|
413
428
|
config_fetcher_watcher_ = watcher.get();
|
429
|
+
args = grpc_channel_args_copy(args_);
|
414
430
|
}
|
415
431
|
server_->config_fetcher()->StartWatch(
|
416
|
-
grpc_sockaddr_to_string(&resolved_address_, false),
|
432
|
+
grpc_sockaddr_to_string(&resolved_address_, false), args,
|
433
|
+
std::move(watcher));
|
417
434
|
} else {
|
418
435
|
StartListening();
|
419
436
|
}
|
@@ -459,9 +476,15 @@ void Chttp2ServerListener::OnAccept(void* arg, grpc_endpoint* tcp,
|
|
459
476
|
gpr_free(acceptor);
|
460
477
|
return;
|
461
478
|
}
|
479
|
+
grpc_channel_args* args = nullptr;
|
480
|
+
{
|
481
|
+
MutexLock lock(&self->mu_);
|
482
|
+
args = grpc_channel_args_copy(self->args_);
|
483
|
+
}
|
462
484
|
// Deletes itself when done.
|
463
485
|
new ConnectionState(self, accepting_pollset, acceptor,
|
464
|
-
std::move(handshake_mgr),
|
486
|
+
std::move(handshake_mgr), args, tcp);
|
487
|
+
grpc_channel_args_destroy(args);
|
465
488
|
}
|
466
489
|
|
467
490
|
void Chttp2ServerListener::TcpServerShutdownComplete(void* arg,
|
@@ -513,10 +536,12 @@ void Chttp2ServerListener::Orphan() {
|
|
513
536
|
//
|
514
537
|
|
515
538
|
grpc_error* Chttp2ServerAddPort(Server* server, const char* addr,
|
516
|
-
grpc_channel_args* args,
|
539
|
+
grpc_channel_args* args,
|
540
|
+
Chttp2ServerArgsModifier args_modifier,
|
541
|
+
int* port_num) {
|
517
542
|
if (strncmp(addr, "external:", 9) == 0) {
|
518
|
-
return grpc_core::Chttp2ServerListener::CreateWithAcceptor(
|
519
|
-
|
543
|
+
return grpc_core::Chttp2ServerListener::CreateWithAcceptor(
|
544
|
+
server, addr, args, args_modifier);
|
520
545
|
}
|
521
546
|
*port_num = -1;
|
522
547
|
grpc_resolved_addresses* resolved = nullptr;
|
@@ -540,10 +565,10 @@ grpc_error* Chttp2ServerAddPort(Server* server, const char* addr,
|
|
540
565
|
if (*port_num != -1 && grpc_sockaddr_get_port(&resolved->addrs[i]) == 0) {
|
541
566
|
grpc_sockaddr_set_port(&resolved->addrs[i], *port_num);
|
542
567
|
}
|
543
|
-
int port_temp;
|
568
|
+
int port_temp = -1;
|
544
569
|
error = grpc_core::Chttp2ServerListener::Create(
|
545
570
|
server, &resolved->addrs[i], grpc_channel_args_copy(args),
|
546
|
-
&port_temp);
|
571
|
+
args_modifier, &port_temp);
|
547
572
|
if (error != GRPC_ERROR_NONE) {
|
548
573
|
error_list.push_back(error);
|
549
574
|
} else {
|
@@ -28,10 +28,19 @@
|
|
28
28
|
|
29
29
|
namespace grpc_core {
|
30
30
|
|
31
|
+
// A function to modify channel args for a listening addr:port. Note that this
|
32
|
+
// is used to create a security connector for listeners when the servers are
|
33
|
+
// configured with a config fetcher. Not invoked if there is no config fetcher
|
34
|
+
// added to the server. Takes ownership of the args. Caller takes ownership of
|
35
|
+
// returned args. On failure, the error parameter will be set.
|
36
|
+
using Chttp2ServerArgsModifier =
|
37
|
+
std::function<grpc_channel_args*(grpc_channel_args*, grpc_error**)>;
|
38
|
+
|
31
39
|
/// Adds a port to \a server. Sets \a port_num to the port number.
|
32
40
|
/// Takes ownership of \a args.
|
33
|
-
grpc_error* Chttp2ServerAddPort(
|
34
|
-
|
41
|
+
grpc_error* Chttp2ServerAddPort(
|
42
|
+
Server* server, const char* addr, grpc_channel_args* args,
|
43
|
+
Chttp2ServerArgsModifier connection_args_modifier, int* port_num);
|
35
44
|
|
36
45
|
} // namespace grpc_core
|
37
46
|
|
@@ -27,6 +27,15 @@
|
|
27
27
|
#include "src/core/lib/surface/api_trace.h"
|
28
28
|
#include "src/core/lib/surface/server.h"
|
29
29
|
|
30
|
+
namespace {
|
31
|
+
|
32
|
+
grpc_channel_args* ModifyArgsForConnection(grpc_channel_args* args,
|
33
|
+
grpc_error** /*error*/) {
|
34
|
+
return args;
|
35
|
+
}
|
36
|
+
|
37
|
+
} // namespace
|
38
|
+
|
30
39
|
int grpc_server_add_insecure_http2_port(grpc_server* server, const char* addr) {
|
31
40
|
grpc_core::ExecCtx exec_ctx;
|
32
41
|
int port_num = 0;
|
@@ -34,7 +43,8 @@ int grpc_server_add_insecure_http2_port(grpc_server* server, const char* addr) {
|
|
34
43
|
(server, addr));
|
35
44
|
grpc_error* err = grpc_core::Chttp2ServerAddPort(
|
36
45
|
server->core_server.get(), addr,
|
37
|
-
grpc_channel_args_copy(server->core_server->channel_args()),
|
46
|
+
grpc_channel_args_copy(server->core_server->channel_args()),
|
47
|
+
ModifyArgsForConnection, &port_num);
|
38
48
|
if (err != GRPC_ERROR_NONE) {
|
39
49
|
const char* msg = grpc_error_string(err);
|
40
50
|
gpr_log(GPR_ERROR, "%s", msg);
|
@@ -18,12 +18,11 @@
|
|
18
18
|
|
19
19
|
#include <grpc/support/port_platform.h>
|
20
20
|
|
21
|
-
#include <grpc/grpc.h>
|
22
|
-
|
23
21
|
#include <string.h>
|
24
22
|
|
25
23
|
#include "absl/strings/str_cat.h"
|
26
24
|
|
25
|
+
#include <grpc/grpc.h>
|
27
26
|
#include <grpc/support/alloc.h>
|
28
27
|
#include <grpc/support/log.h>
|
29
28
|
|
@@ -38,6 +37,35 @@
|
|
38
37
|
#include "src/core/lib/surface/api_trace.h"
|
39
38
|
#include "src/core/lib/surface/server.h"
|
40
39
|
|
40
|
+
namespace {
|
41
|
+
|
42
|
+
grpc_channel_args* ModifyArgsForConnection(grpc_channel_args* args,
|
43
|
+
grpc_error** error) {
|
44
|
+
grpc_server_credentials* server_credentials =
|
45
|
+
grpc_find_server_credentials_in_args(args);
|
46
|
+
if (server_credentials == nullptr) {
|
47
|
+
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
48
|
+
"Could not find server credentials");
|
49
|
+
return args;
|
50
|
+
}
|
51
|
+
auto security_connector = server_credentials->create_security_connector(args);
|
52
|
+
if (security_connector == nullptr) {
|
53
|
+
*error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
54
|
+
absl::StrCat("Unable to create secure server with credentials of type ",
|
55
|
+
server_credentials->type())
|
56
|
+
.c_str());
|
57
|
+
return args;
|
58
|
+
}
|
59
|
+
grpc_arg arg_to_add =
|
60
|
+
grpc_security_connector_to_arg(security_connector.get());
|
61
|
+
grpc_channel_args* new_args =
|
62
|
+
grpc_channel_args_copy_and_add(args, &arg_to_add, 1);
|
63
|
+
grpc_channel_args_destroy(args);
|
64
|
+
return new_args;
|
65
|
+
}
|
66
|
+
|
67
|
+
} // namespace
|
68
|
+
|
41
69
|
int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
|
42
70
|
grpc_server_credentials* creds) {
|
43
71
|
grpc_core::ExecCtx exec_ctx;
|
@@ -55,27 +83,43 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
|
|
55
83
|
"No credentials specified for secure server port (creds==NULL)");
|
56
84
|
goto done;
|
57
85
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
86
|
+
// TODO(yashykt): Ideally, we would not want to have different behavior here
|
87
|
+
// based on whether a config fetcher is configured or not. Currently, we have
|
88
|
+
// a feature for SSL credentials reloading with an application callback that
|
89
|
+
// assumes that there is a single security connector. If we delay the creation
|
90
|
+
// of the security connector to after the creation of the listener(s), we
|
91
|
+
// would have potentially multiple security connectors which breaks the
|
92
|
+
// assumption for SSL creds reloading. When the API for SSL creds reloading is
|
93
|
+
// rewritten, we would be able to make this workaround go away by removing
|
94
|
+
// that assumption. As an immediate drawback of this workaround, config
|
95
|
+
// fetchers need to be registered before adding ports to the server.
|
96
|
+
if (server->core_server->config_fetcher() != nullptr) {
|
97
|
+
// Create channel args.
|
98
|
+
grpc_arg arg_to_add = grpc_server_credentials_to_arg(creds);
|
99
|
+
args = grpc_channel_args_copy_and_add(server->core_server->channel_args(),
|
100
|
+
&arg_to_add, 1);
|
101
|
+
} else {
|
102
|
+
sc = creds->create_security_connector(nullptr);
|
103
|
+
if (sc == nullptr) {
|
104
|
+
err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
105
|
+
absl::StrCat(
|
106
|
+
"Unable to create secure server with credentials of type ",
|
107
|
+
creds->type())
|
108
|
+
.c_str());
|
109
|
+
goto done;
|
110
|
+
}
|
111
|
+
grpc_arg args_to_add[2];
|
112
|
+
args_to_add[0] = grpc_server_credentials_to_arg(creds);
|
113
|
+
args_to_add[1] = grpc_security_connector_to_arg(sc.get());
|
114
|
+
args = grpc_channel_args_copy_and_add(server->core_server->channel_args(),
|
115
|
+
args_to_add,
|
116
|
+
GPR_ARRAY_SIZE(args_to_add));
|
65
117
|
}
|
66
|
-
// Create channel args.
|
67
|
-
grpc_arg args_to_add[2];
|
68
|
-
args_to_add[0] = grpc_server_credentials_to_arg(creds);
|
69
|
-
args_to_add[1] = grpc_security_connector_to_arg(sc.get());
|
70
|
-
args =
|
71
|
-
grpc_channel_args_copy_and_add(server->core_server->channel_args(),
|
72
|
-
args_to_add, GPR_ARRAY_SIZE(args_to_add));
|
73
118
|
// Add server port.
|
74
119
|
err = grpc_core::Chttp2ServerAddPort(server->core_server.get(), addr, args,
|
75
|
-
&port_num);
|
120
|
+
ModifyArgsForConnection, &port_num);
|
76
121
|
done:
|
77
122
|
sc.reset(DEBUG_LOCATION, "server");
|
78
|
-
|
79
123
|
if (err != GRPC_ERROR_NONE) {
|
80
124
|
const char* msg = grpc_error_string(err);
|
81
125
|
gpr_log(GPR_ERROR, "%s", msg);
|