grpc 1.30.2 → 1.31.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 +560 -619
- data/include/grpc/grpc_security_constants.h +3 -0
- data/include/grpc/impl/codegen/grpc_types.h +7 -5
- data/include/grpc/impl/codegen/port_platform.h +0 -32
- data/src/core/ext/filters/client_channel/backend_metric.cc +12 -9
- data/src/core/ext/filters/client_channel/client_channel.cc +406 -265
- data/src/core/ext/filters/client_channel/config_selector.cc +62 -0
- data/src/core/ext/filters/client_channel/config_selector.h +93 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +6 -5
- data/src/core/ext/filters/client_channel/http_proxy.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +39 -23
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +4 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +376 -68
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +5 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +6 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +8 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +9 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +7 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +33 -48
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +21 -18
- data/src/core/ext/filters/client_channel/resolver_registry.cc +13 -14
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +6 -7
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +33 -28
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +39 -20
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +142 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +1 -1
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +327 -123
- data/src/core/ext/filters/client_channel/xds/xds_api.h +72 -7
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +12 -23
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +112 -33
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +10 -10
- data/src/core/ext/filters/http/client/http_client_filter.cc +5 -5
- data/src/core/ext/filters/http/http_filters_plugin.cc +2 -1
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +74 -33
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +3 -1
- data/src/core/ext/filters/message_size/message_size_filter.cc +56 -80
- data/src/core/ext/filters/message_size/message_size_filter.h +6 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +383 -347
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +6 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -13
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +19 -4
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +22 -27
- data/src/core/ext/transport/chttp2/transport/flow_control.h +14 -16
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -13
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +25 -29
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +13 -17
- data/src/core/ext/transport/chttp2/transport/internal.h +13 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +33 -43
- data/src/core/ext/transport/chttp2/transport/writing.cc +9 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +35 -15
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +3 -4
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +80 -69
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +24 -23
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +66 -56
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +317 -311
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +42 -34
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +7 -7
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +79 -61
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +55 -49
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +9 -8
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +163 -169
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +51 -45
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +4 -5
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +107 -100
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +137 -117
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +9 -9
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +105 -87
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +12 -13
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +95 -101
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +49 -65
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +49 -42
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +70 -62
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +81 -65
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +91 -80
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +9 -10
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +36 -31
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +648 -696
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +16 -15
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +95 -88
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +234 -199
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +5 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +13 -13
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +20 -18
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +18 -17
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +14 -14
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +23 -23
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +8 -9
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +15 -16
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +7 -8
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +36 -35
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/http.upb.h +29 -28
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +3 -3
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +412 -386
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -2
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +33 -54
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +27 -28
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +8 -8
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +1 -1
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +32 -45
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +157 -178
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +14 -13
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +6 -7
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +59 -56
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +11 -12
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +0 -1
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +5 -6
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +6 -6
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +41 -68
- data/src/core/ext/upb-generated/validate/validate.upb.h +536 -535
- data/src/core/lib/channel/channel_trace.cc +2 -6
- data/src/core/lib/channel/channelz.cc +5 -15
- data/src/core/lib/gpr/log_linux.cc +6 -8
- data/src/core/lib/gpr/log_posix.cc +6 -8
- data/src/core/lib/gpr/string.cc +10 -9
- data/src/core/lib/gpr/string.h +4 -2
- data/src/core/lib/gprpp/global_config_env.cc +8 -6
- data/src/core/lib/http/httpcli.cc +13 -10
- data/src/core/lib/http/httpcli_security_connector.cc +5 -5
- data/src/core/lib/iomgr/cfstream_handle.cc +1 -0
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
- data/src/core/lib/iomgr/error_cfstream.cc +9 -8
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -6
- data/src/core/lib/iomgr/ev_epollex_linux.cc +15 -21
- data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
- data/src/core/lib/iomgr/ev_posix.cc +2 -0
- data/src/core/lib/iomgr/iomgr.cc +10 -0
- data/src/core/lib/iomgr/iomgr.h +10 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
- data/src/core/lib/iomgr/port.h +1 -21
- data/src/core/lib/iomgr/resolve_address_custom.cc +13 -18
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -8
- data/src/core/lib/iomgr/resource_quota.cc +34 -31
- data/src/core/lib/iomgr/sockaddr_utils.cc +7 -5
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +95 -55
- data/src/core/lib/iomgr/socket_windows.cc +4 -5
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +9 -11
- data/src/core/lib/iomgr/tcp_client_custom.cc +6 -9
- data/src/core/lib/iomgr/tcp_client_posix.cc +27 -36
- data/src/core/lib/iomgr/tcp_client_windows.cc +9 -9
- data/src/core/lib/iomgr/tcp_custom.cc +1 -1
- data/src/core/lib/iomgr/tcp_custom.h +1 -1
- data/src/core/lib/iomgr/tcp_server.cc +3 -4
- data/src/core/lib/iomgr/tcp_server.h +7 -5
- data/src/core/lib/iomgr/tcp_server_custom.cc +6 -14
- data/src/core/lib/iomgr/tcp_server_posix.cc +34 -41
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -7
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +4 -9
- data/src/core/lib/iomgr/tcp_server_windows.cc +16 -16
- data/src/core/lib/iomgr/timer_generic.cc +13 -12
- data/src/core/lib/iomgr/udp_server.cc +24 -23
- data/src/core/lib/iomgr/udp_server.h +5 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +9 -14
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +5 -2
- data/src/core/lib/json/json_reader.cc +20 -21
- data/src/core/lib/security/credentials/credentials.h +5 -3
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +8 -6
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +12 -9
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -4
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +19 -28
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -6
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +10 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -10
- data/src/core/lib/security/security_connector/security_connector.cc +2 -0
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +18 -11
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +5 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +44 -23
- data/src/core/lib/security/security_connector/ssl_utils.h +6 -2
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +27 -24
- data/src/core/lib/security/transport/client_auth_filter.cc +10 -9
- data/src/core/lib/security/util/json_util.cc +12 -13
- data/src/core/lib/slice/slice.cc +38 -1
- data/src/core/lib/slice/slice_internal.h +1 -0
- data/src/core/lib/surface/call.cc +40 -41
- data/src/core/lib/surface/completion_queue.cc +271 -14
- data/src/core/lib/surface/completion_queue.h +8 -0
- data/src/core/lib/surface/init.cc +2 -0
- data/src/core/lib/surface/server.cc +565 -632
- data/src/core/lib/surface/server.h +34 -12
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/transport.h +6 -0
- data/src/core/lib/uri/uri_parser.cc +8 -15
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +23 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -0
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -0
- data/src/core/tsi/ssl_transport_security.cc +102 -11
- data/src/core/tsi/ssl_transport_security.h +14 -2
- data/src/core/tsi/transport_security_interface.h +5 -0
- data/src/ruby/ext/grpc/extconf.rb +5 -2
- data/src/ruby/ext/grpc/rb_call.c +3 -2
- data/src/ruby/ext/grpc/rb_call.h +4 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +54 -10
- data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/err_data.c +89 -83
- 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 +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +12 -52
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +0 -22
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +143 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +11 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +13 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +24 -23
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +20 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -15
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +36 -5
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +0 -29
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +116 -363
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +7 -45
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -67
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +13 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +41 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +28 -9
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +35 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +0 -154
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +28 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +74 -35
- data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +16 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +22 -22
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +69 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +33 -16
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +789 -715
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +9 -2
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +9 -0
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +17 -14
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -7
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +28 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +4 -24
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +5 -5
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +45 -24
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +31 -21
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +12 -9
- data/third_party/upb/upb/decode.c +467 -504
- data/third_party/upb/upb/encode.c +163 -121
- data/third_party/upb/upb/msg.c +130 -64
- data/third_party/upb/upb/msg.h +418 -14
- data/third_party/upb/upb/port_def.inc +35 -6
- data/third_party/upb/upb/port_undef.inc +8 -1
- data/third_party/upb/upb/table.c +53 -75
- data/third_party/upb/upb/table.int.h +11 -43
- data/third_party/upb/upb/upb.c +148 -124
- data/third_party/upb/upb/upb.h +65 -147
- data/third_party/upb/upb/upb.hpp +86 -0
- metadata +40 -37
- data/third_party/upb/upb/generated_util.h +0 -105
@@ -23,9 +23,12 @@
|
|
23
23
|
#include <cstdlib>
|
24
24
|
|
25
25
|
#include "absl/strings/str_cat.h"
|
26
|
+
#include "absl/strings/str_format.h"
|
26
27
|
#include "absl/strings/str_join.h"
|
27
28
|
#include "absl/strings/str_split.h"
|
28
29
|
|
30
|
+
#include "upb/upb.hpp"
|
31
|
+
|
29
32
|
#include <grpc/impl/codegen/log.h>
|
30
33
|
#include <grpc/support/alloc.h>
|
31
34
|
#include <grpc/support/string_util.h>
|
@@ -52,7 +55,9 @@
|
|
52
55
|
#include "envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h"
|
53
56
|
#include "envoy/config/listener/v2/api_listener.upb.h"
|
54
57
|
#include "envoy/service/load_stats/v2/lrs.upb.h"
|
58
|
+
#include "envoy/type/matcher/regex.upb.h"
|
55
59
|
#include "envoy/type/percent.upb.h"
|
60
|
+
#include "envoy/type/range.upb.h"
|
56
61
|
#include "google/protobuf/any.upb.h"
|
57
62
|
#include "google/protobuf/duration.upb.h"
|
58
63
|
#include "google/protobuf/struct.upb.h"
|
@@ -129,23 +134,98 @@ const char* XdsApi::kCdsTypeUrl = "type.googleapis.com/envoy.api.v2.Cluster";
|
|
129
134
|
const char* XdsApi::kEdsTypeUrl =
|
130
135
|
"type.googleapis.com/envoy.api.v2.ClusterLoadAssignment";
|
131
136
|
|
132
|
-
|
137
|
+
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::ToString()
|
138
|
+
const {
|
139
|
+
std::string path_type_string;
|
140
|
+
switch (type) {
|
141
|
+
case PathMatcherType::PATH:
|
142
|
+
path_type_string = "path match";
|
143
|
+
break;
|
144
|
+
case PathMatcherType::PREFIX:
|
145
|
+
path_type_string = "prefix match";
|
146
|
+
break;
|
147
|
+
case PathMatcherType::REGEX:
|
148
|
+
path_type_string = "regex match";
|
149
|
+
break;
|
150
|
+
default:
|
151
|
+
break;
|
152
|
+
}
|
153
|
+
return absl::StrFormat("Path %s:/%s/", path_type_string,
|
154
|
+
type == PathMatcherType::REGEX
|
155
|
+
? regex_matcher->pattern()
|
156
|
+
: string_matcher);
|
157
|
+
}
|
133
158
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
159
|
+
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::ToString()
|
160
|
+
const {
|
161
|
+
switch (type) {
|
162
|
+
case HeaderMatcherType::EXACT:
|
163
|
+
return absl::StrFormat("Header exact match:%s %s:%s",
|
164
|
+
invert_match ? " not" : "", name, string_matcher);
|
165
|
+
case HeaderMatcherType::REGEX:
|
166
|
+
return absl::StrFormat("Header regex match:%s %s:%s",
|
167
|
+
invert_match ? " not" : "", name,
|
168
|
+
regex_match->pattern());
|
169
|
+
case HeaderMatcherType::RANGE:
|
170
|
+
return absl::StrFormat("Header range match:%s %s:[%d, %d)",
|
171
|
+
invert_match ? " not" : "", name, range_start,
|
172
|
+
range_end);
|
173
|
+
case HeaderMatcherType::PRESENT:
|
174
|
+
return absl::StrFormat("Header present match:%s %s:%s",
|
175
|
+
invert_match ? " not" : "", name,
|
176
|
+
present_match ? "true" : "false");
|
177
|
+
case HeaderMatcherType::PREFIX:
|
178
|
+
return absl::StrFormat("Header prefix match:%s %s:%s",
|
179
|
+
invert_match ? " not" : "", name, string_matcher);
|
180
|
+
case HeaderMatcherType::SUFFIX:
|
181
|
+
return absl::StrFormat("Header suffix match:%s %s:%s",
|
182
|
+
invert_match ? " not" : "", name, string_matcher);
|
183
|
+
default:
|
184
|
+
return "";
|
185
|
+
}
|
140
186
|
}
|
141
187
|
|
142
|
-
|
188
|
+
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::ToString() const {
|
189
|
+
std::vector<std::string> contents;
|
190
|
+
contents.push_back(path_matcher.ToString());
|
191
|
+
for (const auto& header_it : header_matchers) {
|
192
|
+
contents.push_back(header_it.ToString());
|
193
|
+
}
|
194
|
+
if (fraction_per_million.has_value()) {
|
195
|
+
contents.push_back(absl::StrFormat("Fraction Per Million %d",
|
196
|
+
fraction_per_million.value()));
|
197
|
+
}
|
198
|
+
return absl::StrJoin(contents, "\n");
|
199
|
+
}
|
200
|
+
|
201
|
+
std::string XdsApi::RdsUpdate::RdsRoute::ClusterWeight::ToString() const {
|
202
|
+
return absl::StrFormat("{cluster=%s, weight=%d}", name, weight);
|
203
|
+
}
|
204
|
+
|
205
|
+
std::string XdsApi::RdsUpdate::RdsRoute::ToString() const {
|
206
|
+
std::vector<std::string> contents;
|
207
|
+
contents.push_back(matchers.ToString());
|
208
|
+
if (!cluster_name.empty()) {
|
209
|
+
contents.push_back(absl::StrFormat("Cluster name: %s", cluster_name));
|
210
|
+
}
|
211
|
+
for (const auto& weighted_it : weighted_clusters) {
|
212
|
+
contents.push_back(weighted_it.ToString());
|
213
|
+
}
|
214
|
+
return absl::StrJoin(contents, "\n");
|
215
|
+
}
|
216
|
+
|
217
|
+
std::string XdsApi::RdsUpdate::ToString() const {
|
218
|
+
std::vector<std::string> contents;
|
219
|
+
for (const auto& route_it : routes) {
|
220
|
+
contents.push_back(route_it.ToString());
|
221
|
+
}
|
222
|
+
return absl::StrJoin(contents, ",\n");
|
223
|
+
}
|
143
224
|
|
144
225
|
XdsApi::XdsApi(XdsClient* client, TraceFlag* tracer,
|
145
226
|
const XdsBootstrap::Node* node)
|
146
227
|
: client_(client),
|
147
228
|
tracer_(tracer),
|
148
|
-
xds_routing_enabled_(XdsRoutingEnabled()),
|
149
229
|
node_(node),
|
150
230
|
build_version_(absl::StrCat("gRPC C-core ", GPR_PLATFORM_STRING, " ",
|
151
231
|
grpc_version_string())),
|
@@ -167,13 +247,10 @@ void PopulateListValue(upb_arena* arena, google_protobuf_ListValue* list_value,
|
|
167
247
|
void PopulateMetadata(upb_arena* arena, google_protobuf_Struct* metadata_pb,
|
168
248
|
const Json::Object& metadata) {
|
169
249
|
for (const auto& p : metadata) {
|
170
|
-
|
171
|
-
google_protobuf_Struct_add_fields(metadata_pb, arena);
|
172
|
-
google_protobuf_Struct_FieldsEntry_set_key(
|
173
|
-
field, upb_strview_makez(p.first.c_str()));
|
174
|
-
google_protobuf_Value* value =
|
175
|
-
google_protobuf_Struct_FieldsEntry_mutable_value(field, arena);
|
250
|
+
google_protobuf_Value* value = google_protobuf_Value_new(arena);
|
176
251
|
PopulateMetadataValue(arena, value, p.second);
|
252
|
+
google_protobuf_Struct_fields_set(
|
253
|
+
metadata_pb, upb_strview_makez(p.first.c_str()), value, arena);
|
177
254
|
}
|
178
255
|
}
|
179
256
|
|
@@ -234,14 +311,12 @@ void PopulateNode(upb_arena* arena, const XdsBootstrap::Node* node,
|
|
234
311
|
if (!server_name.empty()) {
|
235
312
|
google_protobuf_Struct* metadata =
|
236
313
|
envoy_api_v2_core_Node_mutable_metadata(node_msg, arena);
|
237
|
-
|
238
|
-
google_protobuf_Struct_add_fields(metadata, arena);
|
239
|
-
google_protobuf_Struct_FieldsEntry_set_key(
|
240
|
-
field, upb_strview_makez("PROXYLESS_CLIENT_HOSTNAME"));
|
241
|
-
google_protobuf_Value* value =
|
242
|
-
google_protobuf_Struct_FieldsEntry_mutable_value(field, arena);
|
314
|
+
google_protobuf_Value* value = google_protobuf_Value_new(arena);
|
243
315
|
google_protobuf_Value_set_string_value(
|
244
316
|
value, upb_strview_make(server_name.data(), server_name.size()));
|
317
|
+
google_protobuf_Struct_fields_set(
|
318
|
+
metadata, upb_strview_makez("PROXYLESS_CLIENT_HOSTNAME"), value,
|
319
|
+
arena);
|
245
320
|
}
|
246
321
|
if (!node->locality_region.empty() || !node->locality_zone.empty() ||
|
247
322
|
!node->locality_subzone.empty()) {
|
@@ -328,18 +403,18 @@ void AddNodeLogFields(const envoy_api_v2_core_Node* node,
|
|
328
403
|
envoy_api_v2_core_Node_metadata(node);
|
329
404
|
if (metadata != nullptr) {
|
330
405
|
fields->emplace_back(" metadata {");
|
331
|
-
size_t
|
332
|
-
|
333
|
-
|
334
|
-
|
406
|
+
size_t entry_idx = UPB_MAP_BEGIN;
|
407
|
+
while (true) {
|
408
|
+
const google_protobuf_Struct_FieldsEntry* entry =
|
409
|
+
google_protobuf_Struct_fields_next(metadata, &entry_idx);
|
410
|
+
if (entry == nullptr) break;
|
335
411
|
fields->emplace_back(" field {");
|
336
412
|
// key
|
337
|
-
AddStringField(" key",
|
338
|
-
google_protobuf_Struct_FieldsEntry_key(entries[i]),
|
413
|
+
AddStringField(" key", google_protobuf_Struct_FieldsEntry_key(entry),
|
339
414
|
fields);
|
340
415
|
// value
|
341
416
|
const google_protobuf_Value* value =
|
342
|
-
google_protobuf_Struct_FieldsEntry_value(
|
417
|
+
google_protobuf_Struct_FieldsEntry_value(entry);
|
343
418
|
if (value != nullptr) {
|
344
419
|
std::string value_str;
|
345
420
|
if (google_protobuf_Value_has_string_value(value)) {
|
@@ -918,8 +993,198 @@ MatchType DomainPatternMatchType(const std::string& domain_pattern) {
|
|
918
993
|
return INVALID_MATCH;
|
919
994
|
}
|
920
995
|
|
996
|
+
grpc_error* RoutePathMatchParse(const envoy_api_v2_route_RouteMatch* match,
|
997
|
+
XdsApi::RdsUpdate::RdsRoute* rds_route,
|
998
|
+
bool* ignore_route) {
|
999
|
+
if (envoy_api_v2_route_RouteMatch_has_prefix(match)) {
|
1000
|
+
upb_strview prefix = envoy_api_v2_route_RouteMatch_prefix(match);
|
1001
|
+
// Empty prefix "" is accepted.
|
1002
|
+
if (prefix.size > 0) {
|
1003
|
+
// Prefix "/" is accepted.
|
1004
|
+
if (prefix.data[0] != '/') {
|
1005
|
+
// Prefix which does not start with a / will never match anything, so
|
1006
|
+
// ignore this route.
|
1007
|
+
*ignore_route = true;
|
1008
|
+
return GRPC_ERROR_NONE;
|
1009
|
+
}
|
1010
|
+
std::vector<absl::string_view> prefix_elements =
|
1011
|
+
absl::StrSplit(absl::string_view(prefix.data, prefix.size).substr(1),
|
1012
|
+
absl::MaxSplits('/', 2));
|
1013
|
+
if (prefix_elements.size() > 2) {
|
1014
|
+
// Prefix cannot have more than 2 slashes.
|
1015
|
+
*ignore_route = true;
|
1016
|
+
return GRPC_ERROR_NONE;
|
1017
|
+
} else if (prefix_elements.size() == 2 && prefix_elements[0].empty()) {
|
1018
|
+
// Prefix contains empty string between the 2 slashes
|
1019
|
+
*ignore_route = true;
|
1020
|
+
return GRPC_ERROR_NONE;
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
1024
|
+
Matchers::PathMatcher::PathMatcherType::PREFIX;
|
1025
|
+
rds_route->matchers.path_matcher.string_matcher =
|
1026
|
+
UpbStringToStdString(prefix);
|
1027
|
+
} else if (envoy_api_v2_route_RouteMatch_has_path(match)) {
|
1028
|
+
upb_strview path = envoy_api_v2_route_RouteMatch_path(match);
|
1029
|
+
if (path.size == 0) {
|
1030
|
+
// Path that is empty will never match anything, so ignore this route.
|
1031
|
+
*ignore_route = true;
|
1032
|
+
return GRPC_ERROR_NONE;
|
1033
|
+
}
|
1034
|
+
if (path.data[0] != '/') {
|
1035
|
+
// Path which does not start with a / will never match anything, so
|
1036
|
+
// ignore this route.
|
1037
|
+
*ignore_route = true;
|
1038
|
+
return GRPC_ERROR_NONE;
|
1039
|
+
}
|
1040
|
+
std::vector<absl::string_view> path_elements =
|
1041
|
+
absl::StrSplit(absl::string_view(path.data, path.size).substr(1),
|
1042
|
+
absl::MaxSplits('/', 2));
|
1043
|
+
if (path_elements.size() != 2) {
|
1044
|
+
// Path not in the required format of /service/method will never match
|
1045
|
+
// anything, so ignore this route.
|
1046
|
+
*ignore_route = true;
|
1047
|
+
return GRPC_ERROR_NONE;
|
1048
|
+
} else if (path_elements[0].empty()) {
|
1049
|
+
// Path contains empty service name will never match anything, so ignore
|
1050
|
+
// this route.
|
1051
|
+
*ignore_route = true;
|
1052
|
+
return GRPC_ERROR_NONE;
|
1053
|
+
} else if (path_elements[1].empty()) {
|
1054
|
+
// Path contains empty method name will never match anything, so ignore
|
1055
|
+
// this route.
|
1056
|
+
*ignore_route = true;
|
1057
|
+
return GRPC_ERROR_NONE;
|
1058
|
+
}
|
1059
|
+
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
1060
|
+
Matchers::PathMatcher::PathMatcherType::PATH;
|
1061
|
+
rds_route->matchers.path_matcher.string_matcher =
|
1062
|
+
UpbStringToStdString(path);
|
1063
|
+
} else if (envoy_api_v2_route_RouteMatch_has_safe_regex(match)) {
|
1064
|
+
const envoy_type_matcher_RegexMatcher* regex_matcher =
|
1065
|
+
envoy_api_v2_route_RouteMatch_safe_regex(match);
|
1066
|
+
GPR_ASSERT(regex_matcher != nullptr);
|
1067
|
+
const std::string matcher = UpbStringToStdString(
|
1068
|
+
envoy_type_matcher_RegexMatcher_regex(regex_matcher));
|
1069
|
+
std::unique_ptr<RE2> regex = absl::make_unique<RE2>(matcher);
|
1070
|
+
if (!regex->ok()) {
|
1071
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1072
|
+
"Invalid regex string specified in path matcher.");
|
1073
|
+
}
|
1074
|
+
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
1075
|
+
Matchers::PathMatcher::PathMatcherType::REGEX;
|
1076
|
+
rds_route->matchers.path_matcher.regex_matcher = std::move(regex);
|
1077
|
+
} else {
|
1078
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1079
|
+
"Invalid route path specifier specified.");
|
1080
|
+
}
|
1081
|
+
return GRPC_ERROR_NONE;
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
grpc_error* RouteHeaderMatchersParse(const envoy_api_v2_route_RouteMatch* match,
|
1085
|
+
XdsApi::RdsUpdate::RdsRoute* rds_route) {
|
1086
|
+
size_t size;
|
1087
|
+
const envoy_api_v2_route_HeaderMatcher* const* headers =
|
1088
|
+
envoy_api_v2_route_RouteMatch_headers(match, &size);
|
1089
|
+
for (size_t i = 0; i < size; ++i) {
|
1090
|
+
const envoy_api_v2_route_HeaderMatcher* header = headers[i];
|
1091
|
+
XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher header_matcher;
|
1092
|
+
header_matcher.name =
|
1093
|
+
UpbStringToStdString(envoy_api_v2_route_HeaderMatcher_name(header));
|
1094
|
+
if (envoy_api_v2_route_HeaderMatcher_has_exact_match(header)) {
|
1095
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1096
|
+
HeaderMatcher::HeaderMatcherType::EXACT;
|
1097
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1098
|
+
envoy_api_v2_route_HeaderMatcher_exact_match(header));
|
1099
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_safe_regex_match(header)) {
|
1100
|
+
const envoy_type_matcher_RegexMatcher* regex_matcher =
|
1101
|
+
envoy_api_v2_route_HeaderMatcher_safe_regex_match(header);
|
1102
|
+
GPR_ASSERT(regex_matcher != nullptr);
|
1103
|
+
const std::string matcher = UpbStringToStdString(
|
1104
|
+
envoy_type_matcher_RegexMatcher_regex(regex_matcher));
|
1105
|
+
std::unique_ptr<RE2> regex = absl::make_unique<RE2>(matcher);
|
1106
|
+
if (!regex->ok()) {
|
1107
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1108
|
+
"Invalid regex string specified in header matcher.");
|
1109
|
+
}
|
1110
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1111
|
+
HeaderMatcher::HeaderMatcherType::REGEX;
|
1112
|
+
header_matcher.regex_match = std::move(regex);
|
1113
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_range_match(header)) {
|
1114
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1115
|
+
HeaderMatcher::HeaderMatcherType::RANGE;
|
1116
|
+
const envoy_type_Int64Range* range_matcher =
|
1117
|
+
envoy_api_v2_route_HeaderMatcher_range_match(header);
|
1118
|
+
header_matcher.range_start = envoy_type_Int64Range_start(range_matcher);
|
1119
|
+
header_matcher.range_end = envoy_type_Int64Range_end(range_matcher);
|
1120
|
+
if (header_matcher.range_end < header_matcher.range_start) {
|
1121
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1122
|
+
"Invalid range header matcher specifier specified: end "
|
1123
|
+
"cannot be smaller than start.");
|
1124
|
+
}
|
1125
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_present_match(header)) {
|
1126
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1127
|
+
HeaderMatcher::HeaderMatcherType::PRESENT;
|
1128
|
+
header_matcher.present_match =
|
1129
|
+
envoy_api_v2_route_HeaderMatcher_present_match(header);
|
1130
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_prefix_match(header)) {
|
1131
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1132
|
+
HeaderMatcher::HeaderMatcherType::PREFIX;
|
1133
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1134
|
+
envoy_api_v2_route_HeaderMatcher_prefix_match(header));
|
1135
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_suffix_match(header)) {
|
1136
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1137
|
+
HeaderMatcher::HeaderMatcherType::SUFFIX;
|
1138
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1139
|
+
envoy_api_v2_route_HeaderMatcher_suffix_match(header));
|
1140
|
+
} else {
|
1141
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1142
|
+
"Invalid route header matcher specified.");
|
1143
|
+
}
|
1144
|
+
header_matcher.invert_match =
|
1145
|
+
envoy_api_v2_route_HeaderMatcher_invert_match(header);
|
1146
|
+
rds_route->matchers.header_matchers.emplace_back(std::move(header_matcher));
|
1147
|
+
}
|
1148
|
+
return GRPC_ERROR_NONE;
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
grpc_error* RouteRuntimeFractionParse(
|
1152
|
+
const envoy_api_v2_route_RouteMatch* match,
|
1153
|
+
XdsApi::RdsUpdate::RdsRoute* rds_route) {
|
1154
|
+
const envoy_api_v2_core_RuntimeFractionalPercent* runtime_fraction =
|
1155
|
+
envoy_api_v2_route_RouteMatch_runtime_fraction(match);
|
1156
|
+
if (runtime_fraction != nullptr) {
|
1157
|
+
const envoy_type_FractionalPercent* fraction =
|
1158
|
+
envoy_api_v2_core_RuntimeFractionalPercent_default_value(
|
1159
|
+
runtime_fraction);
|
1160
|
+
if (fraction != nullptr) {
|
1161
|
+
uint32_t numerator = envoy_type_FractionalPercent_numerator(fraction);
|
1162
|
+
const auto denominator =
|
1163
|
+
static_cast<envoy_type_FractionalPercent_DenominatorType>(
|
1164
|
+
envoy_type_FractionalPercent_denominator(fraction));
|
1165
|
+
// Normalize to million.
|
1166
|
+
switch (denominator) {
|
1167
|
+
case envoy_type_FractionalPercent_HUNDRED:
|
1168
|
+
numerator *= 10000;
|
1169
|
+
break;
|
1170
|
+
case envoy_type_FractionalPercent_TEN_THOUSAND:
|
1171
|
+
numerator *= 100;
|
1172
|
+
break;
|
1173
|
+
case envoy_type_FractionalPercent_MILLION:
|
1174
|
+
break;
|
1175
|
+
default:
|
1176
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1177
|
+
"Unknown denominator type");
|
1178
|
+
}
|
1179
|
+
rds_route->matchers.fraction_per_million = numerator;
|
1180
|
+
}
|
1181
|
+
}
|
1182
|
+
return GRPC_ERROR_NONE;
|
1183
|
+
}
|
1184
|
+
|
921
1185
|
grpc_error* RouteActionParse(const envoy_api_v2_route_Route* route,
|
922
|
-
XdsApi::RdsUpdate::RdsRoute* rds_route
|
1186
|
+
XdsApi::RdsUpdate::RdsRoute* rds_route,
|
1187
|
+
bool* ignore_route) {
|
923
1188
|
if (!envoy_api_v2_route_Route_has_route(route)) {
|
924
1189
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
925
1190
|
"No RouteAction found in route.");
|
@@ -982,8 +1247,9 @@ grpc_error* RouteActionParse(const envoy_api_v2_route_Route* route,
|
|
982
1247
|
"RouteAction weighted_cluster has no valid clusters specified.");
|
983
1248
|
}
|
984
1249
|
} else {
|
985
|
-
|
986
|
-
|
1250
|
+
// No cluster or weighted_clusters found in RouteAction, ignore this route.
|
1251
|
+
*ignore_route = true;
|
1252
|
+
return GRPC_ERROR_NONE;
|
987
1253
|
}
|
988
1254
|
return GRPC_ERROR_NONE;
|
989
1255
|
}
|
@@ -991,8 +1257,7 @@ grpc_error* RouteActionParse(const envoy_api_v2_route_Route* route,
|
|
991
1257
|
grpc_error* RouteConfigParse(
|
992
1258
|
XdsClient* client, TraceFlag* tracer,
|
993
1259
|
const envoy_api_v2_RouteConfiguration* route_config,
|
994
|
-
const std::string& expected_server_name,
|
995
|
-
XdsApi::RdsUpdate* rds_update) {
|
1260
|
+
const std::string& expected_server_name, XdsApi::RdsUpdate* rds_update) {
|
996
1261
|
MaybeLogRouteConfiguration(client, tracer, route_config);
|
997
1262
|
// Get the virtual hosts.
|
998
1263
|
size_t size;
|
@@ -1052,93 +1317,36 @@ grpc_error* RouteConfigParse(
|
|
1052
1317
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1053
1318
|
"No route found in the virtual host.");
|
1054
1319
|
}
|
1055
|
-
// If xds_routing is not configured, only look at the last one in the route
|
1056
|
-
// list (the default route)
|
1057
|
-
if (!xds_routing_enabled) {
|
1058
|
-
const envoy_api_v2_route_Route* route = routes[size - 1];
|
1059
|
-
const envoy_api_v2_route_RouteMatch* match =
|
1060
|
-
envoy_api_v2_route_Route_match(route);
|
1061
|
-
XdsApi::RdsUpdate::RdsRoute rds_route;
|
1062
|
-
// if xds routing is not enabled, we must be working on the default route;
|
1063
|
-
// in this case, we must have an empty or single slash prefix.
|
1064
|
-
if (!envoy_api_v2_route_RouteMatch_has_prefix(match)) {
|
1065
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1066
|
-
"No prefix field found in Default RouteMatch.");
|
1067
|
-
}
|
1068
|
-
const upb_strview prefix = envoy_api_v2_route_RouteMatch_prefix(match);
|
1069
|
-
if (!upb_strview_eql(prefix, upb_strview_makez("")) &&
|
1070
|
-
!upb_strview_eql(prefix, upb_strview_makez("/"))) {
|
1071
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1072
|
-
"Default route must have empty prefix.");
|
1073
|
-
}
|
1074
|
-
grpc_error* error = RouteActionParse(route, &rds_route);
|
1075
|
-
if (error != GRPC_ERROR_NONE) return error;
|
1076
|
-
rds_update->routes.emplace_back(std::move(rds_route));
|
1077
|
-
return GRPC_ERROR_NONE;
|
1078
|
-
}
|
1079
1320
|
// Loop over the whole list of routes
|
1080
1321
|
for (size_t i = 0; i < size; ++i) {
|
1081
1322
|
const envoy_api_v2_route_Route* route = routes[i];
|
1082
1323
|
const envoy_api_v2_route_RouteMatch* match =
|
1083
1324
|
envoy_api_v2_route_Route_match(route);
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
if (prefix.size > 0) {
|
1089
|
-
// Prefix "/" is accepted.
|
1090
|
-
if (prefix.data[0] != '/') {
|
1091
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1092
|
-
"Prefix does not start with a /");
|
1093
|
-
}
|
1094
|
-
if (prefix.size > 1) {
|
1095
|
-
std::vector<absl::string_view> prefix_elements = absl::StrSplit(
|
1096
|
-
absl::string_view(prefix.data, prefix.size).substr(1),
|
1097
|
-
absl::MaxSplits('/', 1));
|
1098
|
-
if (prefix_elements.size() != 2) {
|
1099
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1100
|
-
"Prefix not in the required format of /service/");
|
1101
|
-
} else if (!prefix_elements[1].empty()) {
|
1102
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1103
|
-
"Prefix does not end with a /");
|
1104
|
-
} else if (prefix_elements[0].empty()) {
|
1105
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1106
|
-
"Prefix contains empty service name");
|
1107
|
-
}
|
1108
|
-
rds_route.service = std::string(prefix_elements[0]);
|
1109
|
-
}
|
1110
|
-
}
|
1111
|
-
} else if (envoy_api_v2_route_RouteMatch_has_path(match)) {
|
1112
|
-
upb_strview path = envoy_api_v2_route_RouteMatch_path(match);
|
1113
|
-
if (path.size == 0) {
|
1114
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1115
|
-
"Path if set cannot be empty");
|
1116
|
-
}
|
1117
|
-
if (path.data[0] != '/') {
|
1118
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1119
|
-
"Path does not start with a /");
|
1120
|
-
}
|
1121
|
-
std::vector<absl::string_view> path_elements = absl::StrSplit(
|
1122
|
-
absl::string_view(path.data, path.size).substr(1), '/');
|
1123
|
-
if (path_elements.size() != 2) {
|
1124
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1125
|
-
"Path not in the required format of /service/method");
|
1126
|
-
} else if (path_elements[0].empty()) {
|
1127
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1128
|
-
"Path contains empty service name");
|
1129
|
-
} else if (path_elements[1].empty()) {
|
1130
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1131
|
-
"Path contains empty method name");
|
1132
|
-
}
|
1133
|
-
rds_route.service = std::string(path_elements[0]);
|
1134
|
-
rds_route.method = std::string(path_elements[1]);
|
1135
|
-
} else {
|
1136
|
-
// Path specifier types will be supported, ignore but not reject until
|
1137
|
-
// they are implemented.
|
1325
|
+
size_t query_parameters_size;
|
1326
|
+
static_cast<void>(envoy_api_v2_route_RouteMatch_query_parameters(
|
1327
|
+
match, &query_parameters_size));
|
1328
|
+
if (query_parameters_size > 0) {
|
1138
1329
|
continue;
|
1139
1330
|
}
|
1140
|
-
|
1331
|
+
XdsApi::RdsUpdate::RdsRoute rds_route;
|
1332
|
+
bool ignore_route = false;
|
1333
|
+
grpc_error* error = RoutePathMatchParse(match, &rds_route, &ignore_route);
|
1141
1334
|
if (error != GRPC_ERROR_NONE) return error;
|
1335
|
+
if (ignore_route) continue;
|
1336
|
+
error = RouteHeaderMatchersParse(match, &rds_route);
|
1337
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1338
|
+
error = RouteRuntimeFractionParse(match, &rds_route);
|
1339
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1340
|
+
error = RouteActionParse(route, &rds_route, &ignore_route);
|
1341
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1342
|
+
if (ignore_route) continue;
|
1343
|
+
const google_protobuf_BoolValue* case_sensitive =
|
1344
|
+
envoy_api_v2_route_RouteMatch_case_sensitive(match);
|
1345
|
+
if (case_sensitive != nullptr &&
|
1346
|
+
!google_protobuf_BoolValue_value(case_sensitive)) {
|
1347
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1348
|
+
"case_sensitive if set must be set to true.");
|
1349
|
+
}
|
1142
1350
|
rds_update->routes.emplace_back(std::move(rds_route));
|
1143
1351
|
}
|
1144
1352
|
if (rds_update->routes.empty()) {
|
@@ -1150,7 +1358,6 @@ grpc_error* RouteConfigParse(
|
|
1150
1358
|
grpc_error* LdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
1151
1359
|
const envoy_api_v2_DiscoveryResponse* response,
|
1152
1360
|
const std::string& expected_server_name,
|
1153
|
-
const bool xds_routing_enabled,
|
1154
1361
|
absl::optional<XdsApi::LdsUpdate>* lds_update,
|
1155
1362
|
upb_arena* arena) {
|
1156
1363
|
// Get the resources from the response.
|
@@ -1196,9 +1403,8 @@ grpc_error* LdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
|
1196
1403
|
envoy_config_filter_network_http_connection_manager_v2_HttpConnectionManager_route_config(
|
1197
1404
|
http_connection_manager);
|
1198
1405
|
XdsApi::RdsUpdate rds_update;
|
1199
|
-
grpc_error* error =
|
1200
|
-
|
1201
|
-
xds_routing_enabled, &rds_update);
|
1406
|
+
grpc_error* error = RouteConfigParse(client, tracer, route_config,
|
1407
|
+
expected_server_name, &rds_update);
|
1202
1408
|
if (error != GRPC_ERROR_NONE) return error;
|
1203
1409
|
lds_update->emplace();
|
1204
1410
|
(*lds_update)->rds_update.emplace(std::move(rds_update));
|
@@ -1240,7 +1446,6 @@ grpc_error* RdsResponseParse(
|
|
1240
1446
|
const envoy_api_v2_DiscoveryResponse* response,
|
1241
1447
|
const std::string& expected_server_name,
|
1242
1448
|
const std::set<absl::string_view>& expected_route_configuration_names,
|
1243
|
-
const bool xds_routing_enabled,
|
1244
1449
|
absl::optional<XdsApi::RdsUpdate>* rds_update, upb_arena* arena) {
|
1245
1450
|
// Get the resources from the response.
|
1246
1451
|
size_t size;
|
@@ -1272,9 +1477,8 @@ grpc_error* RdsResponseParse(
|
|
1272
1477
|
}
|
1273
1478
|
// Parse the route_config.
|
1274
1479
|
XdsApi::RdsUpdate local_rds_update;
|
1275
|
-
grpc_error* error =
|
1276
|
-
|
1277
|
-
xds_routing_enabled, &local_rds_update);
|
1480
|
+
grpc_error* error = RouteConfigParse(
|
1481
|
+
client, tracer, route_config, expected_server_name, &local_rds_update);
|
1278
1482
|
if (error != GRPC_ERROR_NONE) return error;
|
1279
1483
|
rds_update->emplace(std::move(local_rds_update));
|
1280
1484
|
return GRPC_ERROR_NONE;
|
@@ -1586,11 +1790,11 @@ grpc_error* XdsApi::ParseAdsResponse(
|
|
1586
1790
|
// Parse the response according to the resource type.
|
1587
1791
|
if (*type_url == kLdsTypeUrl) {
|
1588
1792
|
return LdsResponseParse(client_, tracer_, response, expected_server_name,
|
1589
|
-
|
1793
|
+
lds_update, arena.ptr());
|
1590
1794
|
} else if (*type_url == kRdsTypeUrl) {
|
1591
1795
|
return RdsResponseParse(client_, tracer_, response, expected_server_name,
|
1592
|
-
expected_route_configuration_names,
|
1593
|
-
|
1796
|
+
expected_route_configuration_names, rds_update,
|
1797
|
+
arena.ptr());
|
1594
1798
|
} else if (*type_url == kCdsTypeUrl) {
|
1595
1799
|
return CdsResponseParse(client_, tracer_, response, expected_cluster_names,
|
1596
1800
|
cds_update_map, arena.ptr());
|