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
@@ -0,0 +1,45 @@
|
|
1
|
+
/* This file was generated by upbc (the upb compiler) from the input
|
2
|
+
* file:
|
3
|
+
*
|
4
|
+
* xds/core/v3/context_params.proto
|
5
|
+
*
|
6
|
+
* Do not edit -- your changes will be discarded when the file is
|
7
|
+
* regenerated. */
|
8
|
+
|
9
|
+
#include "upb/def.h"
|
10
|
+
#include "xds/core/v3/context_params.upbdefs.h"
|
11
|
+
|
12
|
+
extern upb_def_init udpa_annotations_status_proto_upbdefinit;
|
13
|
+
extern const upb_msglayout xds_core_v3_ContextParams_msginit;
|
14
|
+
extern const upb_msglayout xds_core_v3_ContextParams_ParamsEntry_msginit;
|
15
|
+
|
16
|
+
static const upb_msglayout *layouts[2] = {
|
17
|
+
&xds_core_v3_ContextParams_msginit,
|
18
|
+
&xds_core_v3_ContextParams_ParamsEntry_msginit,
|
19
|
+
};
|
20
|
+
|
21
|
+
static const char descriptor[288] = {'\n', ' ', 'x', 'd', 's', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'c', 'o', 'n', 't', 'e', 'x', 't', '_', 'p', 'a', 'r',
|
22
|
+
'a', 'm', 's', '.', 'p', 'r', 'o', 't', 'o', '\022', '\013', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '\032', '\035', 'u',
|
23
|
+
'd', 'p', 'a', '/', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 's', '/', 's', 't', 'a', 't', 'u', 's', '.', 'p', 'r',
|
24
|
+
'o', 't', 'o', '\"', '\212', '\001', '\n', '\r', 'C', 'o', 'n', 't', 'e', 'x', 't', 'P', 'a', 'r', 'a', 'm', 's', '\022', '>', '\n', '\006',
|
25
|
+
'p', 'a', 'r', 'a', 'm', 's', '\030', '\001', ' ', '\003', '(', '\013', '2', '&', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v',
|
26
|
+
'3', '.', 'C', 'o', 'n', 't', 'e', 'x', 't', 'P', 'a', 'r', 'a', 'm', 's', '.', 'P', 'a', 'r', 'a', 'm', 's', 'E', 'n', 't',
|
27
|
+
'r', 'y', 'R', '\006', 'p', 'a', 'r', 'a', 'm', 's', '\032', '9', '\n', '\013', 'P', 'a', 'r', 'a', 'm', 's', 'E', 'n', 't', 'r', 'y',
|
28
|
+
'\022', '\020', '\n', '\003', 'k', 'e', 'y', '\030', '\001', ' ', '\001', '(', '\t', 'R', '\003', 'k', 'e', 'y', '\022', '\024', '\n', '\005', 'v', 'a', 'l',
|
29
|
+
'u', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\005', 'v', 'a', 'l', 'u', 'e', ':', '\002', '8', '\001', 'B', ';', '\n', '\033', 'c', 'o',
|
30
|
+
'm', '.', 'g', 'i', 't', 'h', 'u', 'b', '.', 'u', 'd', 'p', 'a', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3',
|
31
|
+
'B', '\022', 'C', 'o', 'n', 't', 'e', 'x', 't', 'P', 'a', 'r', 'a', 'm', 's', 'P', 'r', 'o', 't', 'o', 'P', '\001', '\272', '\200', '\310',
|
32
|
+
'\321', '\006', '\002', '\010', '\001', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3',
|
33
|
+
};
|
34
|
+
|
35
|
+
static upb_def_init *deps[2] = {
|
36
|
+
&udpa_annotations_status_proto_upbdefinit,
|
37
|
+
NULL
|
38
|
+
};
|
39
|
+
|
40
|
+
upb_def_init xds_core_v3_context_params_proto_upbdefinit = {
|
41
|
+
deps,
|
42
|
+
layouts,
|
43
|
+
"xds/core/v3/context_params.proto",
|
44
|
+
UPB_STRVIEW_INIT(descriptor, 288)
|
45
|
+
};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/* This file was generated by upbc (the upb compiler) from the input
|
2
|
+
* file:
|
3
|
+
*
|
4
|
+
* xds/core/v3/context_params.proto
|
5
|
+
*
|
6
|
+
* Do not edit -- your changes will be discarded when the file is
|
7
|
+
* regenerated. */
|
8
|
+
|
9
|
+
#ifndef XDS_CORE_V3_CONTEXT_PARAMS_PROTO_UPBDEFS_H_
|
10
|
+
#define XDS_CORE_V3_CONTEXT_PARAMS_PROTO_UPBDEFS_H_
|
11
|
+
|
12
|
+
#include "upb/def.h"
|
13
|
+
#include "upb/port_def.inc"
|
14
|
+
#ifdef __cplusplus
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include "upb/def.h"
|
19
|
+
|
20
|
+
#include "upb/port_def.inc"
|
21
|
+
|
22
|
+
extern upb_def_init xds_core_v3_context_params_proto_upbdefinit;
|
23
|
+
|
24
|
+
UPB_INLINE const upb_msgdef *xds_core_v3_ContextParams_getmsgdef(upb_symtab *s) {
|
25
|
+
_upb_symtab_loaddefinit(s, &xds_core_v3_context_params_proto_upbdefinit);
|
26
|
+
return upb_symtab_lookupmsg(s, "xds.core.v3.ContextParams");
|
27
|
+
}
|
28
|
+
|
29
|
+
UPB_INLINE const upb_msgdef *xds_core_v3_ContextParams_ParamsEntry_getmsgdef(upb_symtab *s) {
|
30
|
+
_upb_symtab_loaddefinit(s, &xds_core_v3_context_params_proto_upbdefinit);
|
31
|
+
return upb_symtab_lookupmsg(s, "xds.core.v3.ContextParams.ParamsEntry");
|
32
|
+
}
|
33
|
+
|
34
|
+
#ifdef __cplusplus
|
35
|
+
} /* extern "C" */
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#include "upb/port_undef.inc"
|
39
|
+
|
40
|
+
#endif /* XDS_CORE_V3_CONTEXT_PARAMS_PROTO_UPBDEFS_H_ */
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/* This file was generated by upbc (the upb compiler) from the input
|
2
|
+
* file:
|
3
|
+
*
|
4
|
+
* xds/core/v3/resource.proto
|
5
|
+
*
|
6
|
+
* Do not edit -- your changes will be discarded when the file is
|
7
|
+
* regenerated. */
|
8
|
+
|
9
|
+
#include "upb/def.h"
|
10
|
+
#include "xds/core/v3/resource.upbdefs.h"
|
11
|
+
|
12
|
+
extern upb_def_init google_protobuf_any_proto_upbdefinit;
|
13
|
+
extern upb_def_init udpa_annotations_status_proto_upbdefinit;
|
14
|
+
extern upb_def_init xds_core_v3_resource_name_proto_upbdefinit;
|
15
|
+
extern const upb_msglayout xds_core_v3_Resource_msginit;
|
16
|
+
|
17
|
+
static const upb_msglayout *layouts[1] = {
|
18
|
+
&xds_core_v3_Resource_msginit,
|
19
|
+
};
|
20
|
+
|
21
|
+
static const char descriptor[332] = {'\n', '\032', 'x', 'd', 's', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', '.', 'p', 'r',
|
22
|
+
'o', 't', 'o', '\022', '\013', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '\032', '\031', 'g', 'o', 'o', 'g', 'l', 'e', '/',
|
23
|
+
'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'a', 'n', 'y', '.', 'p', 'r', 'o', 't', 'o', '\032', '\035', 'u', 'd', 'p', 'a', '/',
|
24
|
+
'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 's', '/', 's', 't', 'a', 't', 'u', 's', '.', 'p', 'r', 'o', 't', 'o', '\032',
|
25
|
+
'\037', 'x', 'd', 's', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', '_', 'n', 'a', 'm',
|
26
|
+
'e', '.', 'p', 'r', 'o', 't', 'o', '\"', '\205', '\001', '\n', '\010', 'R', 'e', 's', 'o', 'u', 'r', 'c', 'e', '\022', '-', '\n', '\004', 'n',
|
27
|
+
'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\013', '2', '\031', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '.', 'R',
|
28
|
+
'e', 's', 'o', 'u', 'r', 'c', 'e', 'N', 'a', 'm', 'e', 'R', '\004', 'n', 'a', 'm', 'e', '\022', '\030', '\n', '\007', 'v', 'e', 'r', 's',
|
29
|
+
'i', 'o', 'n', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\007', 'v', 'e', 'r', 's', 'i', 'o', 'n', '\022', '0', '\n', '\010', 'r', 'e', 's',
|
30
|
+
'o', 'u', 'r', 'c', 'e', '\030', '\003', ' ', '\001', '(', '\013', '2', '\024', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't',
|
31
|
+
'o', 'b', 'u', 'f', '.', 'A', 'n', 'y', 'R', '\010', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'B', '6', '\n', '\033', 'c', 'o', 'm',
|
32
|
+
'.', 'g', 'i', 't', 'h', 'u', 'b', '.', 'u', 'd', 'p', 'a', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', 'B',
|
33
|
+
'\r', 'R', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'P', 'r', 'o', 't', 'o', 'P', '\001', '\272', '\200', '\310', '\321', '\006', '\002', '\010', '\001', 'b',
|
34
|
+
'\006', 'p', 'r', 'o', 't', 'o', '3',
|
35
|
+
};
|
36
|
+
|
37
|
+
static upb_def_init *deps[4] = {
|
38
|
+
&google_protobuf_any_proto_upbdefinit,
|
39
|
+
&udpa_annotations_status_proto_upbdefinit,
|
40
|
+
&xds_core_v3_resource_name_proto_upbdefinit,
|
41
|
+
NULL
|
42
|
+
};
|
43
|
+
|
44
|
+
upb_def_init xds_core_v3_resource_proto_upbdefinit = {
|
45
|
+
deps,
|
46
|
+
layouts,
|
47
|
+
"xds/core/v3/resource.proto",
|
48
|
+
UPB_STRVIEW_INIT(descriptor, 332)
|
49
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/* This file was generated by upbc (the upb compiler) from the input
|
2
|
+
* file:
|
3
|
+
*
|
4
|
+
* xds/core/v3/resource.proto
|
5
|
+
*
|
6
|
+
* Do not edit -- your changes will be discarded when the file is
|
7
|
+
* regenerated. */
|
8
|
+
|
9
|
+
#ifndef XDS_CORE_V3_RESOURCE_PROTO_UPBDEFS_H_
|
10
|
+
#define XDS_CORE_V3_RESOURCE_PROTO_UPBDEFS_H_
|
11
|
+
|
12
|
+
#include "upb/def.h"
|
13
|
+
#include "upb/port_def.inc"
|
14
|
+
#ifdef __cplusplus
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include "upb/def.h"
|
19
|
+
|
20
|
+
#include "upb/port_def.inc"
|
21
|
+
|
22
|
+
extern upb_def_init xds_core_v3_resource_proto_upbdefinit;
|
23
|
+
|
24
|
+
UPB_INLINE const upb_msgdef *xds_core_v3_Resource_getmsgdef(upb_symtab *s) {
|
25
|
+
_upb_symtab_loaddefinit(s, &xds_core_v3_resource_proto_upbdefinit);
|
26
|
+
return upb_symtab_lookupmsg(s, "xds.core.v3.Resource");
|
27
|
+
}
|
28
|
+
|
29
|
+
#ifdef __cplusplus
|
30
|
+
} /* extern "C" */
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#include "upb/port_undef.inc"
|
34
|
+
|
35
|
+
#endif /* XDS_CORE_V3_RESOURCE_PROTO_UPBDEFS_H_ */
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/* This file was generated by upbc (the upb compiler) from the input
|
2
|
+
* file:
|
3
|
+
*
|
4
|
+
* xds/core/v3/resource_locator.proto
|
5
|
+
*
|
6
|
+
* Do not edit -- your changes will be discarded when the file is
|
7
|
+
* regenerated. */
|
8
|
+
|
9
|
+
#include "upb/def.h"
|
10
|
+
#include "xds/core/v3/resource_locator.upbdefs.h"
|
11
|
+
|
12
|
+
extern upb_def_init udpa_annotations_status_proto_upbdefinit;
|
13
|
+
extern upb_def_init xds_core_v3_context_params_proto_upbdefinit;
|
14
|
+
extern upb_def_init validate_validate_proto_upbdefinit;
|
15
|
+
extern const upb_msglayout xds_core_v3_ResourceLocator_msginit;
|
16
|
+
extern const upb_msglayout xds_core_v3_ResourceLocator_Directive_msginit;
|
17
|
+
|
18
|
+
static const upb_msglayout *layouts[2] = {
|
19
|
+
&xds_core_v3_ResourceLocator_msginit,
|
20
|
+
&xds_core_v3_ResourceLocator_Directive_msginit,
|
21
|
+
};
|
22
|
+
|
23
|
+
static const char descriptor[739] = {'\n', '\"', 'x', 'd', 's', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', '_', 'l', 'o',
|
24
|
+
'c', 'a', 't', 'o', 'r', '.', 'p', 'r', 'o', 't', 'o', '\022', '\013', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '\032',
|
25
|
+
'\035', 'u', 'd', 'p', 'a', '/', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 's', '/', 's', 't', 'a', 't', 'u', 's', '.',
|
26
|
+
'p', 'r', 'o', 't', 'o', '\032', ' ', 'x', 'd', 's', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'c', 'o', 'n', 't', 'e', 'x',
|
27
|
+
't', '_', 'p', 'a', 'r', 'a', 'm', 's', '.', 'p', 'r', 'o', 't', 'o', '\032', '\027', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '/',
|
28
|
+
'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '.', 'p', 'r', 'o', 't', 'o', '\"', '\216', '\004', '\n', '\017', 'R', 'e', 's', 'o', 'u', 'r',
|
29
|
+
'c', 'e', 'L', 'o', 'c', 'a', 't', 'o', 'r', '\022', 'E', '\n', '\006', 's', 'c', 'h', 'e', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\016',
|
30
|
+
'2', '#', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '.', 'R', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'L', 'o',
|
31
|
+
'c', 'a', 't', 'o', 'r', '.', 'S', 'c', 'h', 'e', 'm', 'e', 'B', '\010', '\372', 'B', '\005', '\202', '\001', '\002', '\020', '\001', 'R', '\006', 's',
|
32
|
+
'c', 'h', 'e', 'm', 'e', '\022', '\016', '\n', '\002', 'i', 'd', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\002', 'i', 'd', '\022', '\034', '\n', '\t',
|
33
|
+
'a', 'u', 't', 'h', 'o', 'r', 'i', 't', 'y', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\t', 'a', 'u', 't', 'h', 'o', 'r', 'i', 't',
|
34
|
+
'y', '\022', ',', '\n', '\r', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', '_', 't', 'y', 'p', 'e', '\030', '\004', ' ', '\001', '(', '\t', 'B',
|
35
|
+
'\007', '\372', 'B', '\004', 'r', '\002', '\020', '\001', 'R', '\014', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'T', 'y', 'p', 'e', '\022', 'A', '\n',
|
36
|
+
'\r', 'e', 'x', 'a', 'c', 't', '_', 'c', 'o', 'n', 't', 'e', 'x', 't', '\030', '\005', ' ', '\001', '(', '\013', '2', '\032', '.', 'x', 'd',
|
37
|
+
's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '.', 'C', 'o', 'n', 't', 'e', 'x', 't', 'P', 'a', 'r', 'a', 'm', 's', 'H', '\000',
|
38
|
+
'R', '\014', 'e', 'x', 'a', 'c', 't', 'C', 'o', 'n', 't', 'e', 'x', 't', '\022', 'F', '\n', '\n', 'd', 'i', 'r', 'e', 'c', 't', 'i',
|
39
|
+
'v', 'e', 's', '\030', '\006', ' ', '\003', '(', '\013', '2', '&', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '.', 'R',
|
40
|
+
'e', 's', 'o', 'u', 'r', 'c', 'e', 'L', 'o', 'c', 'a', 't', 'o', 'r', '.', 'D', 'i', 'r', 'e', 'c', 't', 'i', 'v', 'e', 'R',
|
41
|
+
'\n', 'd', 'i', 'r', 'e', 'c', 't', 'i', 'v', 'e', 's', '\032', '\210', '\001', '\n', '\t', 'D', 'i', 'r', 'e', 'c', 't', 'i', 'v', 'e',
|
42
|
+
'\022', '0', '\n', '\003', 'a', 'l', 't', '\030', '\001', ' ', '\001', '(', '\013', '2', '\034', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.',
|
43
|
+
'v', '3', '.', 'R', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'L', 'o', 'c', 'a', 't', 'o', 'r', 'H', '\000', 'R', '\003', 'a', 'l', 't',
|
44
|
+
'\022', '7', '\n', '\005', 'e', 'n', 't', 'r', 'y', '\030', '\002', ' ', '\001', '(', '\t', 'B', '\037', '\372', 'B', '\034', 'r', '\032', '\020', '\001', '2',
|
45
|
+
'\026', '^', '[', '0', '-', '9', 'a', '-', 'z', 'A', '-', 'Z', '_', '\\', '-', '\\', '.', '/', '~', ':', ']', '+', '$', 'H', '\000',
|
46
|
+
'R', '\005', 'e', 'n', 't', 'r', 'y', 'B', '\020', '\n', '\t', 'd', 'i', 'r', 'e', 'c', 't', 'i', 'v', 'e', '\022', '\003', '\370', 'B', '\001',
|
47
|
+
'\"', '\'', '\n', '\006', 'S', 'c', 'h', 'e', 'm', 'e', '\022', '\t', '\n', '\005', 'X', 'D', 'S', 'T', 'P', '\020', '\000', '\022', '\010', '\n', '\004',
|
48
|
+
'H', 'T', 'T', 'P', '\020', '\001', '\022', '\010', '\n', '\004', 'F', 'I', 'L', 'E', '\020', '\002', 'B', '\031', '\n', '\027', 'c', 'o', 'n', 't', 'e',
|
49
|
+
'x', 't', '_', 'p', 'a', 'r', 'a', 'm', '_', 's', 'p', 'e', 'c', 'i', 'f', 'i', 'e', 'r', 'B', '=', '\n', '\033', 'c', 'o', 'm',
|
50
|
+
'.', 'g', 'i', 't', 'h', 'u', 'b', '.', 'u', 'd', 'p', 'a', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', 'B',
|
51
|
+
'\024', 'R', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'L', 'o', 'c', 'a', 't', 'o', 'r', 'P', 'r', 'o', 't', 'o', 'P', '\001', '\272', '\200',
|
52
|
+
'\310', '\321', '\006', '\002', '\010', '\001', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3',
|
53
|
+
};
|
54
|
+
|
55
|
+
static upb_def_init *deps[4] = {
|
56
|
+
&udpa_annotations_status_proto_upbdefinit,
|
57
|
+
&xds_core_v3_context_params_proto_upbdefinit,
|
58
|
+
&validate_validate_proto_upbdefinit,
|
59
|
+
NULL
|
60
|
+
};
|
61
|
+
|
62
|
+
upb_def_init xds_core_v3_resource_locator_proto_upbdefinit = {
|
63
|
+
deps,
|
64
|
+
layouts,
|
65
|
+
"xds/core/v3/resource_locator.proto",
|
66
|
+
UPB_STRVIEW_INIT(descriptor, 739)
|
67
|
+
};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/* This file was generated by upbc (the upb compiler) from the input
|
2
|
+
* file:
|
3
|
+
*
|
4
|
+
* xds/core/v3/resource_locator.proto
|
5
|
+
*
|
6
|
+
* Do not edit -- your changes will be discarded when the file is
|
7
|
+
* regenerated. */
|
8
|
+
|
9
|
+
#ifndef XDS_CORE_V3_RESOURCE_LOCATOR_PROTO_UPBDEFS_H_
|
10
|
+
#define XDS_CORE_V3_RESOURCE_LOCATOR_PROTO_UPBDEFS_H_
|
11
|
+
|
12
|
+
#include "upb/def.h"
|
13
|
+
#include "upb/port_def.inc"
|
14
|
+
#ifdef __cplusplus
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include "upb/def.h"
|
19
|
+
|
20
|
+
#include "upb/port_def.inc"
|
21
|
+
|
22
|
+
extern upb_def_init xds_core_v3_resource_locator_proto_upbdefinit;
|
23
|
+
|
24
|
+
UPB_INLINE const upb_msgdef *xds_core_v3_ResourceLocator_getmsgdef(upb_symtab *s) {
|
25
|
+
_upb_symtab_loaddefinit(s, &xds_core_v3_resource_locator_proto_upbdefinit);
|
26
|
+
return upb_symtab_lookupmsg(s, "xds.core.v3.ResourceLocator");
|
27
|
+
}
|
28
|
+
|
29
|
+
UPB_INLINE const upb_msgdef *xds_core_v3_ResourceLocator_Directive_getmsgdef(upb_symtab *s) {
|
30
|
+
_upb_symtab_loaddefinit(s, &xds_core_v3_resource_locator_proto_upbdefinit);
|
31
|
+
return upb_symtab_lookupmsg(s, "xds.core.v3.ResourceLocator.Directive");
|
32
|
+
}
|
33
|
+
|
34
|
+
#ifdef __cplusplus
|
35
|
+
} /* extern "C" */
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#include "upb/port_undef.inc"
|
39
|
+
|
40
|
+
#endif /* XDS_CORE_V3_RESOURCE_LOCATOR_PROTO_UPBDEFS_H_ */
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/* This file was generated by upbc (the upb compiler) from the input
|
2
|
+
* file:
|
3
|
+
*
|
4
|
+
* xds/core/v3/resource_name.proto
|
5
|
+
*
|
6
|
+
* Do not edit -- your changes will be discarded when the file is
|
7
|
+
* regenerated. */
|
8
|
+
|
9
|
+
#include "upb/def.h"
|
10
|
+
#include "xds/core/v3/resource_name.upbdefs.h"
|
11
|
+
|
12
|
+
extern upb_def_init udpa_annotations_status_proto_upbdefinit;
|
13
|
+
extern upb_def_init xds_core_v3_context_params_proto_upbdefinit;
|
14
|
+
extern upb_def_init validate_validate_proto_upbdefinit;
|
15
|
+
extern const upb_msglayout xds_core_v3_ResourceName_msginit;
|
16
|
+
|
17
|
+
static const upb_msglayout *layouts[1] = {
|
18
|
+
&xds_core_v3_ResourceName_msginit,
|
19
|
+
};
|
20
|
+
|
21
|
+
static const char descriptor[367] = {'\n', '\037', 'x', 'd', 's', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', '_', 'n', 'a',
|
22
|
+
'm', 'e', '.', 'p', 'r', 'o', 't', 'o', '\022', '\013', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '\032', '\035', 'u', 'd',
|
23
|
+
'p', 'a', '/', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 's', '/', 's', 't', 'a', 't', 'u', 's', '.', 'p', 'r', 'o',
|
24
|
+
't', 'o', '\032', ' ', 'x', 'd', 's', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'c', 'o', 'n', 't', 'e', 'x', 't', '_', 'p',
|
25
|
+
'a', 'r', 'a', 'm', 's', '.', 'p', 'r', 'o', 't', 'o', '\032', '\027', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '/', 'v', 'a', 'l',
|
26
|
+
'i', 'd', 'a', 't', 'e', '.', 'p', 'r', 'o', 't', 'o', '\"', '\240', '\001', '\n', '\014', 'R', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'N',
|
27
|
+
'a', 'm', 'e', '\022', '\016', '\n', '\002', 'i', 'd', '\030', '\001', ' ', '\001', '(', '\t', 'R', '\002', 'i', 'd', '\022', '\034', '\n', '\t', 'a', 'u',
|
28
|
+
't', 'h', 'o', 'r', 'i', 't', 'y', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\t', 'a', 'u', 't', 'h', 'o', 'r', 'i', 't', 'y', '\022',
|
29
|
+
',', '\n', '\r', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', '_', 't', 'y', 'p', 'e', '\030', '\003', ' ', '\001', '(', '\t', 'B', '\007', '\372',
|
30
|
+
'B', '\004', 'r', '\002', '\020', '\001', 'R', '\014', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'T', 'y', 'p', 'e', '\022', '4', '\n', '\007', 'c',
|
31
|
+
'o', 'n', 't', 'e', 'x', 't', '\030', '\004', ' ', '\001', '(', '\013', '2', '\032', '.', 'x', 'd', 's', '.', 'c', 'o', 'r', 'e', '.', 'v',
|
32
|
+
'3', '.', 'C', 'o', 'n', 't', 'e', 'x', 't', 'P', 'a', 'r', 'a', 'm', 's', 'R', '\007', 'c', 'o', 'n', 't', 'e', 'x', 't', 'B',
|
33
|
+
':', '\n', '\033', 'c', 'o', 'm', '.', 'g', 'i', 't', 'h', 'u', 'b', '.', 'u', 'd', 'p', 'a', '.', 'x', 'd', 's', '.', 'c', 'o',
|
34
|
+
'r', 'e', '.', 'v', '3', 'B', '\021', 'R', 'e', 's', 'o', 'u', 'r', 'c', 'e', 'N', 'a', 'm', 'e', 'P', 'r', 'o', 't', 'o', 'P',
|
35
|
+
'\001', '\272', '\200', '\310', '\321', '\006', '\002', '\010', '\001', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3',
|
36
|
+
};
|
37
|
+
|
38
|
+
static upb_def_init *deps[4] = {
|
39
|
+
&udpa_annotations_status_proto_upbdefinit,
|
40
|
+
&xds_core_v3_context_params_proto_upbdefinit,
|
41
|
+
&validate_validate_proto_upbdefinit,
|
42
|
+
NULL
|
43
|
+
};
|
44
|
+
|
45
|
+
upb_def_init xds_core_v3_resource_name_proto_upbdefinit = {
|
46
|
+
deps,
|
47
|
+
layouts,
|
48
|
+
"xds/core/v3/resource_name.proto",
|
49
|
+
UPB_STRVIEW_INIT(descriptor, 367)
|
50
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/* This file was generated by upbc (the upb compiler) from the input
|
2
|
+
* file:
|
3
|
+
*
|
4
|
+
* xds/core/v3/resource_name.proto
|
5
|
+
*
|
6
|
+
* Do not edit -- your changes will be discarded when the file is
|
7
|
+
* regenerated. */
|
8
|
+
|
9
|
+
#ifndef XDS_CORE_V3_RESOURCE_NAME_PROTO_UPBDEFS_H_
|
10
|
+
#define XDS_CORE_V3_RESOURCE_NAME_PROTO_UPBDEFS_H_
|
11
|
+
|
12
|
+
#include "upb/def.h"
|
13
|
+
#include "upb/port_def.inc"
|
14
|
+
#ifdef __cplusplus
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include "upb/def.h"
|
19
|
+
|
20
|
+
#include "upb/port_def.inc"
|
21
|
+
|
22
|
+
extern upb_def_init xds_core_v3_resource_name_proto_upbdefinit;
|
23
|
+
|
24
|
+
UPB_INLINE const upb_msgdef *xds_core_v3_ResourceName_getmsgdef(upb_symtab *s) {
|
25
|
+
_upb_symtab_loaddefinit(s, &xds_core_v3_resource_name_proto_upbdefinit);
|
26
|
+
return upb_symtab_lookupmsg(s, "xds.core.v3.ResourceName");
|
27
|
+
}
|
28
|
+
|
29
|
+
#ifdef __cplusplus
|
30
|
+
} /* extern "C" */
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#include "upb/port_undef.inc"
|
34
|
+
|
35
|
+
#endif /* XDS_CORE_V3_RESOURCE_NAME_PROTO_UPBDEFS_H_ */
|
data/src/core/ext/xds/xds_api.cc
CHANGED
@@ -39,6 +39,7 @@
|
|
39
39
|
#include "src/core/lib/gpr/env.h"
|
40
40
|
#include "src/core/lib/gpr/string.h"
|
41
41
|
#include "src/core/lib/gpr/useful.h"
|
42
|
+
#include "src/core/lib/gprpp/host_port.h"
|
42
43
|
#include "src/core/lib/iomgr/error.h"
|
43
44
|
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
44
45
|
#include "src/core/lib/slice/slice_utils.h"
|
@@ -57,9 +58,11 @@
|
|
57
58
|
#include "envoy/config/endpoint/v3/load_report.upb.h"
|
58
59
|
#include "envoy/config/listener/v3/api_listener.upb.h"
|
59
60
|
#include "envoy/config/listener/v3/listener.upb.h"
|
61
|
+
#include "envoy/config/listener/v3/listener_components.upb.h"
|
60
62
|
#include "envoy/config/route/v3/route.upb.h"
|
61
63
|
#include "envoy/config/route/v3/route.upbdefs.h"
|
62
64
|
#include "envoy/config/route/v3/route_components.upb.h"
|
65
|
+
#include "envoy/extensions/clusters/aggregate/v3/cluster.upb.h"
|
63
66
|
#include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h"
|
64
67
|
#include "envoy/extensions/transport_sockets/tls/v3/common.upb.h"
|
65
68
|
#include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h"
|
@@ -88,7 +91,7 @@
|
|
88
91
|
|
89
92
|
namespace grpc_core {
|
90
93
|
|
91
|
-
// TODO
|
94
|
+
// TODO(donnadionne): Check to see if timeout is enabled, this will be
|
92
95
|
// removed once timeout feature is fully integration-tested and enabled by
|
93
96
|
// default.
|
94
97
|
bool XdsTimeoutEnabled() {
|
@@ -99,172 +102,39 @@ bool XdsTimeoutEnabled() {
|
|
99
102
|
return parse_succeeded && parsed_value;
|
100
103
|
}
|
101
104
|
|
102
|
-
// TODO(
|
103
|
-
//
|
105
|
+
// TODO(donnadionne): Check to see if cluster types aggregate_cluster and
|
106
|
+
// logical_dns are enabled, this will be
|
107
|
+
// removed once the cluster types are fully integration-tested and enabled by
|
104
108
|
// default.
|
105
|
-
bool
|
106
|
-
char* value = gpr_getenv(
|
109
|
+
bool XdsAggregateAndLogicalDnsClusterEnabled() {
|
110
|
+
char* value = gpr_getenv(
|
111
|
+
"GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER");
|
107
112
|
bool parsed_value;
|
108
113
|
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
109
114
|
gpr_free(value);
|
110
115
|
return parse_succeeded && parsed_value;
|
111
116
|
}
|
112
117
|
|
113
|
-
//
|
114
|
-
//
|
115
|
-
//
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
regex_matcher =
|
123
|
-
absl::make_unique<RE2>(other.regex_matcher->pattern(), options);
|
124
|
-
} else {
|
125
|
-
string_matcher = other.string_matcher;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
|
129
|
-
XdsApi::Route::Matchers::PathMatcher& XdsApi::Route::Matchers::PathMatcher::
|
130
|
-
operator=(const PathMatcher& other) {
|
131
|
-
type = other.type;
|
132
|
-
case_sensitive = other.case_sensitive;
|
133
|
-
if (type == PathMatcherType::REGEX) {
|
134
|
-
RE2::Options options;
|
135
|
-
options.set_case_sensitive(case_sensitive);
|
136
|
-
regex_matcher =
|
137
|
-
absl::make_unique<RE2>(other.regex_matcher->pattern(), options);
|
138
|
-
} else {
|
139
|
-
string_matcher = other.string_matcher;
|
140
|
-
}
|
141
|
-
return *this;
|
142
|
-
}
|
143
|
-
|
144
|
-
bool XdsApi::Route::Matchers::PathMatcher::operator==(
|
145
|
-
const PathMatcher& other) const {
|
146
|
-
if (type != other.type) return false;
|
147
|
-
if (case_sensitive != other.case_sensitive) return false;
|
148
|
-
if (type == PathMatcherType::REGEX) {
|
149
|
-
// Should never be null.
|
150
|
-
if (regex_matcher == nullptr || other.regex_matcher == nullptr) {
|
151
|
-
return false;
|
152
|
-
}
|
153
|
-
return regex_matcher->pattern() == other.regex_matcher->pattern();
|
154
|
-
}
|
155
|
-
return string_matcher == other.string_matcher;
|
156
|
-
}
|
157
|
-
|
158
|
-
std::string XdsApi::Route::Matchers::PathMatcher::ToString() const {
|
159
|
-
std::string path_type_string;
|
160
|
-
switch (type) {
|
161
|
-
case PathMatcherType::PATH:
|
162
|
-
path_type_string = "path match";
|
163
|
-
break;
|
164
|
-
case PathMatcherType::PREFIX:
|
165
|
-
path_type_string = "prefix match";
|
166
|
-
break;
|
167
|
-
case PathMatcherType::REGEX:
|
168
|
-
path_type_string = "regex match";
|
169
|
-
break;
|
170
|
-
default:
|
171
|
-
break;
|
172
|
-
}
|
173
|
-
return absl::StrFormat("Path %s:%s%s", path_type_string,
|
174
|
-
type == PathMatcherType::REGEX
|
175
|
-
? regex_matcher->pattern()
|
176
|
-
: string_matcher,
|
177
|
-
case_sensitive ? "" : "[case_sensitive=false]");
|
178
|
-
}
|
179
|
-
|
180
|
-
//
|
181
|
-
// XdsApi::Route::Matchers::HeaderMatcher
|
182
|
-
//
|
183
|
-
|
184
|
-
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcher(
|
185
|
-
const HeaderMatcher& other)
|
186
|
-
: name(other.name), type(other.type), invert_match(other.invert_match) {
|
187
|
-
switch (type) {
|
188
|
-
case HeaderMatcherType::REGEX:
|
189
|
-
regex_match = absl::make_unique<RE2>(other.regex_match->pattern());
|
190
|
-
break;
|
191
|
-
case HeaderMatcherType::RANGE:
|
192
|
-
range_start = other.range_start;
|
193
|
-
range_end = other.range_end;
|
194
|
-
break;
|
195
|
-
case HeaderMatcherType::PRESENT:
|
196
|
-
present_match = other.present_match;
|
197
|
-
break;
|
198
|
-
default:
|
199
|
-
string_matcher = other.string_matcher;
|
200
|
-
}
|
118
|
+
// TODO(donnadionne): Check to see if ring hash policy is enabled, this will be
|
119
|
+
// removed once ring hash policy is fully integration-tested and enabled by
|
120
|
+
// default.
|
121
|
+
bool XdsRingHashEnabled() {
|
122
|
+
char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH");
|
123
|
+
bool parsed_value;
|
124
|
+
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
125
|
+
gpr_free(value);
|
126
|
+
return parse_succeeded && parsed_value;
|
201
127
|
}
|
202
128
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
case HeaderMatcherType::RANGE:
|
213
|
-
range_start = other.range_start;
|
214
|
-
range_end = other.range_end;
|
215
|
-
break;
|
216
|
-
case HeaderMatcherType::PRESENT:
|
217
|
-
present_match = other.present_match;
|
218
|
-
break;
|
219
|
-
default:
|
220
|
-
string_matcher = other.string_matcher;
|
221
|
-
}
|
222
|
-
return *this;
|
223
|
-
}
|
224
|
-
|
225
|
-
bool XdsApi::Route::Matchers::HeaderMatcher::operator==(
|
226
|
-
const HeaderMatcher& other) const {
|
227
|
-
if (name != other.name) return false;
|
228
|
-
if (type != other.type) return false;
|
229
|
-
if (invert_match != other.invert_match) return false;
|
230
|
-
switch (type) {
|
231
|
-
case HeaderMatcherType::REGEX:
|
232
|
-
return regex_match->pattern() != other.regex_match->pattern();
|
233
|
-
case HeaderMatcherType::RANGE:
|
234
|
-
return range_start != other.range_start && range_end != other.range_end;
|
235
|
-
case HeaderMatcherType::PRESENT:
|
236
|
-
return present_match != other.present_match;
|
237
|
-
default:
|
238
|
-
return string_matcher != other.string_matcher;
|
239
|
-
}
|
240
|
-
}
|
241
|
-
|
242
|
-
std::string XdsApi::Route::Matchers::HeaderMatcher::ToString() const {
|
243
|
-
switch (type) {
|
244
|
-
case HeaderMatcherType::EXACT:
|
245
|
-
return absl::StrFormat("Header exact match:%s %s:%s",
|
246
|
-
invert_match ? " not" : "", name, string_matcher);
|
247
|
-
case HeaderMatcherType::REGEX:
|
248
|
-
return absl::StrFormat("Header regex match:%s %s:%s",
|
249
|
-
invert_match ? " not" : "", name,
|
250
|
-
regex_match->pattern());
|
251
|
-
case HeaderMatcherType::RANGE:
|
252
|
-
return absl::StrFormat("Header range match:%s %s:[%d, %d)",
|
253
|
-
invert_match ? " not" : "", name, range_start,
|
254
|
-
range_end);
|
255
|
-
case HeaderMatcherType::PRESENT:
|
256
|
-
return absl::StrFormat("Header present match:%s %s:%s",
|
257
|
-
invert_match ? " not" : "", name,
|
258
|
-
present_match ? "true" : "false");
|
259
|
-
case HeaderMatcherType::PREFIX:
|
260
|
-
return absl::StrFormat("Header prefix match:%s %s:%s",
|
261
|
-
invert_match ? " not" : "", name, string_matcher);
|
262
|
-
case HeaderMatcherType::SUFFIX:
|
263
|
-
return absl::StrFormat("Header suffix match:%s %s:%s",
|
264
|
-
invert_match ? " not" : "", name, string_matcher);
|
265
|
-
default:
|
266
|
-
return "";
|
267
|
-
}
|
129
|
+
// TODO(yashykt): Check to see if xDS security is enabled. This will be
|
130
|
+
// removed once this feature is fully integration-tested and enabled by
|
131
|
+
// default.
|
132
|
+
bool XdsSecurityEnabled() {
|
133
|
+
char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT");
|
134
|
+
bool parsed_value;
|
135
|
+
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
136
|
+
gpr_free(value);
|
137
|
+
return parse_succeeded && parsed_value;
|
268
138
|
}
|
269
139
|
|
270
140
|
//
|
@@ -273,7 +143,8 @@ std::string XdsApi::Route::Matchers::HeaderMatcher::ToString() const {
|
|
273
143
|
|
274
144
|
std::string XdsApi::Route::Matchers::ToString() const {
|
275
145
|
std::vector<std::string> contents;
|
276
|
-
contents.push_back(
|
146
|
+
contents.push_back(
|
147
|
+
absl::StrFormat("PathMatcher{%s}", path_matcher.ToString()));
|
277
148
|
for (const HeaderMatcher& header_matcher : header_matchers) {
|
278
149
|
contents.push_back(header_matcher.ToString());
|
279
150
|
}
|
@@ -425,102 +296,6 @@ XdsApi::RdsUpdate::VirtualHost* XdsApi::RdsUpdate::FindVirtualHostForDomain(
|
|
425
296
|
return target_vhost;
|
426
297
|
}
|
427
298
|
|
428
|
-
//
|
429
|
-
// XdsApi::StringMatcher
|
430
|
-
//
|
431
|
-
|
432
|
-
XdsApi::StringMatcher::StringMatcher(StringMatcherType type,
|
433
|
-
const std::string& matcher,
|
434
|
-
bool ignore_case)
|
435
|
-
: type_(type), ignore_case_(ignore_case) {
|
436
|
-
if (type_ == StringMatcherType::SAFE_REGEX) {
|
437
|
-
regex_matcher_ = absl::make_unique<RE2>(matcher);
|
438
|
-
} else {
|
439
|
-
string_matcher_ = matcher;
|
440
|
-
}
|
441
|
-
}
|
442
|
-
|
443
|
-
XdsApi::StringMatcher::StringMatcher(const StringMatcher& other)
|
444
|
-
: type_(other.type_), ignore_case_(other.ignore_case_) {
|
445
|
-
switch (type_) {
|
446
|
-
case StringMatcherType::SAFE_REGEX:
|
447
|
-
regex_matcher_ = absl::make_unique<RE2>(other.regex_matcher_->pattern());
|
448
|
-
break;
|
449
|
-
default:
|
450
|
-
string_matcher_ = other.string_matcher_;
|
451
|
-
}
|
452
|
-
}
|
453
|
-
|
454
|
-
XdsApi::StringMatcher& XdsApi::StringMatcher::operator=(
|
455
|
-
const StringMatcher& other) {
|
456
|
-
type_ = other.type_;
|
457
|
-
switch (type_) {
|
458
|
-
case StringMatcherType::SAFE_REGEX:
|
459
|
-
regex_matcher_ = absl::make_unique<RE2>(other.regex_matcher_->pattern());
|
460
|
-
break;
|
461
|
-
default:
|
462
|
-
string_matcher_ = other.string_matcher_;
|
463
|
-
}
|
464
|
-
ignore_case_ = other.ignore_case_;
|
465
|
-
return *this;
|
466
|
-
}
|
467
|
-
|
468
|
-
bool XdsApi::StringMatcher::operator==(const StringMatcher& other) const {
|
469
|
-
if (type_ != other.type_ || ignore_case_ != other.ignore_case_) return false;
|
470
|
-
switch (type_) {
|
471
|
-
case StringMatcherType::SAFE_REGEX:
|
472
|
-
return regex_matcher_->pattern() == other.regex_matcher_->pattern();
|
473
|
-
default:
|
474
|
-
return string_matcher_ == other.string_matcher_;
|
475
|
-
}
|
476
|
-
}
|
477
|
-
|
478
|
-
bool XdsApi::StringMatcher::Match(absl::string_view value) const {
|
479
|
-
switch (type_) {
|
480
|
-
case XdsApi::StringMatcher::StringMatcherType::EXACT:
|
481
|
-
return ignore_case_ ? absl::EqualsIgnoreCase(value, string_matcher_)
|
482
|
-
: value == string_matcher_;
|
483
|
-
case XdsApi::StringMatcher::StringMatcherType::PREFIX:
|
484
|
-
return ignore_case_ ? absl::StartsWithIgnoreCase(value, string_matcher_)
|
485
|
-
: absl::StartsWith(value, string_matcher_);
|
486
|
-
case XdsApi::StringMatcher::StringMatcherType::SUFFIX:
|
487
|
-
return ignore_case_ ? absl::EndsWithIgnoreCase(value, string_matcher_)
|
488
|
-
: absl::EndsWith(value, string_matcher_);
|
489
|
-
case XdsApi::StringMatcher::StringMatcherType::CONTAINS:
|
490
|
-
return ignore_case_
|
491
|
-
? absl::StrContains(absl::AsciiStrToLower(value),
|
492
|
-
absl::AsciiStrToLower(string_matcher_))
|
493
|
-
: absl::StrContains(value, string_matcher_);
|
494
|
-
case XdsApi::StringMatcher::StringMatcherType::SAFE_REGEX:
|
495
|
-
// ignore_case_ is ignored for SAFE_REGEX
|
496
|
-
return RE2::FullMatch(std::string(value), *regex_matcher_);
|
497
|
-
default:
|
498
|
-
return false;
|
499
|
-
}
|
500
|
-
}
|
501
|
-
|
502
|
-
std::string XdsApi::StringMatcher::ToString() const {
|
503
|
-
switch (type_) {
|
504
|
-
case StringMatcherType::EXACT:
|
505
|
-
return absl::StrFormat("StringMatcher{exact=%s%s}", string_matcher_,
|
506
|
-
ignore_case_ ? ", ignore_case" : "");
|
507
|
-
case StringMatcherType::PREFIX:
|
508
|
-
return absl::StrFormat("StringMatcher{prefix=%s%s}", string_matcher_,
|
509
|
-
ignore_case_ ? ", ignore_case" : "");
|
510
|
-
case StringMatcherType::SUFFIX:
|
511
|
-
return absl::StrFormat("StringMatcher{suffix=%s%s}", string_matcher_,
|
512
|
-
ignore_case_ ? ", ignore_case" : "");
|
513
|
-
case StringMatcherType::CONTAINS:
|
514
|
-
return absl::StrFormat("StringMatcher{contains=%s%s}", string_matcher_,
|
515
|
-
ignore_case_ ? ", ignore_case" : "");
|
516
|
-
case StringMatcherType::SAFE_REGEX:
|
517
|
-
return absl::StrFormat("StringMatcher{safe_regex=%s}",
|
518
|
-
regex_matcher_->pattern());
|
519
|
-
default:
|
520
|
-
return "";
|
521
|
-
}
|
522
|
-
}
|
523
|
-
|
524
299
|
//
|
525
300
|
// XdsApi::CommonTlsContext::CertificateValidationContext
|
526
301
|
//
|
@@ -609,6 +384,45 @@ bool XdsApi::CommonTlsContext::Empty() const {
|
|
609
384
|
combined_validation_context.Empty();
|
610
385
|
}
|
611
386
|
|
387
|
+
//
|
388
|
+
// XdsApi::DownstreamTlsContext
|
389
|
+
//
|
390
|
+
|
391
|
+
std::string XdsApi::DownstreamTlsContext::ToString() const {
|
392
|
+
return absl::StrFormat("common_tls_context=%s, require_client_certificate=%s",
|
393
|
+
common_tls_context.ToString(),
|
394
|
+
require_client_certificate ? "true" : "false");
|
395
|
+
}
|
396
|
+
|
397
|
+
bool XdsApi::DownstreamTlsContext::Empty() const {
|
398
|
+
return common_tls_context.Empty();
|
399
|
+
}
|
400
|
+
|
401
|
+
//
|
402
|
+
// XdsApi::LdsUpdate
|
403
|
+
//
|
404
|
+
|
405
|
+
std::string XdsApi::LdsUpdate::ToString() const {
|
406
|
+
absl::InlinedVector<std::string, 3> contents;
|
407
|
+
if (type == ListenerType::kTcpListener) {
|
408
|
+
if (!downstream_tls_context.Empty()) {
|
409
|
+
contents.push_back(absl::StrFormat("downstream_tls_context=%s",
|
410
|
+
downstream_tls_context.ToString()));
|
411
|
+
}
|
412
|
+
} else if (type == ListenerType::kHttpApiListener) {
|
413
|
+
contents.push_back(absl::StrFormat(
|
414
|
+
"route_config_name=%s",
|
415
|
+
!route_config_name.empty() ? route_config_name.c_str() : "<inlined>"));
|
416
|
+
contents.push_back(absl::StrFormat("http_max_stream_duration=%s",
|
417
|
+
http_max_stream_duration.ToString()));
|
418
|
+
if (rds_update.has_value()) {
|
419
|
+
contents.push_back(
|
420
|
+
absl::StrFormat("rds_update=%s", rds_update->ToString()));
|
421
|
+
}
|
422
|
+
}
|
423
|
+
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
424
|
+
}
|
425
|
+
|
612
426
|
//
|
613
427
|
// XdsApi::CdsUpdate
|
614
428
|
//
|
@@ -981,12 +795,9 @@ grpc_slice XdsApi::CreateAdsRequest(
|
|
981
795
|
// generate them in the parsing code, and then use that here.
|
982
796
|
google_rpc_Status_set_code(error_detail, GRPC_STATUS_INVALID_ARGUMENT);
|
983
797
|
// Error description comes from the error that was passed in.
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
upb_strview error_description_strview =
|
988
|
-
StdStringToUpbString(StringViewFromSlice(error_description_slice));
|
989
|
-
google_rpc_Status_set_message(error_detail, error_description_strview);
|
798
|
+
upb_strview error_description =
|
799
|
+
StdStringToUpbString(absl::string_view(grpc_error_string(error)));
|
800
|
+
google_rpc_Status_set_message(error_detail, error_description);
|
990
801
|
GRPC_ERROR_UNREF(error);
|
991
802
|
}
|
992
803
|
// Populate node.
|
@@ -1062,11 +873,14 @@ void MaybeLogClusterLoadAssignment(
|
|
1062
873
|
|
1063
874
|
grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
|
1064
875
|
XdsApi::Route* route, bool* ignore_route) {
|
1065
|
-
auto*
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
876
|
+
auto* case_sensitive_ptr =
|
877
|
+
envoy_config_route_v3_RouteMatch_case_sensitive(match);
|
878
|
+
bool case_sensitive = true;
|
879
|
+
if (case_sensitive_ptr != nullptr) {
|
880
|
+
case_sensitive = google_protobuf_BoolValue_value(case_sensitive_ptr);
|
881
|
+
}
|
882
|
+
StringMatcher::Type type;
|
883
|
+
std::string match_string;
|
1070
884
|
if (envoy_config_route_v3_RouteMatch_has_prefix(match)) {
|
1071
885
|
absl::string_view prefix =
|
1072
886
|
UpbStringToAbsl(envoy_config_route_v3_RouteMatch_prefix(match));
|
@@ -1091,9 +905,8 @@ grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
|
|
1091
905
|
return GRPC_ERROR_NONE;
|
1092
906
|
}
|
1093
907
|
}
|
1094
|
-
|
1095
|
-
|
1096
|
-
route->matchers.path_matcher.string_matcher = std::string(prefix);
|
908
|
+
type = StringMatcher::Type::PREFIX;
|
909
|
+
match_string = std::string(prefix);
|
1097
910
|
} else if (envoy_config_route_v3_RouteMatch_has_path(match)) {
|
1098
911
|
absl::string_view path =
|
1099
912
|
UpbStringToAbsl(envoy_config_route_v3_RouteMatch_path(match));
|
@@ -1126,29 +939,28 @@ grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
|
|
1126
939
|
*ignore_route = true;
|
1127
940
|
return GRPC_ERROR_NONE;
|
1128
941
|
}
|
1129
|
-
|
1130
|
-
|
1131
|
-
route->matchers.path_matcher.string_matcher = std::string(path);
|
942
|
+
type = StringMatcher::Type::EXACT;
|
943
|
+
match_string = std::string(path);
|
1132
944
|
} else if (envoy_config_route_v3_RouteMatch_has_safe_regex(match)) {
|
1133
945
|
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
1134
946
|
envoy_config_route_v3_RouteMatch_safe_regex(match);
|
1135
947
|
GPR_ASSERT(regex_matcher != nullptr);
|
1136
|
-
|
948
|
+
type = StringMatcher::Type::SAFE_REGEX;
|
949
|
+
match_string = UpbStringToStdString(
|
1137
950
|
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
1138
|
-
RE2::Options options;
|
1139
|
-
options.set_case_sensitive(route->matchers.path_matcher.case_sensitive);
|
1140
|
-
auto regex = absl::make_unique<RE2>(std::move(matcher), options);
|
1141
|
-
if (!regex->ok()) {
|
1142
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1143
|
-
"Invalid regex string specified in path matcher.");
|
1144
|
-
}
|
1145
|
-
route->matchers.path_matcher.type =
|
1146
|
-
XdsApi::Route::Matchers::PathMatcher::PathMatcherType::REGEX;
|
1147
|
-
route->matchers.path_matcher.regex_matcher = std::move(regex);
|
1148
951
|
} else {
|
1149
952
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1150
953
|
"Invalid route path specifier specified.");
|
1151
954
|
}
|
955
|
+
absl::StatusOr<StringMatcher> string_matcher =
|
956
|
+
StringMatcher::Create(type, match_string, case_sensitive);
|
957
|
+
if (!string_matcher.ok()) {
|
958
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
959
|
+
absl::StrCat("path matcher: ", string_matcher.status().message())
|
960
|
+
.c_str());
|
961
|
+
;
|
962
|
+
}
|
963
|
+
route->matchers.path_matcher = std::move(string_matcher.value());
|
1152
964
|
return GRPC_ERROR_NONE;
|
1153
965
|
}
|
1154
966
|
|
@@ -1159,64 +971,62 @@ grpc_error* RouteHeaderMatchersParse(
|
|
1159
971
|
envoy_config_route_v3_RouteMatch_headers(match, &size);
|
1160
972
|
for (size_t i = 0; i < size; ++i) {
|
1161
973
|
const envoy_config_route_v3_HeaderMatcher* header = headers[i];
|
1162
|
-
|
1163
|
-
header_matcher.name =
|
974
|
+
const std::string name =
|
1164
975
|
UpbStringToStdString(envoy_config_route_v3_HeaderMatcher_name(header));
|
976
|
+
HeaderMatcher::Type type;
|
977
|
+
std::string match_string;
|
978
|
+
int64_t range_start = 0;
|
979
|
+
int64_t range_end = 0;
|
980
|
+
bool present_match = false;
|
1165
981
|
if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) {
|
1166
|
-
|
1167
|
-
|
1168
|
-
header_matcher.string_matcher = UpbStringToStdString(
|
982
|
+
type = HeaderMatcher::Type::EXACT;
|
983
|
+
match_string = UpbStringToStdString(
|
1169
984
|
envoy_config_route_v3_HeaderMatcher_exact_match(header));
|
1170
985
|
} else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(
|
1171
986
|
header)) {
|
1172
987
|
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
1173
988
|
envoy_config_route_v3_HeaderMatcher_safe_regex_match(header);
|
1174
989
|
GPR_ASSERT(regex_matcher != nullptr);
|
1175
|
-
|
990
|
+
type = HeaderMatcher::Type::SAFE_REGEX;
|
991
|
+
match_string = UpbStringToStdString(
|
1176
992
|
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
1177
|
-
std::unique_ptr<RE2> regex = absl::make_unique<RE2>(matcher);
|
1178
|
-
if (!regex->ok()) {
|
1179
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1180
|
-
"Invalid regex string specified in header matcher.");
|
1181
|
-
}
|
1182
|
-
header_matcher.type =
|
1183
|
-
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::REGEX;
|
1184
|
-
header_matcher.regex_match = std::move(regex);
|
1185
993
|
} else if (envoy_config_route_v3_HeaderMatcher_has_range_match(header)) {
|
1186
|
-
|
1187
|
-
XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::RANGE;
|
994
|
+
type = HeaderMatcher::Type::RANGE;
|
1188
995
|
const envoy_type_v3_Int64Range* range_matcher =
|
1189
996
|
envoy_config_route_v3_HeaderMatcher_range_match(header);
|
1190
|
-
|
1191
|
-
|
1192
|
-
header_matcher.range_end = envoy_type_v3_Int64Range_end(range_matcher);
|
1193
|
-
if (header_matcher.range_end < header_matcher.range_start) {
|
1194
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1195
|
-
"Invalid range header matcher specifier specified: end "
|
1196
|
-
"cannot be smaller than start.");
|
1197
|
-
}
|
997
|
+
range_start = envoy_type_v3_Int64Range_start(range_matcher);
|
998
|
+
range_end = envoy_type_v3_Int64Range_end(range_matcher);
|
1198
999
|
} else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) {
|
1199
|
-
|
1200
|
-
|
1201
|
-
header_matcher.present_match =
|
1202
|
-
envoy_config_route_v3_HeaderMatcher_present_match(header);
|
1000
|
+
type = HeaderMatcher::Type::PRESENT;
|
1001
|
+
present_match = envoy_config_route_v3_HeaderMatcher_present_match(header);
|
1203
1002
|
} else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) {
|
1204
|
-
|
1205
|
-
|
1206
|
-
header_matcher.string_matcher = UpbStringToStdString(
|
1003
|
+
type = HeaderMatcher::Type::PREFIX;
|
1004
|
+
match_string = UpbStringToStdString(
|
1207
1005
|
envoy_config_route_v3_HeaderMatcher_prefix_match(header));
|
1208
1006
|
} else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) {
|
1209
|
-
|
1210
|
-
|
1211
|
-
header_matcher.string_matcher = UpbStringToStdString(
|
1007
|
+
type = HeaderMatcher::Type::SUFFIX;
|
1008
|
+
match_string = UpbStringToStdString(
|
1212
1009
|
envoy_config_route_v3_HeaderMatcher_suffix_match(header));
|
1010
|
+
} else if (envoy_config_route_v3_HeaderMatcher_has_contains_match(header)) {
|
1011
|
+
type = HeaderMatcher::Type::CONTAINS;
|
1012
|
+
match_string = UpbStringToStdString(
|
1013
|
+
envoy_config_route_v3_HeaderMatcher_contains_match(header));
|
1213
1014
|
} else {
|
1214
1015
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1215
1016
|
"Invalid route header matcher specified.");
|
1216
1017
|
}
|
1217
|
-
|
1018
|
+
bool invert_match =
|
1218
1019
|
envoy_config_route_v3_HeaderMatcher_invert_match(header);
|
1219
|
-
|
1020
|
+
absl::StatusOr<HeaderMatcher> header_matcher =
|
1021
|
+
HeaderMatcher::Create(name, type, match_string, range_start, range_end,
|
1022
|
+
present_match, invert_match);
|
1023
|
+
if (!header_matcher.ok()) {
|
1024
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1025
|
+
absl::StrCat("header matcher: ", header_matcher.status().message())
|
1026
|
+
.c_str());
|
1027
|
+
}
|
1028
|
+
route->matchers.header_matchers.emplace_back(
|
1029
|
+
std::move(header_matcher.value()));
|
1220
1030
|
}
|
1221
1031
|
return GRPC_ERROR_NONE;
|
1222
1032
|
}
|
@@ -1414,170 +1224,6 @@ grpc_error* RouteConfigParse(
|
|
1414
1224
|
return GRPC_ERROR_NONE;
|
1415
1225
|
}
|
1416
1226
|
|
1417
|
-
grpc_error* LdsResponseParse(
|
1418
|
-
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1419
|
-
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1420
|
-
const std::set<absl::string_view>& expected_listener_names,
|
1421
|
-
XdsApi::LdsUpdateMap* lds_update_map, upb_arena* arena) {
|
1422
|
-
// Get the resources from the response.
|
1423
|
-
size_t size;
|
1424
|
-
const google_protobuf_Any* const* resources =
|
1425
|
-
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1426
|
-
for (size_t i = 0; i < size; ++i) {
|
1427
|
-
// Check the type_url of the resource.
|
1428
|
-
absl::string_view type_url =
|
1429
|
-
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1430
|
-
if (!IsLds(type_url)) {
|
1431
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not LDS.");
|
1432
|
-
}
|
1433
|
-
// Decode the listener.
|
1434
|
-
const upb_strview encoded_listener =
|
1435
|
-
google_protobuf_Any_value(resources[i]);
|
1436
|
-
const envoy_config_listener_v3_Listener* listener =
|
1437
|
-
envoy_config_listener_v3_Listener_parse(encoded_listener.data,
|
1438
|
-
encoded_listener.size, arena);
|
1439
|
-
if (listener == nullptr) {
|
1440
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode listener.");
|
1441
|
-
}
|
1442
|
-
// Check listener name. Ignore unexpected listeners.
|
1443
|
-
std::string listener_name =
|
1444
|
-
UpbStringToStdString(envoy_config_listener_v3_Listener_name(listener));
|
1445
|
-
if (expected_listener_names.find(listener_name) ==
|
1446
|
-
expected_listener_names.end()) {
|
1447
|
-
continue;
|
1448
|
-
}
|
1449
|
-
// Fail if listener name is duplicated.
|
1450
|
-
if (lds_update_map->find(listener_name) != lds_update_map->end()) {
|
1451
|
-
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1452
|
-
absl::StrCat("duplicate listener name \"", listener_name, "\"")
|
1453
|
-
.c_str());
|
1454
|
-
}
|
1455
|
-
XdsApi::LdsUpdate& lds_update = (*lds_update_map)[listener_name];
|
1456
|
-
// Get api_listener and decode it to http_connection_manager.
|
1457
|
-
const envoy_config_listener_v3_ApiListener* api_listener =
|
1458
|
-
envoy_config_listener_v3_Listener_api_listener(listener);
|
1459
|
-
if (api_listener == nullptr) {
|
1460
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1461
|
-
"Listener has no ApiListener.");
|
1462
|
-
}
|
1463
|
-
const upb_strview encoded_api_listener = google_protobuf_Any_value(
|
1464
|
-
envoy_config_listener_v3_ApiListener_api_listener(api_listener));
|
1465
|
-
const envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager*
|
1466
|
-
http_connection_manager =
|
1467
|
-
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_parse(
|
1468
|
-
encoded_api_listener.data, encoded_api_listener.size, arena);
|
1469
|
-
if (http_connection_manager == nullptr) {
|
1470
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1471
|
-
"Could not parse HttpConnectionManager config from ApiListener");
|
1472
|
-
}
|
1473
|
-
if (XdsTimeoutEnabled()) {
|
1474
|
-
// Obtain max_stream_duration from Http Protocol Options.
|
1475
|
-
const envoy_config_core_v3_HttpProtocolOptions* options =
|
1476
|
-
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_common_http_protocol_options(
|
1477
|
-
http_connection_manager);
|
1478
|
-
if (options != nullptr) {
|
1479
|
-
const google_protobuf_Duration* duration =
|
1480
|
-
envoy_config_core_v3_HttpProtocolOptions_max_stream_duration(
|
1481
|
-
options);
|
1482
|
-
if (duration != nullptr) {
|
1483
|
-
lds_update.http_max_stream_duration.seconds =
|
1484
|
-
google_protobuf_Duration_seconds(duration);
|
1485
|
-
lds_update.http_max_stream_duration.nanos =
|
1486
|
-
google_protobuf_Duration_nanos(duration);
|
1487
|
-
}
|
1488
|
-
}
|
1489
|
-
}
|
1490
|
-
// Found inlined route_config. Parse it to find the cluster_name.
|
1491
|
-
if (envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_route_config(
|
1492
|
-
http_connection_manager)) {
|
1493
|
-
const envoy_config_route_v3_RouteConfiguration* route_config =
|
1494
|
-
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_route_config(
|
1495
|
-
http_connection_manager);
|
1496
|
-
XdsApi::RdsUpdate rds_update;
|
1497
|
-
grpc_error* error =
|
1498
|
-
RouteConfigParse(client, tracer, symtab, route_config, &rds_update);
|
1499
|
-
if (error != GRPC_ERROR_NONE) return error;
|
1500
|
-
lds_update.rds_update = std::move(rds_update);
|
1501
|
-
continue;
|
1502
|
-
}
|
1503
|
-
// Validate that RDS must be used to get the route_config dynamically.
|
1504
|
-
if (!envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_rds(
|
1505
|
-
http_connection_manager)) {
|
1506
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1507
|
-
"HttpConnectionManager neither has inlined route_config nor RDS.");
|
1508
|
-
}
|
1509
|
-
const envoy_extensions_filters_network_http_connection_manager_v3_Rds* rds =
|
1510
|
-
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_rds(
|
1511
|
-
http_connection_manager);
|
1512
|
-
// Check that the ConfigSource specifies ADS.
|
1513
|
-
const envoy_config_core_v3_ConfigSource* config_source =
|
1514
|
-
envoy_extensions_filters_network_http_connection_manager_v3_Rds_config_source(
|
1515
|
-
rds);
|
1516
|
-
if (config_source == nullptr) {
|
1517
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1518
|
-
"HttpConnectionManager missing config_source for RDS.");
|
1519
|
-
}
|
1520
|
-
if (!envoy_config_core_v3_ConfigSource_has_ads(config_source)) {
|
1521
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1522
|
-
"HttpConnectionManager ConfigSource for RDS does not specify ADS.");
|
1523
|
-
}
|
1524
|
-
// Get the route_config_name.
|
1525
|
-
lds_update.route_config_name = UpbStringToStdString(
|
1526
|
-
envoy_extensions_filters_network_http_connection_manager_v3_Rds_route_config_name(
|
1527
|
-
rds));
|
1528
|
-
}
|
1529
|
-
return GRPC_ERROR_NONE;
|
1530
|
-
}
|
1531
|
-
|
1532
|
-
grpc_error* RdsResponseParse(
|
1533
|
-
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1534
|
-
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1535
|
-
const std::set<absl::string_view>& expected_route_configuration_names,
|
1536
|
-
XdsApi::RdsUpdateMap* rds_update_map, upb_arena* arena) {
|
1537
|
-
// Get the resources from the response.
|
1538
|
-
size_t size;
|
1539
|
-
const google_protobuf_Any* const* resources =
|
1540
|
-
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1541
|
-
for (size_t i = 0; i < size; ++i) {
|
1542
|
-
// Check the type_url of the resource.
|
1543
|
-
absl::string_view type_url =
|
1544
|
-
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1545
|
-
if (!IsRds(type_url)) {
|
1546
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not RDS.");
|
1547
|
-
}
|
1548
|
-
// Decode the route_config.
|
1549
|
-
const upb_strview encoded_route_config =
|
1550
|
-
google_protobuf_Any_value(resources[i]);
|
1551
|
-
const envoy_config_route_v3_RouteConfiguration* route_config =
|
1552
|
-
envoy_config_route_v3_RouteConfiguration_parse(
|
1553
|
-
encoded_route_config.data, encoded_route_config.size, arena);
|
1554
|
-
if (route_config == nullptr) {
|
1555
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode route_config.");
|
1556
|
-
}
|
1557
|
-
// Check route_config_name. Ignore unexpected route_config.
|
1558
|
-
std::string route_config_name = UpbStringToStdString(
|
1559
|
-
envoy_config_route_v3_RouteConfiguration_name(route_config));
|
1560
|
-
if (expected_route_configuration_names.find(route_config_name) ==
|
1561
|
-
expected_route_configuration_names.end()) {
|
1562
|
-
continue;
|
1563
|
-
}
|
1564
|
-
// Fail if route config name is duplicated.
|
1565
|
-
if (rds_update_map->find(route_config_name) != rds_update_map->end()) {
|
1566
|
-
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1567
|
-
absl::StrCat("duplicate route config name \"", route_config_name,
|
1568
|
-
"\"")
|
1569
|
-
.c_str());
|
1570
|
-
}
|
1571
|
-
// Parse the route_config.
|
1572
|
-
XdsApi::RdsUpdate& rds_update =
|
1573
|
-
(*rds_update_map)[std::move(route_config_name)];
|
1574
|
-
grpc_error* error =
|
1575
|
-
RouteConfigParse(client, tracer, symtab, route_config, &rds_update);
|
1576
|
-
if (error != GRPC_ERROR_NONE) return error;
|
1577
|
-
}
|
1578
|
-
return GRPC_ERROR_NONE;
|
1579
|
-
}
|
1580
|
-
|
1581
1227
|
XdsApi::CommonTlsContext::CertificateProviderInstance
|
1582
1228
|
CertificateProviderInstanceParse(
|
1583
1229
|
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance*
|
@@ -1612,35 +1258,35 @@ grpc_error* CommonTlsContextParse(
|
|
1612
1258
|
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_match_subject_alt_names(
|
1613
1259
|
default_validation_context, &len);
|
1614
1260
|
for (size_t i = 0; i < len; ++i) {
|
1615
|
-
|
1261
|
+
StringMatcher::Type type;
|
1616
1262
|
std::string matcher;
|
1617
1263
|
if (envoy_type_matcher_v3_StringMatcher_has_exact(
|
1618
1264
|
subject_alt_names_matchers[i])) {
|
1619
|
-
type =
|
1265
|
+
type = StringMatcher::Type::EXACT;
|
1620
1266
|
matcher =
|
1621
1267
|
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_exact(
|
1622
1268
|
subject_alt_names_matchers[i]));
|
1623
1269
|
} else if (envoy_type_matcher_v3_StringMatcher_has_prefix(
|
1624
1270
|
subject_alt_names_matchers[i])) {
|
1625
|
-
type =
|
1271
|
+
type = StringMatcher::Type::PREFIX;
|
1626
1272
|
matcher =
|
1627
1273
|
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_prefix(
|
1628
1274
|
subject_alt_names_matchers[i]));
|
1629
1275
|
} else if (envoy_type_matcher_v3_StringMatcher_has_suffix(
|
1630
1276
|
subject_alt_names_matchers[i])) {
|
1631
|
-
type =
|
1277
|
+
type = StringMatcher::Type::SUFFIX;
|
1632
1278
|
matcher =
|
1633
1279
|
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_suffix(
|
1634
1280
|
subject_alt_names_matchers[i]));
|
1635
1281
|
} else if (envoy_type_matcher_v3_StringMatcher_has_contains(
|
1636
1282
|
subject_alt_names_matchers[i])) {
|
1637
|
-
type =
|
1283
|
+
type = StringMatcher::Type::CONTAINS;
|
1638
1284
|
matcher =
|
1639
1285
|
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_contains(
|
1640
1286
|
subject_alt_names_matchers[i]));
|
1641
1287
|
} else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(
|
1642
1288
|
subject_alt_names_matchers[i])) {
|
1643
|
-
type =
|
1289
|
+
type = StringMatcher::Type::SAFE_REGEX;
|
1644
1290
|
auto* regex_matcher = envoy_type_matcher_v3_StringMatcher_safe_regex(
|
1645
1291
|
subject_alt_names_matchers[i]);
|
1646
1292
|
matcher = UpbStringToStdString(
|
@@ -1651,20 +1297,22 @@ grpc_error* CommonTlsContextParse(
|
|
1651
1297
|
}
|
1652
1298
|
bool ignore_case = envoy_type_matcher_v3_StringMatcher_ignore_case(
|
1653
1299
|
subject_alt_names_matchers[i]);
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1300
|
+
absl::StatusOr<StringMatcher> string_matcher =
|
1301
|
+
StringMatcher::Create(type, matcher,
|
1302
|
+
/*case_sensitive=*/!ignore_case);
|
1303
|
+
if (!string_matcher.ok()) {
|
1304
|
+
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1305
|
+
absl::StrCat("string matcher: ",
|
1306
|
+
string_matcher.status().message())
|
1307
|
+
.c_str());
|
1308
|
+
}
|
1309
|
+
if (type == StringMatcher::Type::SAFE_REGEX && ignore_case) {
|
1310
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1311
|
+
"StringMatcher: ignore_case has no effect for SAFE_REGEX.");
|
1664
1312
|
}
|
1665
1313
|
common_tls_context->combined_validation_context
|
1666
1314
|
.default_validation_context.match_subject_alt_names.push_back(
|
1667
|
-
std::move(string_matcher));
|
1315
|
+
std::move(string_matcher.value()));
|
1668
1316
|
}
|
1669
1317
|
}
|
1670
1318
|
auto* validation_context_certificate_provider_instance =
|
@@ -1688,11 +1336,304 @@ grpc_error* CommonTlsContextParse(
|
|
1688
1336
|
return GRPC_ERROR_NONE;
|
1689
1337
|
}
|
1690
1338
|
|
1339
|
+
grpc_error* LdsResponseParseClient(
|
1340
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab, upb_arena* arena,
|
1341
|
+
const envoy_config_listener_v3_ApiListener* api_listener,
|
1342
|
+
XdsApi::LdsUpdate* lds_update) {
|
1343
|
+
lds_update->type = XdsApi::LdsUpdate::ListenerType::kHttpApiListener;
|
1344
|
+
const upb_strview encoded_api_listener = google_protobuf_Any_value(
|
1345
|
+
envoy_config_listener_v3_ApiListener_api_listener(api_listener));
|
1346
|
+
const envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager*
|
1347
|
+
http_connection_manager =
|
1348
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_parse(
|
1349
|
+
encoded_api_listener.data, encoded_api_listener.size, arena);
|
1350
|
+
if (http_connection_manager == nullptr) {
|
1351
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1352
|
+
"Could not parse HttpConnectionManager config from ApiListener");
|
1353
|
+
}
|
1354
|
+
if (XdsTimeoutEnabled()) {
|
1355
|
+
// Obtain max_stream_duration from Http Protocol Options.
|
1356
|
+
const envoy_config_core_v3_HttpProtocolOptions* options =
|
1357
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_common_http_protocol_options(
|
1358
|
+
http_connection_manager);
|
1359
|
+
if (options != nullptr) {
|
1360
|
+
const google_protobuf_Duration* duration =
|
1361
|
+
envoy_config_core_v3_HttpProtocolOptions_max_stream_duration(options);
|
1362
|
+
if (duration != nullptr) {
|
1363
|
+
lds_update->http_max_stream_duration.seconds =
|
1364
|
+
google_protobuf_Duration_seconds(duration);
|
1365
|
+
lds_update->http_max_stream_duration.nanos =
|
1366
|
+
google_protobuf_Duration_nanos(duration);
|
1367
|
+
}
|
1368
|
+
}
|
1369
|
+
}
|
1370
|
+
// Found inlined route_config. Parse it to find the cluster_name.
|
1371
|
+
if (envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_route_config(
|
1372
|
+
http_connection_manager)) {
|
1373
|
+
const envoy_config_route_v3_RouteConfiguration* route_config =
|
1374
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_route_config(
|
1375
|
+
http_connection_manager);
|
1376
|
+
XdsApi::RdsUpdate rds_update;
|
1377
|
+
grpc_error* error =
|
1378
|
+
RouteConfigParse(client, tracer, symtab, route_config, &rds_update);
|
1379
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1380
|
+
lds_update->rds_update = std::move(rds_update);
|
1381
|
+
return GRPC_ERROR_NONE;
|
1382
|
+
}
|
1383
|
+
// Validate that RDS must be used to get the route_config dynamically.
|
1384
|
+
if (!envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_rds(
|
1385
|
+
http_connection_manager)) {
|
1386
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1387
|
+
"HttpConnectionManager neither has inlined route_config nor RDS.");
|
1388
|
+
}
|
1389
|
+
const envoy_extensions_filters_network_http_connection_manager_v3_Rds* rds =
|
1390
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_rds(
|
1391
|
+
http_connection_manager);
|
1392
|
+
// Check that the ConfigSource specifies ADS.
|
1393
|
+
const envoy_config_core_v3_ConfigSource* config_source =
|
1394
|
+
envoy_extensions_filters_network_http_connection_manager_v3_Rds_config_source(
|
1395
|
+
rds);
|
1396
|
+
if (config_source == nullptr) {
|
1397
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1398
|
+
"HttpConnectionManager missing config_source for RDS.");
|
1399
|
+
}
|
1400
|
+
if (!envoy_config_core_v3_ConfigSource_has_ads(config_source)) {
|
1401
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1402
|
+
"HttpConnectionManager ConfigSource for RDS does not specify ADS.");
|
1403
|
+
}
|
1404
|
+
// Get the route_config_name.
|
1405
|
+
lds_update->route_config_name = UpbStringToStdString(
|
1406
|
+
envoy_extensions_filters_network_http_connection_manager_v3_Rds_route_config_name(
|
1407
|
+
rds));
|
1408
|
+
return GRPC_ERROR_NONE;
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
grpc_error* LdsResponseParseServer(
|
1412
|
+
upb_arena* arena, const envoy_config_listener_v3_Listener* listener,
|
1413
|
+
const std::string& /*listener_name*/,
|
1414
|
+
const envoy_config_core_v3_Address* /*address*/,
|
1415
|
+
XdsApi::LdsUpdate* lds_update) {
|
1416
|
+
lds_update->type = XdsApi::LdsUpdate::ListenerType::kTcpListener;
|
1417
|
+
// TODO(yashykt): Support filter chain match.
|
1418
|
+
// Right now, we are supporting and expecting only one entry in filter_chains.
|
1419
|
+
size_t size = 0;
|
1420
|
+
auto* filter_chains =
|
1421
|
+
envoy_config_listener_v3_Listener_filter_chains(listener, &size);
|
1422
|
+
if (size != 1) {
|
1423
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1424
|
+
"Only one filter_chain supported.");
|
1425
|
+
}
|
1426
|
+
// Get the DownstreamTlsContext from the match
|
1427
|
+
if (XdsSecurityEnabled()) {
|
1428
|
+
auto* transport_socket =
|
1429
|
+
envoy_config_listener_v3_FilterChain_transport_socket(filter_chains[0]);
|
1430
|
+
if (transport_socket != nullptr) {
|
1431
|
+
absl::string_view name = UpbStringToAbsl(
|
1432
|
+
envoy_config_core_v3_TransportSocket_name(transport_socket));
|
1433
|
+
if (name == "envoy.transport_sockets.tls") {
|
1434
|
+
auto* typed_config =
|
1435
|
+
envoy_config_core_v3_TransportSocket_typed_config(transport_socket);
|
1436
|
+
if (typed_config != nullptr) {
|
1437
|
+
const upb_strview encoded_downstream_tls_context =
|
1438
|
+
google_protobuf_Any_value(typed_config);
|
1439
|
+
auto* downstream_tls_context =
|
1440
|
+
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_parse(
|
1441
|
+
encoded_downstream_tls_context.data,
|
1442
|
+
encoded_downstream_tls_context.size, arena);
|
1443
|
+
if (downstream_tls_context == nullptr) {
|
1444
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1445
|
+
"Can't decode downstream tls context.");
|
1446
|
+
}
|
1447
|
+
auto* common_tls_context =
|
1448
|
+
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_common_tls_context(
|
1449
|
+
downstream_tls_context);
|
1450
|
+
if (common_tls_context != nullptr) {
|
1451
|
+
grpc_error* error = CommonTlsContextParse(
|
1452
|
+
common_tls_context,
|
1453
|
+
&lds_update->downstream_tls_context.common_tls_context);
|
1454
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1455
|
+
}
|
1456
|
+
auto* require_client_certificate =
|
1457
|
+
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_require_client_certificate(
|
1458
|
+
downstream_tls_context);
|
1459
|
+
if (require_client_certificate != nullptr) {
|
1460
|
+
lds_update->downstream_tls_context.require_client_certificate =
|
1461
|
+
google_protobuf_BoolValue_value(require_client_certificate);
|
1462
|
+
}
|
1463
|
+
}
|
1464
|
+
if (lds_update->downstream_tls_context.common_tls_context
|
1465
|
+
.tls_certificate_certificate_provider_instance.instance_name
|
1466
|
+
.empty()) {
|
1467
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1468
|
+
"TLS configuration provided but no "
|
1469
|
+
"tls_certificate_certificate_provider_instance found.");
|
1470
|
+
}
|
1471
|
+
}
|
1472
|
+
}
|
1473
|
+
}
|
1474
|
+
return GRPC_ERROR_NONE;
|
1475
|
+
}
|
1476
|
+
|
1477
|
+
grpc_error* LdsResponseParse(
|
1478
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1479
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1480
|
+
const std::set<absl::string_view>& expected_listener_names,
|
1481
|
+
XdsApi::LdsUpdateMap* lds_update_map,
|
1482
|
+
std::set<std::string>* resource_names_failed, upb_arena* arena) {
|
1483
|
+
std::vector<grpc_error*> errors;
|
1484
|
+
// Get the resources from the response.
|
1485
|
+
size_t size;
|
1486
|
+
const google_protobuf_Any* const* resources =
|
1487
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1488
|
+
for (size_t i = 0; i < size; ++i) {
|
1489
|
+
// Check the type_url of the resource.
|
1490
|
+
absl::string_view type_url =
|
1491
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1492
|
+
if (!IsLds(type_url)) {
|
1493
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1494
|
+
absl::StrCat("resource index ", i, ": Resource is not LDS.")
|
1495
|
+
.c_str()));
|
1496
|
+
continue;
|
1497
|
+
}
|
1498
|
+
// Decode the listener.
|
1499
|
+
const upb_strview encoded_listener =
|
1500
|
+
google_protobuf_Any_value(resources[i]);
|
1501
|
+
const envoy_config_listener_v3_Listener* listener =
|
1502
|
+
envoy_config_listener_v3_Listener_parse(encoded_listener.data,
|
1503
|
+
encoded_listener.size, arena);
|
1504
|
+
if (listener == nullptr) {
|
1505
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1506
|
+
absl::StrCat("resource index ", i, ": Can't decode listener.")
|
1507
|
+
.c_str()));
|
1508
|
+
continue;
|
1509
|
+
}
|
1510
|
+
// Check listener name. Ignore unexpected listeners.
|
1511
|
+
std::string listener_name =
|
1512
|
+
UpbStringToStdString(envoy_config_listener_v3_Listener_name(listener));
|
1513
|
+
if (expected_listener_names.find(listener_name) ==
|
1514
|
+
expected_listener_names.end()) {
|
1515
|
+
continue;
|
1516
|
+
}
|
1517
|
+
// Fail if listener name is duplicated.
|
1518
|
+
if (lds_update_map->find(listener_name) != lds_update_map->end()) {
|
1519
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1520
|
+
absl::StrCat("duplicate listener name \"", listener_name, "\"")
|
1521
|
+
.c_str()));
|
1522
|
+
resource_names_failed->insert(listener_name);
|
1523
|
+
continue;
|
1524
|
+
}
|
1525
|
+
XdsApi::LdsUpdate& lds_update = (*lds_update_map)[listener_name];
|
1526
|
+
// Check whether it's a client or server listener.
|
1527
|
+
const envoy_config_listener_v3_ApiListener* api_listener =
|
1528
|
+
envoy_config_listener_v3_Listener_api_listener(listener);
|
1529
|
+
const envoy_config_core_v3_Address* address =
|
1530
|
+
envoy_config_listener_v3_Listener_address(listener);
|
1531
|
+
if (api_listener != nullptr && address != nullptr) {
|
1532
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1533
|
+
absl::StrCat(listener_name,
|
1534
|
+
": Listener has both address and ApiListener")
|
1535
|
+
.c_str()));
|
1536
|
+
resource_names_failed->insert(listener_name);
|
1537
|
+
continue;
|
1538
|
+
}
|
1539
|
+
if (api_listener == nullptr && address == nullptr) {
|
1540
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1541
|
+
absl::StrCat(listener_name,
|
1542
|
+
": Listener has neither address nor ApiListener")
|
1543
|
+
.c_str()));
|
1544
|
+
resource_names_failed->insert(listener_name);
|
1545
|
+
continue;
|
1546
|
+
}
|
1547
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
1548
|
+
if (api_listener != nullptr) {
|
1549
|
+
error = LdsResponseParseClient(client, tracer, symtab, arena,
|
1550
|
+
api_listener, &lds_update);
|
1551
|
+
} else {
|
1552
|
+
error = LdsResponseParseServer(arena, listener, listener_name, address,
|
1553
|
+
&lds_update);
|
1554
|
+
}
|
1555
|
+
if (error != GRPC_ERROR_NONE) {
|
1556
|
+
errors.push_back(grpc_error_add_child(
|
1557
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1558
|
+
absl::StrCat(listener_name, ": validation error").c_str()),
|
1559
|
+
error));
|
1560
|
+
resource_names_failed->insert(listener_name);
|
1561
|
+
}
|
1562
|
+
}
|
1563
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing LDS response", &errors);
|
1564
|
+
}
|
1565
|
+
|
1566
|
+
grpc_error* RdsResponseParse(
|
1567
|
+
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1568
|
+
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1569
|
+
const std::set<absl::string_view>& expected_route_configuration_names,
|
1570
|
+
XdsApi::RdsUpdateMap* rds_update_map,
|
1571
|
+
std::set<std::string>* resource_names_failed, upb_arena* arena) {
|
1572
|
+
std::vector<grpc_error*> errors;
|
1573
|
+
// Get the resources from the response.
|
1574
|
+
size_t size;
|
1575
|
+
const google_protobuf_Any* const* resources =
|
1576
|
+
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
1577
|
+
for (size_t i = 0; i < size; ++i) {
|
1578
|
+
// Check the type_url of the resource.
|
1579
|
+
absl::string_view type_url =
|
1580
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1581
|
+
if (!IsRds(type_url)) {
|
1582
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1583
|
+
absl::StrCat("resource index ", i, ": Resource is not RDS.")
|
1584
|
+
.c_str()));
|
1585
|
+
continue;
|
1586
|
+
}
|
1587
|
+
// Decode the route_config.
|
1588
|
+
const upb_strview encoded_route_config =
|
1589
|
+
google_protobuf_Any_value(resources[i]);
|
1590
|
+
const envoy_config_route_v3_RouteConfiguration* route_config =
|
1591
|
+
envoy_config_route_v3_RouteConfiguration_parse(
|
1592
|
+
encoded_route_config.data, encoded_route_config.size, arena);
|
1593
|
+
if (route_config == nullptr) {
|
1594
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1595
|
+
absl::StrCat("resource index ", i, ": Can't decode route_config.")
|
1596
|
+
.c_str()));
|
1597
|
+
continue;
|
1598
|
+
}
|
1599
|
+
// Check route_config_name. Ignore unexpected route_config.
|
1600
|
+
std::string route_config_name = UpbStringToStdString(
|
1601
|
+
envoy_config_route_v3_RouteConfiguration_name(route_config));
|
1602
|
+
if (expected_route_configuration_names.find(route_config_name) ==
|
1603
|
+
expected_route_configuration_names.end()) {
|
1604
|
+
continue;
|
1605
|
+
}
|
1606
|
+
// Fail if route config name is duplicated.
|
1607
|
+
if (rds_update_map->find(route_config_name) != rds_update_map->end()) {
|
1608
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1609
|
+
absl::StrCat("duplicate route config name \"", route_config_name,
|
1610
|
+
"\"")
|
1611
|
+
.c_str()));
|
1612
|
+
resource_names_failed->insert(route_config_name);
|
1613
|
+
continue;
|
1614
|
+
}
|
1615
|
+
// Parse the route_config.
|
1616
|
+
XdsApi::RdsUpdate& rds_update = (*rds_update_map)[route_config_name];
|
1617
|
+
grpc_error* error =
|
1618
|
+
RouteConfigParse(client, tracer, symtab, route_config, &rds_update);
|
1619
|
+
if (error != GRPC_ERROR_NONE) {
|
1620
|
+
errors.push_back(grpc_error_add_child(
|
1621
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1622
|
+
absl::StrCat(route_config_name, ": validation error").c_str()),
|
1623
|
+
error));
|
1624
|
+
resource_names_failed->insert(route_config_name);
|
1625
|
+
}
|
1626
|
+
}
|
1627
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing RDS response", &errors);
|
1628
|
+
}
|
1629
|
+
|
1691
1630
|
grpc_error* CdsResponseParse(
|
1692
1631
|
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1693
1632
|
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1694
1633
|
const std::set<absl::string_view>& expected_cluster_names,
|
1695
|
-
XdsApi::CdsUpdateMap* cds_update_map,
|
1634
|
+
XdsApi::CdsUpdateMap* cds_update_map,
|
1635
|
+
std::set<std::string>* resource_names_failed, upb_arena* arena) {
|
1636
|
+
std::vector<grpc_error*> errors;
|
1696
1637
|
// Get the resources from the response.
|
1697
1638
|
size_t size;
|
1698
1639
|
const google_protobuf_Any* const* resources =
|
@@ -1703,7 +1644,10 @@ grpc_error* CdsResponseParse(
|
|
1703
1644
|
absl::string_view type_url =
|
1704
1645
|
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1705
1646
|
if (!IsCds(type_url)) {
|
1706
|
-
|
1647
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1648
|
+
absl::StrCat("resource index ", i, ": Resource is not CDS.")
|
1649
|
+
.c_str()));
|
1650
|
+
continue;
|
1707
1651
|
}
|
1708
1652
|
// Decode the cluster.
|
1709
1653
|
const upb_strview encoded_cluster = google_protobuf_Any_value(resources[i]);
|
@@ -1711,7 +1655,10 @@ grpc_error* CdsResponseParse(
|
|
1711
1655
|
envoy_config_cluster_v3_Cluster_parse(encoded_cluster.data,
|
1712
1656
|
encoded_cluster.size, arena);
|
1713
1657
|
if (cluster == nullptr) {
|
1714
|
-
|
1658
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1659
|
+
absl::StrCat("resource index ", i, ": Can't decode cluster.")
|
1660
|
+
.c_str()));
|
1661
|
+
continue;
|
1715
1662
|
}
|
1716
1663
|
MaybeLogCluster(client, tracer, symtab, cluster);
|
1717
1664
|
// Ignore unexpected cluster names.
|
@@ -1723,41 +1670,190 @@ grpc_error* CdsResponseParse(
|
|
1723
1670
|
}
|
1724
1671
|
// Fail on duplicate resources.
|
1725
1672
|
if (cds_update_map->find(cluster_name) != cds_update_map->end()) {
|
1726
|
-
|
1673
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1727
1674
|
absl::StrCat("duplicate resource name \"", cluster_name, "\"")
|
1728
|
-
.c_str());
|
1675
|
+
.c_str()));
|
1676
|
+
resource_names_failed->insert(cluster_name);
|
1677
|
+
continue;
|
1729
1678
|
}
|
1730
|
-
XdsApi::CdsUpdate& cds_update = (*cds_update_map)[
|
1679
|
+
XdsApi::CdsUpdate& cds_update = (*cds_update_map)[cluster_name];
|
1731
1680
|
// Check the cluster_discovery_type.
|
1732
|
-
if (!envoy_config_cluster_v3_Cluster_has_type(cluster)
|
1733
|
-
|
1681
|
+
if (!envoy_config_cluster_v3_Cluster_has_type(cluster) &&
|
1682
|
+
!envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
|
1683
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1684
|
+
absl::StrCat(cluster_name, ": DiscoveryType not found.").c_str()));
|
1685
|
+
resource_names_failed->insert(cluster_name);
|
1686
|
+
continue;
|
1734
1687
|
}
|
1735
|
-
if (envoy_config_cluster_v3_Cluster_type(cluster)
|
1688
|
+
if (envoy_config_cluster_v3_Cluster_type(cluster) ==
|
1736
1689
|
envoy_config_cluster_v3_Cluster_EDS) {
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1690
|
+
cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::EDS;
|
1691
|
+
// Check the EDS config source.
|
1692
|
+
const envoy_config_cluster_v3_Cluster_EdsClusterConfig*
|
1693
|
+
eds_cluster_config =
|
1694
|
+
envoy_config_cluster_v3_Cluster_eds_cluster_config(cluster);
|
1695
|
+
const envoy_config_core_v3_ConfigSource* eds_config =
|
1696
|
+
envoy_config_cluster_v3_Cluster_EdsClusterConfig_eds_config(
|
1697
|
+
eds_cluster_config);
|
1698
|
+
if (!envoy_config_core_v3_ConfigSource_has_ads(eds_config)) {
|
1699
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1700
|
+
absl::StrCat(cluster_name, ": EDS ConfigSource is not ADS.")
|
1701
|
+
.c_str()));
|
1702
|
+
resource_names_failed->insert(cluster_name);
|
1703
|
+
continue;
|
1704
|
+
}
|
1705
|
+
// Record EDS service_name (if any).
|
1706
|
+
upb_strview service_name =
|
1707
|
+
envoy_config_cluster_v3_Cluster_EdsClusterConfig_service_name(
|
1708
|
+
eds_cluster_config);
|
1709
|
+
if (service_name.size != 0) {
|
1710
|
+
cds_update.eds_service_name = UpbStringToStdString(service_name);
|
1711
|
+
}
|
1712
|
+
} else if (!XdsAggregateAndLogicalDnsClusterEnabled()) {
|
1713
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1714
|
+
absl::StrCat(cluster_name, ": DiscoveryType is not valid.").c_str()));
|
1715
|
+
resource_names_failed->insert(cluster_name);
|
1716
|
+
continue;
|
1717
|
+
} else if (envoy_config_cluster_v3_Cluster_type(cluster) ==
|
1718
|
+
envoy_config_cluster_v3_Cluster_LOGICAL_DNS) {
|
1719
|
+
cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::LOGICAL_DNS;
|
1720
|
+
} else {
|
1721
|
+
if (envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
|
1722
|
+
const envoy_config_cluster_v3_Cluster_CustomClusterType*
|
1723
|
+
custom_cluster_type =
|
1724
|
+
envoy_config_cluster_v3_Cluster_cluster_type(cluster);
|
1725
|
+
upb_strview type_name =
|
1726
|
+
envoy_config_cluster_v3_Cluster_CustomClusterType_name(
|
1727
|
+
custom_cluster_type);
|
1728
|
+
if (UpbStringToAbsl(type_name) == "envoy.clusters.aggregate") {
|
1729
|
+
cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::AGGREGATE;
|
1730
|
+
// Retrieve aggregate clusters.
|
1731
|
+
const google_protobuf_Any* typed_config =
|
1732
|
+
envoy_config_cluster_v3_Cluster_CustomClusterType_typed_config(
|
1733
|
+
custom_cluster_type);
|
1734
|
+
const upb_strview aggregate_cluster_config_upb_strview =
|
1735
|
+
google_protobuf_Any_value(typed_config);
|
1736
|
+
const envoy_extensions_clusters_aggregate_v3_ClusterConfig*
|
1737
|
+
aggregate_cluster_config =
|
1738
|
+
envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse(
|
1739
|
+
aggregate_cluster_config_upb_strview.data,
|
1740
|
+
aggregate_cluster_config_upb_strview.size, arena);
|
1741
|
+
if (aggregate_cluster_config == nullptr) {
|
1742
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1743
|
+
absl::StrCat(cluster_name, ": Can't parse aggregate cluster.")
|
1744
|
+
.c_str()));
|
1745
|
+
resource_names_failed->insert(cluster_name);
|
1746
|
+
continue;
|
1747
|
+
}
|
1748
|
+
size_t size;
|
1749
|
+
const upb_strview* clusters =
|
1750
|
+
envoy_extensions_clusters_aggregate_v3_ClusterConfig_clusters(
|
1751
|
+
aggregate_cluster_config, &size);
|
1752
|
+
for (size_t i = 0; i < size; ++i) {
|
1753
|
+
const upb_strview cluster = clusters[i];
|
1754
|
+
cds_update.prioritized_cluster_names.emplace_back(
|
1755
|
+
UpbStringToStdString(cluster));
|
1756
|
+
}
|
1757
|
+
} else {
|
1758
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1759
|
+
absl::StrCat(cluster_name, ": DiscoveryType is not valid.")
|
1760
|
+
.c_str()));
|
1761
|
+
resource_names_failed->insert(cluster_name);
|
1762
|
+
continue;
|
1763
|
+
}
|
1764
|
+
} else {
|
1765
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1766
|
+
absl::StrCat(cluster_name, ": DiscoveryType is not valid.")
|
1767
|
+
.c_str()));
|
1768
|
+
resource_names_failed->insert(cluster_name);
|
1769
|
+
continue;
|
1770
|
+
}
|
1755
1771
|
}
|
1756
1772
|
// Check the LB policy.
|
1757
|
-
if (envoy_config_cluster_v3_Cluster_lb_policy(cluster)
|
1773
|
+
if (envoy_config_cluster_v3_Cluster_lb_policy(cluster) ==
|
1758
1774
|
envoy_config_cluster_v3_Cluster_ROUND_ROBIN) {
|
1759
|
-
|
1760
|
-
|
1775
|
+
cds_update.lb_policy = "ROUND_ROBIN";
|
1776
|
+
} else if (XdsRingHashEnabled() &&
|
1777
|
+
envoy_config_cluster_v3_Cluster_lb_policy(cluster) ==
|
1778
|
+
envoy_config_cluster_v3_Cluster_RING_HASH) {
|
1779
|
+
cds_update.lb_policy = "RING_HASH";
|
1780
|
+
// Record ring hash lb config
|
1781
|
+
auto* ring_hash_config =
|
1782
|
+
envoy_config_cluster_v3_Cluster_ring_hash_lb_config(cluster);
|
1783
|
+
if (ring_hash_config == nullptr) {
|
1784
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1785
|
+
absl::StrCat(cluster_name,
|
1786
|
+
": ring hash lb config required but not present.")
|
1787
|
+
.c_str()));
|
1788
|
+
resource_names_failed->insert(cluster_name);
|
1789
|
+
continue;
|
1790
|
+
}
|
1791
|
+
const google_protobuf_UInt64Value* max_ring_size =
|
1792
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_maximum_ring_size(
|
1793
|
+
ring_hash_config);
|
1794
|
+
if (max_ring_size != nullptr) {
|
1795
|
+
cds_update.max_ring_size =
|
1796
|
+
google_protobuf_UInt64Value_value(max_ring_size);
|
1797
|
+
if (cds_update.max_ring_size > 8388608 ||
|
1798
|
+
cds_update.max_ring_size == 0) {
|
1799
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1800
|
+
absl::StrCat(
|
1801
|
+
cluster_name,
|
1802
|
+
": max_ring_size is not in the range of 1 to 8388608.")
|
1803
|
+
.c_str()));
|
1804
|
+
resource_names_failed->insert(cluster_name);
|
1805
|
+
continue;
|
1806
|
+
}
|
1807
|
+
}
|
1808
|
+
const google_protobuf_UInt64Value* min_ring_size =
|
1809
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_minimum_ring_size(
|
1810
|
+
ring_hash_config);
|
1811
|
+
if (min_ring_size != nullptr) {
|
1812
|
+
cds_update.min_ring_size =
|
1813
|
+
google_protobuf_UInt64Value_value(min_ring_size);
|
1814
|
+
if (cds_update.min_ring_size > 8388608 ||
|
1815
|
+
cds_update.min_ring_size == 0) {
|
1816
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1817
|
+
absl::StrCat(
|
1818
|
+
cluster_name,
|
1819
|
+
": min_ring_size is not in the range of 1 to 8388608.")
|
1820
|
+
.c_str()));
|
1821
|
+
resource_names_failed->insert(cluster_name);
|
1822
|
+
continue;
|
1823
|
+
}
|
1824
|
+
if (cds_update.min_ring_size > cds_update.max_ring_size) {
|
1825
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1826
|
+
absl::StrCat(
|
1827
|
+
cluster_name,
|
1828
|
+
": min_ring_size cannot be greater than max_ring_size.")
|
1829
|
+
.c_str()));
|
1830
|
+
resource_names_failed->insert(cluster_name);
|
1831
|
+
continue;
|
1832
|
+
}
|
1833
|
+
}
|
1834
|
+
if (envoy_config_cluster_v3_Cluster_RingHashLbConfig_hash_function(
|
1835
|
+
ring_hash_config) ==
|
1836
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_XX_HASH) {
|
1837
|
+
cds_update.hash_function = XdsApi::CdsUpdate::HashFunction::XX_HASH;
|
1838
|
+
} else if (
|
1839
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_hash_function(
|
1840
|
+
ring_hash_config) ==
|
1841
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_MURMUR_HASH_2) {
|
1842
|
+
cds_update.hash_function =
|
1843
|
+
XdsApi::CdsUpdate::HashFunction::MURMUR_HASH_2;
|
1844
|
+
} else {
|
1845
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1846
|
+
absl::StrCat(cluster_name,
|
1847
|
+
": ring hash lb config has invalid hash function.")
|
1848
|
+
.c_str()));
|
1849
|
+
resource_names_failed->insert(cluster_name);
|
1850
|
+
continue;
|
1851
|
+
}
|
1852
|
+
} else {
|
1853
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1854
|
+
absl::StrCat(cluster_name, ": LB policy is not supported.").c_str()));
|
1855
|
+
resource_names_failed->insert(cluster_name);
|
1856
|
+
continue;
|
1761
1857
|
}
|
1762
1858
|
if (XdsSecurityEnabled()) {
|
1763
1859
|
// Record Upstream tls context
|
@@ -1778,8 +1874,12 @@ grpc_error* CdsResponseParse(
|
|
1778
1874
|
encoded_upstream_tls_context.data,
|
1779
1875
|
encoded_upstream_tls_context.size, arena);
|
1780
1876
|
if (upstream_tls_context == nullptr) {
|
1781
|
-
|
1782
|
-
|
1877
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1878
|
+
absl::StrCat(cluster_name,
|
1879
|
+
": Can't decode upstream tls context.")
|
1880
|
+
.c_str()));
|
1881
|
+
resource_names_failed->insert(cluster_name);
|
1882
|
+
continue;
|
1783
1883
|
}
|
1784
1884
|
auto* common_tls_context =
|
1785
1885
|
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_common_tls_context(
|
@@ -1787,15 +1887,28 @@ grpc_error* CdsResponseParse(
|
|
1787
1887
|
if (common_tls_context != nullptr) {
|
1788
1888
|
grpc_error* error = CommonTlsContextParse(
|
1789
1889
|
common_tls_context, &cds_update.common_tls_context);
|
1790
|
-
if (error != GRPC_ERROR_NONE)
|
1890
|
+
if (error != GRPC_ERROR_NONE) {
|
1891
|
+
errors.push_back(grpc_error_add_child(
|
1892
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1893
|
+
absl::StrCat(cluster_name, ": error in TLS context")
|
1894
|
+
.c_str()),
|
1895
|
+
error));
|
1896
|
+
resource_names_failed->insert(cluster_name);
|
1897
|
+
continue;
|
1898
|
+
}
|
1791
1899
|
}
|
1792
1900
|
}
|
1793
1901
|
if (cds_update.common_tls_context.combined_validation_context
|
1794
1902
|
.validation_context_certificate_provider_instance
|
1795
1903
|
.instance_name.empty()) {
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1904
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1905
|
+
absl::StrCat(cluster_name,
|
1906
|
+
"TLS configuration provided but no "
|
1907
|
+
"validation_context_certificate_provider_instance "
|
1908
|
+
"found.")
|
1909
|
+
.c_str()));
|
1910
|
+
resource_names_failed->insert(cluster_name);
|
1911
|
+
continue;
|
1799
1912
|
}
|
1800
1913
|
}
|
1801
1914
|
}
|
@@ -1805,8 +1918,11 @@ grpc_error* CdsResponseParse(
|
|
1805
1918
|
envoy_config_cluster_v3_Cluster_lrs_server(cluster);
|
1806
1919
|
if (lrs_server != nullptr) {
|
1807
1920
|
if (!envoy_config_core_v3_ConfigSource_has_self(lrs_server)) {
|
1808
|
-
|
1809
|
-
"LRS ConfigSource is not self.")
|
1921
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1922
|
+
absl::StrCat(cluster_name, ": LRS ConfigSource is not self.")
|
1923
|
+
.c_str()));
|
1924
|
+
resource_names_failed->insert(cluster_name);
|
1925
|
+
continue;
|
1810
1926
|
}
|
1811
1927
|
cds_update.lrs_load_reporting_server_name.emplace("");
|
1812
1928
|
}
|
@@ -1837,7 +1953,7 @@ grpc_error* CdsResponseParse(
|
|
1837
1953
|
}
|
1838
1954
|
}
|
1839
1955
|
}
|
1840
|
-
return
|
1956
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing CDS response", &errors);
|
1841
1957
|
}
|
1842
1958
|
|
1843
1959
|
grpc_error* ServerAddressParseAndAppend(
|
@@ -1955,7 +2071,9 @@ grpc_error* EdsResponseParse(
|
|
1955
2071
|
XdsClient* client, TraceFlag* tracer, upb_symtab* symtab,
|
1956
2072
|
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
1957
2073
|
const std::set<absl::string_view>& expected_eds_service_names,
|
1958
|
-
XdsApi::EdsUpdateMap* eds_update_map,
|
2074
|
+
XdsApi::EdsUpdateMap* eds_update_map,
|
2075
|
+
std::set<std::string>* resource_names_failed, upb_arena* arena) {
|
2076
|
+
std::vector<grpc_error*> errors;
|
1959
2077
|
// Get the resources from the response.
|
1960
2078
|
size_t size;
|
1961
2079
|
const google_protobuf_Any* const* resources =
|
@@ -1965,7 +2083,10 @@ grpc_error* EdsResponseParse(
|
|
1965
2083
|
absl::string_view type_url =
|
1966
2084
|
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
1967
2085
|
if (!IsEds(type_url)) {
|
1968
|
-
|
2086
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2087
|
+
absl::StrCat("resource index ", i, ": Resource is not EDS.")
|
2088
|
+
.c_str()));
|
2089
|
+
continue;
|
1969
2090
|
}
|
1970
2091
|
// Get the cluster_load_assignment.
|
1971
2092
|
upb_strview encoded_cluster_load_assignment =
|
@@ -1975,8 +2096,11 @@ grpc_error* EdsResponseParse(
|
|
1975
2096
|
encoded_cluster_load_assignment.data,
|
1976
2097
|
encoded_cluster_load_assignment.size, arena);
|
1977
2098
|
if (cluster_load_assignment == nullptr) {
|
1978
|
-
|
1979
|
-
"
|
2099
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2100
|
+
absl::StrCat("resource index ", i,
|
2101
|
+
": Can't parse cluster_load_assignment.")
|
2102
|
+
.c_str()));
|
2103
|
+
continue;
|
1980
2104
|
}
|
1981
2105
|
MaybeLogClusterLoadAssignment(client, tracer, symtab,
|
1982
2106
|
cluster_load_assignment);
|
@@ -1990,22 +2114,24 @@ grpc_error* EdsResponseParse(
|
|
1990
2114
|
}
|
1991
2115
|
// Fail on duplicate resources.
|
1992
2116
|
if (eds_update_map->find(eds_service_name) != eds_update_map->end()) {
|
1993
|
-
|
2117
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
1994
2118
|
absl::StrCat("duplicate resource name \"", eds_service_name, "\"")
|
1995
|
-
.c_str());
|
2119
|
+
.c_str()));
|
2120
|
+
resource_names_failed->insert(eds_service_name);
|
2121
|
+
continue;
|
1996
2122
|
}
|
1997
|
-
XdsApi::EdsUpdate& eds_update =
|
1998
|
-
(*eds_update_map)[std::move(eds_service_name)];
|
2123
|
+
XdsApi::EdsUpdate& eds_update = (*eds_update_map)[eds_service_name];
|
1999
2124
|
// Get the endpoints.
|
2000
2125
|
size_t locality_size;
|
2001
2126
|
const envoy_config_endpoint_v3_LocalityLbEndpoints* const* endpoints =
|
2002
2127
|
envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(
|
2003
2128
|
cluster_load_assignment, &locality_size);
|
2129
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
2004
2130
|
for (size_t j = 0; j < locality_size; ++j) {
|
2005
2131
|
size_t priority;
|
2006
2132
|
XdsApi::EdsUpdate::Priority::Locality locality;
|
2007
|
-
|
2008
|
-
if (error != GRPC_ERROR_NONE)
|
2133
|
+
error = LocalityParse(endpoints[j], &locality, &priority);
|
2134
|
+
if (error != GRPC_ERROR_NONE) break;
|
2009
2135
|
// Filter out locality with weight 0.
|
2010
2136
|
if (locality.lb_weight == 0) continue;
|
2011
2137
|
// Make sure prorities is big enough. Note that they might not
|
@@ -2016,10 +2142,21 @@ grpc_error* EdsResponseParse(
|
|
2016
2142
|
eds_update.priorities[priority].localities.emplace(locality.name.get(),
|
2017
2143
|
std::move(locality));
|
2018
2144
|
}
|
2145
|
+
if (error != GRPC_ERROR_NONE) {
|
2146
|
+
errors.push_back(grpc_error_add_child(
|
2147
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2148
|
+
absl::StrCat(eds_service_name, ": locality validation error")
|
2149
|
+
.c_str()),
|
2150
|
+
error));
|
2151
|
+
resource_names_failed->insert(eds_service_name);
|
2152
|
+
continue;
|
2153
|
+
}
|
2019
2154
|
for (const auto& priority : eds_update.priorities) {
|
2020
2155
|
if (priority.localities.empty()) {
|
2021
|
-
|
2022
|
-
"
|
2156
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2157
|
+
absl::StrCat(eds_service_name, ": sparse priority list").c_str()));
|
2158
|
+
resource_names_failed->insert(eds_service_name);
|
2159
|
+
continue;
|
2023
2160
|
}
|
2024
2161
|
}
|
2025
2162
|
// Get the drop config.
|
@@ -2034,13 +2171,22 @@ grpc_error* EdsResponseParse(
|
|
2034
2171
|
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_drop_overloads(
|
2035
2172
|
policy, &drop_size);
|
2036
2173
|
for (size_t j = 0; j < drop_size; ++j) {
|
2037
|
-
|
2174
|
+
error =
|
2038
2175
|
DropParseAndAppend(drop_overload[j], eds_update.drop_config.get());
|
2039
|
-
if (error != GRPC_ERROR_NONE)
|
2176
|
+
if (error != GRPC_ERROR_NONE) break;
|
2177
|
+
}
|
2178
|
+
if (error != GRPC_ERROR_NONE) {
|
2179
|
+
errors.push_back(grpc_error_add_child(
|
2180
|
+
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2181
|
+
absl::StrCat(eds_service_name, ": drop config validation error")
|
2182
|
+
.c_str()),
|
2183
|
+
error));
|
2184
|
+
resource_names_failed->insert(eds_service_name);
|
2185
|
+
continue;
|
2040
2186
|
}
|
2041
2187
|
}
|
2042
2188
|
}
|
2043
|
-
return
|
2189
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing EDS response", &errors);
|
2044
2190
|
}
|
2045
2191
|
|
2046
2192
|
std::string TypeUrlInternalToExternal(absl::string_view type_url) {
|
@@ -2056,6 +2202,15 @@ std::string TypeUrlInternalToExternal(absl::string_view type_url) {
|
|
2056
2202
|
return std::string(type_url);
|
2057
2203
|
}
|
2058
2204
|
|
2205
|
+
template <typename UpdateMap>
|
2206
|
+
void MoveUpdatesToFailedSet(UpdateMap* update_map,
|
2207
|
+
std::set<std::string>* resource_names_failed) {
|
2208
|
+
for (const auto& p : *update_map) {
|
2209
|
+
resource_names_failed->insert(p.first);
|
2210
|
+
}
|
2211
|
+
update_map->clear();
|
2212
|
+
}
|
2213
|
+
|
2059
2214
|
} // namespace
|
2060
2215
|
|
2061
2216
|
XdsApi::AdsParseResult XdsApi::ParseAdsResponse(
|
@@ -2087,22 +2242,38 @@ XdsApi::AdsParseResult XdsApi::ParseAdsResponse(
|
|
2087
2242
|
envoy_service_discovery_v3_DiscoveryResponse_nonce(response));
|
2088
2243
|
// Parse the response according to the resource type.
|
2089
2244
|
if (IsLds(result.type_url)) {
|
2090
|
-
result.parse_error = LdsResponseParse(
|
2091
|
-
|
2092
|
-
|
2245
|
+
result.parse_error = LdsResponseParse(
|
2246
|
+
client_, tracer_, symtab_.ptr(), response, expected_listener_names,
|
2247
|
+
&result.lds_update_map, &result.resource_names_failed, arena.ptr());
|
2248
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
2249
|
+
MoveUpdatesToFailedSet(&result.lds_update_map,
|
2250
|
+
&result.resource_names_failed);
|
2251
|
+
}
|
2093
2252
|
} else if (IsRds(result.type_url)) {
|
2094
|
-
result.parse_error =
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2253
|
+
result.parse_error = RdsResponseParse(
|
2254
|
+
client_, tracer_, symtab_.ptr(), response,
|
2255
|
+
expected_route_configuration_names, &result.rds_update_map,
|
2256
|
+
&result.resource_names_failed, arena.ptr());
|
2257
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
2258
|
+
MoveUpdatesToFailedSet(&result.rds_update_map,
|
2259
|
+
&result.resource_names_failed);
|
2260
|
+
}
|
2098
2261
|
} else if (IsCds(result.type_url)) {
|
2099
|
-
result.parse_error = CdsResponseParse(
|
2100
|
-
|
2101
|
-
|
2262
|
+
result.parse_error = CdsResponseParse(
|
2263
|
+
client_, tracer_, symtab_.ptr(), response, expected_cluster_names,
|
2264
|
+
&result.cds_update_map, &result.resource_names_failed, arena.ptr());
|
2265
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
2266
|
+
MoveUpdatesToFailedSet(&result.cds_update_map,
|
2267
|
+
&result.resource_names_failed);
|
2268
|
+
}
|
2102
2269
|
} else if (IsEds(result.type_url)) {
|
2103
|
-
result.parse_error = EdsResponseParse(
|
2104
|
-
|
2105
|
-
|
2270
|
+
result.parse_error = EdsResponseParse(
|
2271
|
+
client_, tracer_, symtab_.ptr(), response, expected_eds_service_names,
|
2272
|
+
&result.eds_update_map, &result.resource_names_failed, arena.ptr());
|
2273
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
2274
|
+
MoveUpdatesToFailedSet(&result.eds_update_map,
|
2275
|
+
&result.resource_names_failed);
|
2276
|
+
}
|
2106
2277
|
}
|
2107
2278
|
return result;
|
2108
2279
|
}
|