grpc 1.40.0 → 1.41.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 +27 -36
- data/include/grpc/byte_buffer.h +1 -1
- data/include/grpc/byte_buffer_reader.h +1 -1
- data/include/grpc/event_engine/endpoint_config.h +6 -11
- data/include/grpc/event_engine/event_engine.h +63 -58
- data/include/grpc/event_engine/port.h +1 -3
- data/include/grpc/event_engine/slice_allocator.h +6 -1
- data/include/grpc/fork.h +1 -1
- data/include/grpc/grpc.h +10 -4
- data/include/grpc/grpc_posix.h +5 -2
- data/include/grpc/impl/codegen/atm.h +5 -3
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +2 -0
- data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
- data/include/grpc/impl/codegen/atm_windows.h +2 -0
- data/include/grpc/impl/codegen/byte_buffer.h +2 -0
- data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -0
- data/include/grpc/impl/codegen/compression_types.h +2 -0
- data/include/grpc/impl/codegen/connectivity_state.h +2 -0
- data/include/grpc/impl/codegen/fork.h +2 -0
- data/include/grpc/impl/codegen/gpr_slice.h +2 -0
- data/include/grpc/impl/codegen/gpr_types.h +2 -0
- data/include/grpc/impl/codegen/grpc_types.h +4 -5
- data/include/grpc/impl/codegen/log.h +2 -0
- data/include/grpc/impl/codegen/port_platform.h +26 -22
- data/include/grpc/impl/codegen/propagation_bits.h +2 -0
- data/include/grpc/impl/codegen/slice.h +2 -0
- data/include/grpc/impl/codegen/status.h +2 -0
- data/include/grpc/impl/codegen/sync.h +8 -5
- data/include/grpc/impl/codegen/sync_abseil.h +2 -0
- data/include/grpc/impl/codegen/sync_custom.h +2 -0
- data/include/grpc/impl/codegen/sync_generic.h +3 -0
- data/include/grpc/impl/codegen/sync_posix.h +4 -2
- data/include/grpc/impl/codegen/sync_windows.h +2 -0
- data/include/grpc/slice.h +1 -1
- data/include/grpc/status.h +1 -1
- data/include/grpc/support/atm.h +1 -1
- data/include/grpc/support/atm_gcc_atomic.h +1 -1
- data/include/grpc/support/atm_gcc_sync.h +1 -1
- data/include/grpc/support/atm_windows.h +1 -1
- data/include/grpc/support/log.h +1 -1
- data/include/grpc/support/port_platform.h +1 -1
- data/include/grpc/support/sync.h +1 -1
- data/include/grpc/support/sync_abseil.h +1 -1
- data/include/grpc/support/sync_custom.h +1 -1
- data/include/grpc/support/sync_generic.h +1 -1
- data/include/grpc/support/sync_posix.h +1 -1
- data/include/grpc/support/sync_windows.h +1 -1
- data/include/grpc/support/time.h +2 -2
- data/src/core/ext/filters/census/grpc_context.cc +1 -0
- data/src/core/ext/filters/client_channel/backend_metric.cc +0 -1
- data/src/core/ext/filters/client_channel/backup_poller.h +1 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +24 -52
- data/src/core/ext/filters/client_channel/client_channel.h +3 -3
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +6 -5
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +1 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +8 -1
- data/src/core/ext/filters/client_channel/config_selector.cc +1 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +7 -6
- data/src/core/ext/filters/client_channel/health/health_check_client.h +4 -3
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +8 -7
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +10 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +2 -8
- 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/grpclb/grpclb_client_stats.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +14 -23
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +2 -8
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +15 -18
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +10 -7
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +2 -8
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +2 -3
- data/src/core/ext/filters/client_channel/lb_policy.h +11 -44
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +2 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +6 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +14 -19
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +5 -5
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -8
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +2 -3
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +36 -30
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +8 -6
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +6 -13
- data/src/core/ext/filters/http/client/http_client_filter.cc +3 -2
- data/src/core/ext/filters/http/client_authority_filter.cc +2 -1
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -1
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +7 -8
- data/src/core/ext/filters/http/server/http_server_filter.cc +5 -3
- data/src/core/ext/filters/message_size/message_size_filter.cc +9 -13
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +29 -12
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +2 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +2 -3
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +10 -6
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +2 -3
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +60 -37
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +0 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +12 -6
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +5 -9
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +3 -1
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -1
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +2 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +24 -30
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +4 -1
- data/src/core/ext/transport/chttp2/transport/context_list.h +1 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +39 -23
- data/src/core/ext/transport/chttp2/transport/flow_control.h +9 -3
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +3 -5
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +36 -5
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +12 -7
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -0
- data/src/core/ext/transport/chttp2/transport/hpack_constants.h +41 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +272 -666
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +236 -70
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +107 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +86 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +69 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +776 -1037
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +48 -169
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +159 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +130 -0
- data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +46 -0
- data/src/core/ext/transport/chttp2/transport/hpack_utils.h +30 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +20 -30
- data/src/core/ext/transport/chttp2/transport/popularity_count.h +60 -0
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/varint.cc +7 -3
- data/src/core/ext/transport/chttp2/transport/varint.h +39 -28
- data/src/core/ext/transport/chttp2/transport/writing.cc +32 -28
- data/src/core/ext/transport/inproc/inproc_transport.cc +6 -4
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +96 -96
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +221 -89
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +48 -48
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +151 -61
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +99 -99
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +171 -69
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +15 -15
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +126 -127
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +229 -101
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +23 -23
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +28 -28
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +71 -29
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +82 -82
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +201 -81
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +24 -24
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +51 -21
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +9 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +21 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +62 -62
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +131 -53
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +51 -51
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +81 -33
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +5 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +62 -62
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +141 -57
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +21 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +16 -16
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +57 -22
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +174 -17
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +32 -32
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +51 -21
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +37 -37
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +61 -25
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +40 -40
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +71 -29
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +9 -9
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +5 -5
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +21 -9
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +30 -30
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +81 -33
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +41 -29
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +141 -43
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +46 -43
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +88 -29
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +18 -18
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +281 -277
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +569 -248
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +10 -10
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +6 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +21 -9
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +13 -13
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +51 -21
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +23 -23
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +9 -9
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +115 -116
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +191 -77
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -1
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +46 -32
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +118 -34
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +12 -12
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +44 -42
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +108 -55
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +42 -42
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +61 -25
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +9 -9
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +21 -9
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +28 -28
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +51 -21
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +41 -17
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +9 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +25 -9
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +11 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +9 -9
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +10 -10
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +21 -9
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +6 -6
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +21 -9
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +11 -11
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +15 -15
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +71 -29
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +19 -19
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +51 -21
- data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -1
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +6 -6
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +21 -9
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +10 -10
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +31 -13
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +5 -5
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +11 -5
- data/src/core/ext/upb-generated/google/api/annotations.upb.c +1 -1
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -1
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +58 -58
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +111 -45
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +68 -68
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +121 -49
- data/src/core/ext/upb-generated/google/api/http.upb.c +18 -18
- data/src/core/ext/upb-generated/google/api/http.upb.h +31 -13
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +4 -4
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +11 -5
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +153 -153
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +271 -109
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +4 -4
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +11 -5
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +2 -2
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +11 -5
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +15 -15
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +31 -13
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +4 -4
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +11 -5
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +19 -19
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +91 -37
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +5 -5
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +11 -5
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +12 -12
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +11 -5
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +60 -60
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +101 -41
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +7 -7
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +21 -9
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +5 -5
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +21 -9
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +31 -31
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +91 -37
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +8 -8
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +31 -13
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +4 -4
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +11 -5
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +1 -1
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -1
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +4 -4
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +11 -5
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +11 -5
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +13 -13
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +11 -5
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +4 -4
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +11 -5
- data/src/core/ext/upb-generated/validate/validate.upb.c +220 -220
- data/src/core/ext/upb-generated/validate/validate.upb.h +231 -93
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +3 -3
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +11 -5
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +8 -8
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +21 -9
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +6 -6
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +11 -5
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +5 -5
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +11 -5
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +11 -11
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +21 -9
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +6 -6
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +11 -5
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +384 -382
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +94 -63
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +30 -19
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +791 -780
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +96 -100
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +133 -115
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +178 -173
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +14 -13
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +103 -103
- data/src/core/ext/xds/certificate_provider_registry.cc +2 -2
- data/src/core/ext/xds/xds_api.cc +788 -910
- data/src/core/ext/xds/xds_api.h +16 -33
- data/src/core/ext/xds/xds_bootstrap.cc +27 -52
- data/src/core/ext/xds/xds_client.cc +69 -30
- data/src/core/ext/xds/xds_client_stats.cc +16 -15
- data/src/core/ext/xds/xds_client_stats.h +6 -6
- data/src/core/ext/xds/xds_http_fault_filter.cc +4 -3
- data/src/core/ext/xds/xds_http_fault_filter.h +3 -2
- data/src/core/ext/xds/xds_http_filters.cc +1 -0
- data/src/core/ext/xds/xds_server_config_fetcher.cc +10 -10
- data/src/core/lib/address_utils/parse_address.cc +4 -8
- data/src/core/lib/address_utils/sockaddr_utils.cc +2 -2
- data/src/core/lib/channel/channel_args.cc +2 -1
- data/src/core/lib/channel/channel_stack.cc +5 -3
- data/src/core/lib/channel/channel_stack_builder.cc +1 -11
- data/src/core/lib/channel/channel_stack_builder.h +0 -8
- data/src/core/lib/channel/channel_trace.cc +4 -3
- data/src/core/lib/channel/channel_trace.h +1 -0
- data/src/core/lib/channel/channelz.cc +40 -36
- data/src/core/lib/channel/channelz.h +27 -27
- data/src/core/lib/channel/channelz_registry.cc +7 -6
- data/src/core/lib/channel/connected_channel.cc +1 -0
- data/src/core/lib/channel/handshaker.cc +2 -1
- data/src/core/lib/channel/handshaker.h +1 -2
- data/src/core/lib/channel/handshaker_factory.h +10 -2
- data/src/core/lib/channel/handshaker_registry.cc +15 -70
- data/src/core/lib/channel/handshaker_registry.h +29 -12
- data/src/core/lib/channel/status_util.h +2 -2
- data/src/core/lib/compression/algorithm_metadata.h +1 -0
- data/src/core/lib/compression/compression_args.cc +2 -1
- data/src/core/lib/compression/compression_internal.cc +2 -4
- data/src/core/lib/compression/message_compress.cc +2 -2
- data/src/core/lib/compression/stream_compression.cc +2 -1
- data/src/core/lib/compression/stream_compression.h +2 -1
- data/src/core/lib/compression/stream_compression_gzip.cc +2 -1
- data/src/core/lib/compression/stream_compression_identity.cc +2 -1
- data/src/core/lib/config/core_configuration.cc +54 -0
- data/src/core/lib/config/core_configuration.h +108 -0
- data/src/core/lib/debug/stats.h +1 -0
- data/src/core/lib/debug/stats_data.cc +2 -1
- data/src/core/lib/debug/stats_data.h +1 -0
- data/src/core/lib/debug/trace.cc +1 -0
- data/src/core/lib/debug/trace.h +2 -1
- data/src/core/lib/event_engine/endpoint_config.cc +0 -1
- data/src/core/lib/event_engine/event_engine.cc +3 -3
- data/src/core/lib/event_engine/sockaddr.cc +3 -3
- data/src/core/lib/gpr/alloc.cc +4 -3
- data/src/core/lib/gpr/env_linux.cc +1 -2
- data/src/core/lib/gpr/env_posix.cc +2 -3
- data/src/core/lib/gpr/log.cc +3 -3
- data/src/core/lib/gpr/log_android.cc +3 -2
- data/src/core/lib/gpr/log_linux.cc +7 -4
- data/src/core/lib/gpr/log_posix.cc +6 -3
- data/src/core/lib/gpr/string.h +2 -2
- data/src/core/lib/gpr/sync.cc +2 -2
- data/src/core/lib/gpr/sync_abseil.cc +7 -6
- data/src/core/lib/gpr/sync_posix.cc +3 -3
- data/src/core/lib/gpr/time.cc +3 -2
- data/src/core/lib/gpr/time_windows.cc +3 -2
- data/src/core/lib/gpr/tls.h +120 -41
- data/src/core/lib/gpr/tmpfile_posix.cc +1 -2
- data/src/core/lib/gprpp/arena.cc +2 -1
- data/src/core/lib/gprpp/arena.h +5 -5
- data/src/core/lib/gprpp/atomic_utils.h +47 -0
- data/src/core/lib/gprpp/bitset.h +166 -0
- data/src/core/lib/gprpp/construct_destruct.h +39 -0
- data/src/core/lib/gprpp/dual_ref_counted.h +25 -26
- data/src/core/lib/gprpp/fork.cc +14 -12
- data/src/core/lib/gprpp/fork.h +4 -4
- data/src/core/lib/gprpp/global_config.h +1 -2
- data/src/core/lib/gprpp/global_config_env.cc +7 -7
- data/src/core/lib/gprpp/global_config_generic.h +2 -2
- data/src/core/lib/gprpp/manual_constructor.h +8 -5
- data/src/core/lib/gprpp/match.h +73 -0
- data/src/core/lib/gprpp/memory.h +3 -3
- data/src/core/lib/gprpp/mpscq.cc +7 -7
- data/src/core/lib/gprpp/mpscq.h +6 -5
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/overload.h +59 -0
- data/src/core/lib/gprpp/ref_counted.h +18 -18
- data/src/core/lib/gprpp/status_helper.cc +4 -4
- data/src/core/lib/gprpp/sync.h +3 -1
- data/src/core/lib/gprpp/thd_posix.cc +5 -5
- data/src/core/lib/gprpp/thd_windows.cc +4 -11
- data/src/core/lib/gprpp/time_util.cc +2 -2
- data/src/core/lib/gprpp/time_util.h +2 -2
- data/src/core/lib/http/format_request.cc +1 -0
- data/src/core/lib/http/format_request.h +1 -0
- data/src/core/lib/http/httpcli.cc +9 -9
- data/src/core/lib/http/httpcli.h +3 -0
- data/src/core/lib/http/httpcli_security_connector.cc +5 -8
- data/src/core/lib/http/parser.h +1 -0
- data/src/core/lib/iomgr/buffer_list.cc +2 -1
- data/src/core/lib/iomgr/buffer_list.h +1 -2
- data/src/core/lib/iomgr/call_combiner.cc +1 -0
- data/src/core/lib/iomgr/cfstream_handle.cc +1 -1
- data/src/core/lib/iomgr/combiner.cc +3 -2
- data/src/core/lib/iomgr/combiner.h +1 -0
- data/src/core/lib/iomgr/dualstack_socket_posix.cc +1 -0
- data/src/core/lib/iomgr/endpoint.cc +0 -4
- data/src/core/lib/iomgr/endpoint.h +1 -3
- data/src/core/lib/iomgr/endpoint_cfstream.cc +9 -20
- data/src/core/lib/iomgr/endpoint_cfstream.h +1 -1
- data/src/core/lib/iomgr/endpoint_pair.h +1 -0
- data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +1 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +15 -11
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +17 -9
- data/src/core/lib/iomgr/error.h +23 -9
- data/src/core/lib/iomgr/error_cfstream.cc +2 -2
- data/src/core/lib/iomgr/error_internal.h +1 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +14 -22
- data/src/core/lib/iomgr/ev_epollex_linux.cc +15 -22
- data/src/core/lib/iomgr/ev_poll_posix.cc +13 -25
- data/src/core/lib/iomgr/ev_posix.cc +1 -2
- data/src/core/lib/iomgr/event_engine/endpoint.cc +3 -22
- data/src/core/lib/iomgr/event_engine/endpoint.h +1 -2
- data/src/core/lib/iomgr/event_engine/iomgr.cc +17 -18
- data/src/core/lib/iomgr/event_engine/iomgr.h +20 -2
- data/src/core/lib/iomgr/event_engine/resolver.cc +2 -1
- data/src/core/lib/iomgr/event_engine/tcp.cc +53 -24
- data/src/core/lib/iomgr/exec_ctx.cc +3 -4
- data/src/core/lib/iomgr/exec_ctx.h +11 -19
- data/src/core/lib/iomgr/executor/mpmcqueue.cc +10 -9
- data/src/core/lib/iomgr/executor/mpmcqueue.h +4 -3
- data/src/core/lib/iomgr/executor/threadpool.cc +2 -2
- data/src/core/lib/iomgr/executor/threadpool.h +2 -1
- data/src/core/lib/iomgr/executor.cc +5 -6
- data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +2 -2
- data/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc +2 -2
- data/src/core/lib/iomgr/internal_errqueue.cc +3 -2
- data/src/core/lib/iomgr/iocp_windows.cc +1 -0
- data/src/core/lib/iomgr/iomgr.h +2 -2
- data/src/core/lib/iomgr/iomgr_custom.cc +2 -2
- data/src/core/lib/iomgr/iomgr_custom.h +2 -2
- data/src/core/lib/iomgr/iomgr_internal.cc +2 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +1 -2
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +4 -4
- data/src/core/lib/iomgr/polling_entity.cc +2 -2
- data/src/core/lib/iomgr/pollset_custom.cc +3 -4
- data/src/core/lib/iomgr/pollset_custom.h +2 -2
- data/src/core/lib/iomgr/pollset_set_custom.cc +1 -2
- data/src/core/lib/iomgr/pollset_set_windows.cc +1 -0
- data/src/core/lib/iomgr/port.h +0 -5
- data/src/core/lib/iomgr/python_util.h +1 -0
- data/src/core/lib/iomgr/resolve_address.cc +2 -1
- data/src/core/lib/iomgr/resolve_address.h +0 -4
- data/src/core/lib/iomgr/resolve_address_custom.cc +4 -4
- data/src/core/lib/iomgr/resolve_address_custom.h +0 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +2 -4
- data/src/core/lib/iomgr/resolve_address_windows.cc +6 -8
- data/src/core/lib/iomgr/resource_quota.cc +127 -42
- data/src/core/lib/iomgr/resource_quota.h +66 -17
- data/src/core/lib/iomgr/sockaddr.h +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.cc +3 -3
- data/src/core/lib/iomgr/socket_factory_posix.h +1 -0
- data/src/core/lib/iomgr/socket_mutator.h +2 -2
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +3 -3
- data/src/core/lib/iomgr/socket_utils_linux.cc +4 -4
- data/src/core/lib/iomgr/socket_utils_posix.cc +2 -2
- data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
- data/src/core/lib/iomgr/socket_utils_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_client.cc +4 -2
- data/src/core/lib/iomgr/tcp_client.h +4 -0
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +9 -19
- data/src/core/lib/iomgr/tcp_client_custom.cc +9 -17
- data/src/core/lib/iomgr/tcp_client_posix.cc +24 -9
- data/src/core/lib/iomgr/tcp_client_posix.h +5 -2
- data/src/core/lib/iomgr/tcp_client_windows.cc +14 -6
- data/src/core/lib/iomgr/tcp_custom.cc +11 -23
- data/src/core/lib/iomgr/tcp_custom.h +2 -1
- data/src/core/lib/iomgr/tcp_posix.cc +29 -59
- data/src/core/lib/iomgr/tcp_posix.h +11 -12
- data/src/core/lib/iomgr/tcp_server.cc +6 -4
- data/src/core/lib/iomgr/tcp_server.h +12 -9
- data/src/core/lib/iomgr/tcp_server_custom.cc +15 -33
- data/src/core/lib/iomgr/tcp_server_posix.cc +20 -13
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +3 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +4 -4
- data/src/core/lib/iomgr/tcp_server_windows.cc +13 -9
- data/src/core/lib/iomgr/tcp_windows.cc +6 -25
- data/src/core/lib/iomgr/tcp_windows.h +2 -1
- data/src/core/lib/iomgr/timer.cc +1 -0
- data/src/core/lib/iomgr/timer.h +1 -2
- data/src/core/lib/iomgr/timer_custom.cc +2 -2
- data/src/core/lib/iomgr/timer_generic.cc +8 -38
- data/src/core/lib/iomgr/timer_generic.h +1 -0
- data/src/core/lib/iomgr/timer_heap.cc +1 -2
- data/src/core/lib/iomgr/udp_server.cc +1 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +3 -5
- data/src/core/lib/iomgr/unix_sockets_posix.h +2 -3
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -3
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +1 -0
- data/src/core/lib/iomgr/work_serializer.cc +4 -4
- data/src/core/lib/iomgr/work_serializer.h +1 -1
- data/src/core/lib/json/json_reader.cc +9 -17
- data/src/core/lib/json/json_util.h +18 -26
- data/src/core/lib/matchers/matchers.h +0 -1
- data/src/core/lib/profiling/basic_timers.cc +8 -6
- data/src/core/lib/profiling/stap_timers.cc +2 -2
- data/src/core/lib/security/authorization/authorization_policy_provider.h +5 -4
- data/src/core/lib/security/authorization/evaluate_args.cc +2 -0
- data/src/core/lib/security/authorization/sdk_server_authz_filter.cc +159 -0
- data/src/core/lib/security/authorization/sdk_server_authz_filter.h +67 -0
- data/src/core/lib/security/context/security_context.cc +7 -6
- data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +2 -2
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +2 -2
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +4 -3
- data/src/core/lib/security/credentials/credentials.cc +6 -6
- data/src/core/lib/security/credentials/credentials.h +1 -1
- data/src/core/lib/security/credentials/credentials_metadata.cc +2 -3
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +13 -26
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +1 -2
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +3 -3
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +13 -22
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +2 -4
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +1 -2
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +55 -3
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +2 -1
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +31 -14
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +0 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +3 -7
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -4
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +4 -4
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +3 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +10 -6
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +2 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +7 -5
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +2 -2
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +4 -6
- data/src/core/lib/security/security_connector/load_system_roots_fallback.cc +1 -0
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -3
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -7
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -2
- data/src/core/lib/security/security_connector/ssl_utils.cc +2 -3
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +9 -14
- data/src/core/lib/security/transport/auth_filters.h +1 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +4 -6
- data/src/core/lib/security/transport/secure_endpoint.cc +4 -14
- data/src/core/lib/security/transport/secure_endpoint.h +1 -0
- data/src/core/lib/security/transport/security_handshaker.cc +5 -4
- data/src/core/lib/security/transport/security_handshaker.h +2 -1
- data/src/core/lib/security/util/json_util.cc +6 -8
- data/src/core/lib/slice/percent_encoding.cc +73 -30
- data/src/core/lib/slice/percent_encoding.h +29 -28
- data/src/core/lib/slice/slice.cc +2 -3
- data/src/core/lib/slice/slice_buffer.cc +1 -2
- data/src/core/lib/slice/slice_intern.cc +2 -3
- data/src/core/lib/slice/slice_internal.h +2 -2
- data/src/core/lib/surface/api_trace.cc +2 -1
- data/src/core/lib/surface/api_trace.h +1 -0
- data/src/core/lib/surface/byte_buffer_reader.cc +1 -1
- data/src/core/lib/surface/call.cc +9 -8
- data/src/core/lib/surface/call.h +3 -3
- data/src/core/lib/surface/call_details.cc +2 -2
- data/src/core/lib/surface/call_log_batch.cc +2 -2
- data/src/core/lib/surface/channel.cc +22 -9
- data/src/core/lib/surface/channel.h +14 -2
- data/src/core/lib/surface/channel_ping.cc +1 -2
- data/src/core/lib/surface/channel_stack_type.cc +2 -1
- data/src/core/lib/surface/completion_queue.cc +54 -64
- data/src/core/lib/surface/completion_queue_factory.cc +2 -1
- data/src/core/lib/surface/completion_queue_factory.h +1 -0
- data/src/core/lib/surface/event_string.cc +1 -0
- data/src/core/lib/surface/init.cc +4 -9
- data/src/core/lib/surface/init.h +0 -1
- data/src/core/lib/surface/init_secure.cc +23 -4
- data/src/core/lib/surface/lame_client.cc +6 -5
- data/src/core/lib/surface/metadata_array.cc +2 -2
- data/src/core/lib/surface/server.cc +17 -33
- data/src/core/lib/surface/server.h +11 -13
- data/src/core/lib/surface/validate_metadata.cc +44 -16
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.h +1 -0
- data/src/core/lib/transport/connectivity_state.cc +8 -5
- data/src/core/lib/transport/connectivity_state.h +2 -2
- data/src/core/lib/transport/error_utils.cc +1 -0
- data/src/core/lib/transport/metadata.cc +10 -10
- data/src/core/lib/transport/metadata.h +13 -11
- data/src/core/lib/transport/metadata_batch.h +8 -0
- data/src/core/lib/transport/transport_op_string.cc +2 -2
- data/src/core/plugin_registry/grpc_plugin_registry.cc +14 -0
- data/src/core/tsi/alts/crypt/aes_gcm.cc +3 -2
- data/src/core/tsi/alts/crypt/gsec.h +2 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +2 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +2 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +4 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +2 -2
- data/src/core/tsi/ssl_transport_security.cc +11 -9
- data/src/core/tsi/ssl_transport_security.h +3 -1
- data/src/core/tsi/transport_security.cc +3 -3
- data/src/core/tsi/transport_security_grpc.h +1 -0
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +2 -1
- data/src/ruby/ext/grpc/rb_call.c +5 -5
- data/src/ruby/ext/grpc/rb_call_credentials.c +5 -5
- data/src/ruby/ext/grpc/rb_channel.c +10 -8
- data/src/ruby/ext/grpc/rb_channel_args.c +2 -2
- data/src/ruby/ext/grpc/rb_channel_credentials.c +4 -4
- data/src/ruby/ext/grpc/rb_channel_credentials.h +1 -0
- data/src/ruby/ext/grpc/rb_completion_queue.c +3 -2
- data/src/ruby/ext/grpc/rb_compression_options.c +5 -4
- data/src/ruby/ext/grpc/rb_event_thread.c +4 -4
- data/src/ruby/ext/grpc/rb_grpc.c +5 -4
- data/src/ruby/ext/grpc/rb_grpc.h +1 -0
- data/src/ruby/ext/grpc/rb_server.c +6 -5
- data/src/ruby/ext/grpc/rb_server_credentials.c +3 -3
- data/src/ruby/ext/grpc/rb_server_credentials.h +1 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +8 -5
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +3 -1
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +6 -5
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +3 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/err_data.c +294 -292
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +52 -47
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utf8.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_locl.h → internal.h} +20 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/time_support.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +14 -3
- data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +5 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +5 -9
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +4 -6
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +34 -0
- data/third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c +219 -121
- data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +9 -2
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +23 -2
- data/third_party/boringssl-with-bazel/src/crypto/lhash/internal.h +253 -0
- data/third_party/boringssl-with-bazel/src/crypto/lhash/lhash.c +28 -23
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pool/pool.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/fuchsia.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.c +15 -11
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +45 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +10 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +6 -23
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +25 -22
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +0 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +1 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +9 -11
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_exten.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +1 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_crld.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -11
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +5 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +160 -74
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +0 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +8 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +3 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +25 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +14 -12
- data/third_party/boringssl-with-bazel/src/include/openssl/lhash.h +4 -205
- data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +3 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +5 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +58 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +184 -55
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +0 -5
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +9 -16
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +44 -2
- data/third_party/boringssl-with-bazel/src/ssl/{t1_lib.cc → extensions.cc} +24 -11
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +9 -0
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +75 -68
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +17 -9
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +25 -6
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +1 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +11 -5
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +0 -49
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +121 -65
- data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +14 -6
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +9 -11
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +2 -2
- data/third_party/upb/upb/decode.c +129 -60
- data/third_party/upb/upb/decode.h +32 -4
- data/third_party/upb/upb/decode_fast.c +513 -500
- data/third_party/upb/upb/decode_fast.h +27 -0
- data/third_party/upb/upb/{decode.int.h → decode_internal.h} +38 -8
- data/third_party/upb/upb/def.c +171 -181
- data/third_party/upb/upb/def.h +41 -19
- data/third_party/upb/upb/def.hpp +29 -0
- data/third_party/upb/upb/encode.c +49 -16
- data/third_party/upb/upb/encode.h +29 -2
- data/third_party/upb/upb/msg.c +169 -28
- data/third_party/upb/upb/msg.h +75 -580
- data/third_party/upb/upb/msg_internal.h +687 -0
- data/third_party/upb/upb/port_def.inc +85 -24
- data/third_party/upb/upb/port_undef.inc +38 -1
- data/third_party/upb/upb/reflection.c +29 -37
- data/third_party/upb/upb/reflection.h +36 -8
- data/third_party/upb/upb/reflection.hpp +37 -0
- data/third_party/upb/upb/table.c +211 -86
- data/third_party/upb/upb/{table.int.h → table_internal.h} +56 -180
- data/third_party/upb/upb/text_encode.c +32 -4
- data/third_party/upb/upb/text_encode.h +26 -0
- data/third_party/upb/upb/upb.c +59 -8
- data/third_party/upb/upb/upb.h +36 -6
- data/third_party/upb/upb/upb.hpp +24 -0
- data/third_party/upb/upb/upb_internal.h +58 -0
- metadata +58 -56
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +0 -179
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +0 -38
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +0 -243
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +0 -148
- data/src/core/lib/gpr/tls_gcc.h +0 -52
- data/src/core/lib/gpr/tls_msvc.h +0 -54
- data/src/core/lib/gpr/tls_pthread.cc +0 -30
- data/src/core/lib/gpr/tls_pthread.h +0 -56
- data/src/core/lib/gpr/tls_stdcpp.h +0 -48
- data/src/core/lib/gprpp/atomic.h +0 -104
- data/src/core/lib/iomgr/endpoint_pair_uv.cc +0 -40
- data/src/core/lib/iomgr/iomgr_uv.cc +0 -43
- data/src/core/lib/iomgr/pollset_uv.cc +0 -95
- data/src/core/lib/iomgr/pollset_uv.h +0 -36
- data/src/core/lib/iomgr/sockaddr_custom.h +0 -54
- data/src/core/lib/iomgr/socket_utils_uv.cc +0 -49
- data/src/core/lib/iomgr/tcp_uv.cc +0 -421
- data/src/core/lib/iomgr/timer_uv.cc +0 -66
- data/third_party/upb/third_party/wyhash/wyhash.h +0 -145
- data/third_party/upb/upb/upb.int.h +0 -29
data/src/core/ext/xds/xds_api.cc
CHANGED
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
#include <grpc/support/port_platform.h>
|
20
20
|
|
21
|
+
#include "src/core/ext/xds/xds_api.h"
|
22
|
+
|
21
23
|
#include <algorithm>
|
22
24
|
#include <cctype>
|
23
25
|
#include <cstdint>
|
@@ -89,7 +91,6 @@
|
|
89
91
|
#include <grpc/support/alloc.h>
|
90
92
|
#include <grpc/support/string_util.h>
|
91
93
|
|
92
|
-
#include "src/core/ext/xds/xds_api.h"
|
93
94
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
94
95
|
#include "src/core/lib/gpr/env.h"
|
95
96
|
#include "src/core/lib/gpr/string.h"
|
@@ -115,17 +116,6 @@ bool XdsAggregateAndLogicalDnsClusterEnabled() {
|
|
115
116
|
return parse_succeeded && parsed_value;
|
116
117
|
}
|
117
118
|
|
118
|
-
// TODO(yashykt): Check to see if xDS security is enabled. This will be
|
119
|
-
// removed once this feature is fully integration-tested and enabled by
|
120
|
-
// default.
|
121
|
-
bool XdsSecurityEnabled() {
|
122
|
-
char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT");
|
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;
|
127
|
-
}
|
128
|
-
|
129
119
|
//
|
130
120
|
// XdsApi::Route::HashPolicy
|
131
121
|
//
|
@@ -437,11 +427,11 @@ bool XdsApi::CommonTlsContext::CertificateValidationContext::Empty() const {
|
|
437
427
|
}
|
438
428
|
|
439
429
|
//
|
440
|
-
// XdsApi::CommonTlsContext::
|
430
|
+
// XdsApi::CommonTlsContext::CertificateProviderPluginInstance
|
441
431
|
//
|
442
432
|
|
443
|
-
std::string
|
444
|
-
|
433
|
+
std::string
|
434
|
+
XdsApi::CommonTlsContext::CertificateProviderPluginInstance::ToString() const {
|
445
435
|
absl::InlinedVector<std::string, 2> contents;
|
446
436
|
if (!instance_name.empty()) {
|
447
437
|
contents.push_back(absl::StrFormat("instance_name=%s", instance_name));
|
@@ -453,34 +443,9 @@ std::string XdsApi::CommonTlsContext::CertificateProviderInstance::ToString()
|
|
453
443
|
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
454
444
|
}
|
455
445
|
|
456
|
-
bool XdsApi::CommonTlsContext::
|
457
|
-
return instance_name.empty() && certificate_name.empty();
|
458
|
-
}
|
459
|
-
|
460
|
-
//
|
461
|
-
// XdsApi::CommonTlsContext::CombinedCertificateValidationContext
|
462
|
-
//
|
463
|
-
|
464
|
-
std::string
|
465
|
-
XdsApi::CommonTlsContext::CombinedCertificateValidationContext::ToString()
|
446
|
+
bool XdsApi::CommonTlsContext::CertificateProviderPluginInstance::Empty()
|
466
447
|
const {
|
467
|
-
|
468
|
-
if (!default_validation_context.Empty()) {
|
469
|
-
contents.push_back(absl::StrFormat("default_validation_context=%s",
|
470
|
-
default_validation_context.ToString()));
|
471
|
-
}
|
472
|
-
if (!validation_context_certificate_provider_instance.Empty()) {
|
473
|
-
contents.push_back(absl::StrFormat(
|
474
|
-
"validation_context_certificate_provider_instance=%s",
|
475
|
-
validation_context_certificate_provider_instance.ToString()));
|
476
|
-
}
|
477
|
-
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
478
|
-
}
|
479
|
-
|
480
|
-
bool XdsApi::CommonTlsContext::CombinedCertificateValidationContext::Empty()
|
481
|
-
const {
|
482
|
-
return default_validation_context.Empty() &&
|
483
|
-
validation_context_certificate_provider_instance.Empty();
|
448
|
+
return instance_name.empty() && certificate_name.empty();
|
484
449
|
}
|
485
450
|
|
486
451
|
//
|
@@ -489,21 +454,22 @@ bool XdsApi::CommonTlsContext::CombinedCertificateValidationContext::Empty()
|
|
489
454
|
|
490
455
|
std::string XdsApi::CommonTlsContext::ToString() const {
|
491
456
|
absl::InlinedVector<std::string, 2> contents;
|
492
|
-
if (!
|
493
|
-
contents.push_back(
|
494
|
-
"
|
495
|
-
|
457
|
+
if (!tls_certificate_provider_instance.Empty()) {
|
458
|
+
contents.push_back(
|
459
|
+
absl::StrFormat("tls_certificate_provider_instance=%s",
|
460
|
+
tls_certificate_provider_instance.ToString()));
|
496
461
|
}
|
497
|
-
if (!
|
498
|
-
contents.push_back(
|
499
|
-
|
462
|
+
if (!certificate_validation_context.Empty()) {
|
463
|
+
contents.push_back(
|
464
|
+
absl::StrFormat("certificate_validation_context=%s",
|
465
|
+
certificate_validation_context.ToString()));
|
500
466
|
}
|
501
467
|
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
502
468
|
}
|
503
469
|
|
504
470
|
bool XdsApi::CommonTlsContext::Empty() const {
|
505
|
-
return
|
506
|
-
|
471
|
+
return tls_certificate_provider_instance.Empty() &&
|
472
|
+
certificate_validation_context.Empty();
|
507
473
|
}
|
508
474
|
|
509
475
|
//
|
@@ -847,15 +813,15 @@ bool IsLds(absl::string_view type_url, bool* is_v2 = nullptr) {
|
|
847
813
|
return false;
|
848
814
|
}
|
849
815
|
|
850
|
-
bool IsRds(absl::string_view type_url) {
|
816
|
+
bool IsRds(absl::string_view type_url, bool* /*is_v2*/ = nullptr) {
|
851
817
|
return type_url == XdsApi::kRdsTypeUrl || type_url == kRdsV2TypeUrl;
|
852
818
|
}
|
853
819
|
|
854
|
-
bool IsCds(absl::string_view type_url) {
|
820
|
+
bool IsCds(absl::string_view type_url, bool* /*is_v2*/ = nullptr) {
|
855
821
|
return type_url == XdsApi::kCdsTypeUrl || type_url == kCdsV2TypeUrl;
|
856
822
|
}
|
857
823
|
|
858
|
-
bool IsEds(absl::string_view type_url) {
|
824
|
+
bool IsEds(absl::string_view type_url, bool* /*is_v2*/ = nullptr) {
|
859
825
|
return type_url == XdsApi::kEdsTypeUrl || type_url == kEdsV2TypeUrl;
|
860
826
|
}
|
861
827
|
|
@@ -1207,6 +1173,18 @@ void MaybeLogDiscoveryResponse(
|
|
1207
1173
|
}
|
1208
1174
|
}
|
1209
1175
|
|
1176
|
+
void MaybeLogListener(const EncodingContext& context,
|
1177
|
+
const envoy_config_listener_v3_Listener* listener) {
|
1178
|
+
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer) &&
|
1179
|
+
gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
|
1180
|
+
const upb_msgdef* msg_type =
|
1181
|
+
envoy_config_listener_v3_Listener_getmsgdef(context.symtab);
|
1182
|
+
char buf[10240];
|
1183
|
+
upb_text_encode(listener, msg_type, nullptr, 0, buf, sizeof(buf));
|
1184
|
+
gpr_log(GPR_DEBUG, "[xds_client %p] Listener: %s", context.client, buf);
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
|
1210
1188
|
void MaybeLogHttpConnectionManager(
|
1211
1189
|
const EncodingContext& context,
|
1212
1190
|
const envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager*
|
@@ -1350,10 +1328,8 @@ grpc_error_handle RoutePathMatchParse(
|
|
1350
1328
|
absl::StatusOr<StringMatcher> string_matcher =
|
1351
1329
|
StringMatcher::Create(type, match_string, case_sensitive);
|
1352
1330
|
if (!string_matcher.ok()) {
|
1353
|
-
return
|
1354
|
-
absl::StrCat("path matcher: ", string_matcher.status().message())
|
1355
|
-
.c_str());
|
1356
|
-
;
|
1331
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1332
|
+
absl::StrCat("path matcher: ", string_matcher.status().message()));
|
1357
1333
|
}
|
1358
1334
|
route->matchers.path_matcher = std::move(string_matcher.value());
|
1359
1335
|
return GRPC_ERROR_NONE;
|
@@ -1416,9 +1392,8 @@ grpc_error_handle RouteHeaderMatchersParse(
|
|
1416
1392
|
HeaderMatcher::Create(name, type, match_string, range_start, range_end,
|
1417
1393
|
present_match, invert_match);
|
1418
1394
|
if (!header_matcher.ok()) {
|
1419
|
-
return
|
1420
|
-
absl::StrCat("header matcher: ", header_matcher.status().message())
|
1421
|
-
.c_str());
|
1395
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1396
|
+
absl::StrCat("header matcher: ", header_matcher.status().message()));
|
1422
1397
|
}
|
1423
1398
|
route->matchers.header_matchers.emplace_back(
|
1424
1399
|
std::move(header_matcher.value()));
|
@@ -1498,9 +1473,8 @@ grpc_error_handle ParseTypedPerFilterConfig(
|
|
1498
1473
|
absl::string_view filter_type =
|
1499
1474
|
UpbStringToAbsl(google_protobuf_Any_type_url(any));
|
1500
1475
|
if (filter_type.empty()) {
|
1501
|
-
return
|
1502
|
-
absl::StrCat("no filter config specified for filter name ", key)
|
1503
|
-
.c_str());
|
1476
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1477
|
+
absl::StrCat("no filter config specified for filter name ", key));
|
1504
1478
|
}
|
1505
1479
|
bool is_optional = false;
|
1506
1480
|
if (filter_type ==
|
@@ -1509,18 +1483,16 @@ grpc_error_handle ParseTypedPerFilterConfig(
|
|
1509
1483
|
const auto* filter_config = envoy_config_route_v3_FilterConfig_parse(
|
1510
1484
|
any_value.data, any_value.size, context.arena);
|
1511
1485
|
if (filter_config == nullptr) {
|
1512
|
-
return
|
1513
|
-
absl::StrCat("could not parse FilterConfig wrapper for ", key)
|
1514
|
-
.c_str());
|
1486
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1487
|
+
absl::StrCat("could not parse FilterConfig wrapper for ", key));
|
1515
1488
|
}
|
1516
1489
|
is_optional =
|
1517
1490
|
envoy_config_route_v3_FilterConfig_is_optional(filter_config);
|
1518
1491
|
any = envoy_config_route_v3_FilterConfig_config(filter_config);
|
1519
1492
|
if (any == nullptr) {
|
1520
1493
|
if (is_optional) continue;
|
1521
|
-
return
|
1522
|
-
absl::StrCat("no filter config specified for filter name ", key)
|
1523
|
-
.c_str());
|
1494
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1495
|
+
absl::StrCat("no filter config specified for filter name ", key));
|
1524
1496
|
}
|
1525
1497
|
}
|
1526
1498
|
grpc_error_handle error =
|
@@ -1530,18 +1502,16 @@ grpc_error_handle ParseTypedPerFilterConfig(
|
|
1530
1502
|
XdsHttpFilterRegistry::GetFilterForType(filter_type);
|
1531
1503
|
if (filter_impl == nullptr) {
|
1532
1504
|
if (is_optional) continue;
|
1533
|
-
return
|
1534
|
-
absl::StrCat("no filter registered for config type ", filter_type)
|
1535
|
-
.c_str());
|
1505
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1506
|
+
absl::StrCat("no filter registered for config type ", filter_type));
|
1536
1507
|
}
|
1537
1508
|
absl::StatusOr<XdsHttpFilterImpl::FilterConfig> filter_config =
|
1538
1509
|
filter_impl->GenerateFilterConfigOverride(
|
1539
1510
|
google_protobuf_Any_value(any), context.arena);
|
1540
1511
|
if (!filter_config.ok()) {
|
1541
|
-
return
|
1542
|
-
|
1543
|
-
|
1544
|
-
.c_str());
|
1512
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrCat(
|
1513
|
+
"filter config for type ", filter_type,
|
1514
|
+
" failed to parse: ", filter_config.status().ToString()));
|
1545
1515
|
}
|
1546
1516
|
(*typed_per_filter_config)[std::string(key)] = std::move(*filter_config);
|
1547
1517
|
}
|
@@ -1591,7 +1561,7 @@ grpc_error_handle RetryPolicyParse(
|
|
1591
1561
|
if (num_retries != nullptr) {
|
1592
1562
|
uint32_t num_retries_value = google_protobuf_UInt32Value_value(num_retries);
|
1593
1563
|
if (num_retries_value == 0) {
|
1594
|
-
errors.push_back(
|
1564
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1595
1565
|
"RouteAction RetryPolicy num_retries set to invalid value 0."));
|
1596
1566
|
} else {
|
1597
1567
|
retry_to_return.num_retries = num_retries_value;
|
@@ -1605,7 +1575,7 @@ grpc_error_handle RetryPolicyParse(
|
|
1605
1575
|
const google_protobuf_Duration* base_interval =
|
1606
1576
|
envoy_config_route_v3_RetryPolicy_RetryBackOff_base_interval(backoff);
|
1607
1577
|
if (base_interval == nullptr) {
|
1608
|
-
errors.push_back(
|
1578
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1609
1579
|
"RouteAction RetryPolicy RetryBackoff missing base interval."));
|
1610
1580
|
} else {
|
1611
1581
|
retry_to_return.retry_back_off.base_interval =
|
@@ -1828,7 +1798,7 @@ grpc_error_handle RouteActionParse(const EncodingContext& context,
|
|
1828
1798
|
grpc_error_handle RouteConfigParse(
|
1829
1799
|
const EncodingContext& context,
|
1830
1800
|
const envoy_config_route_v3_RouteConfiguration* route_config,
|
1831
|
-
XdsApi::RdsUpdate* rds_update) {
|
1801
|
+
bool /*is_v2*/, XdsApi::RdsUpdate* rds_update) {
|
1832
1802
|
MaybeLogRouteConfiguration(context, route_config);
|
1833
1803
|
// Get the virtual hosts.
|
1834
1804
|
size_t num_virtual_hosts;
|
@@ -1846,9 +1816,8 @@ grpc_error_handle RouteConfigParse(
|
|
1846
1816
|
std::string domain_pattern = UpbStringToStdString(domains[j]);
|
1847
1817
|
const MatchType match_type = DomainPatternMatchType(domain_pattern);
|
1848
1818
|
if (match_type == INVALID_MATCH) {
|
1849
|
-
return
|
1850
|
-
absl::StrCat("Invalid domain pattern \"", domain_pattern, "\".")
|
1851
|
-
.c_str());
|
1819
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1820
|
+
absl::StrCat("Invalid domain pattern \"", domain_pattern, "\"."));
|
1852
1821
|
}
|
1853
1822
|
vhost.domains.emplace_back(std::move(domain_pattern));
|
1854
1823
|
}
|
@@ -1933,13 +1902,18 @@ grpc_error_handle RouteConfigParse(
|
|
1933
1902
|
return GRPC_ERROR_NONE;
|
1934
1903
|
}
|
1935
1904
|
|
1905
|
+
// CertificateProviderInstance is deprecated but we are still supporting it for
|
1906
|
+
// backward compatibility reasons. Note that we still parse the data into the
|
1907
|
+
// same CertificateProviderPluginInstance struct since the fields are the same.
|
1908
|
+
// TODO(yashykt): Remove this once we stop supporting the old way of fetching
|
1909
|
+
// certificate provider instances.
|
1936
1910
|
grpc_error_handle CertificateProviderInstanceParse(
|
1937
1911
|
const EncodingContext& context,
|
1938
1912
|
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance*
|
1939
1913
|
certificate_provider_instance_proto,
|
1940
|
-
XdsApi::CommonTlsContext::
|
1941
|
-
|
1942
|
-
*
|
1914
|
+
XdsApi::CommonTlsContext::CertificateProviderPluginInstance*
|
1915
|
+
certificate_provider_plugin_instance) {
|
1916
|
+
*certificate_provider_plugin_instance = {
|
1943
1917
|
UpbStringToStdString(
|
1944
1918
|
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_instance_name(
|
1945
1919
|
certificate_provider_instance_proto)),
|
@@ -1947,21 +1921,157 @@ grpc_error_handle CertificateProviderInstanceParse(
|
|
1947
1921
|
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_certificate_name(
|
1948
1922
|
certificate_provider_instance_proto))};
|
1949
1923
|
if (context.certificate_provider_definition_map->find(
|
1950
|
-
|
1924
|
+
certificate_provider_plugin_instance->instance_name) ==
|
1951
1925
|
context.certificate_provider_definition_map->end()) {
|
1952
|
-
return
|
1926
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1953
1927
|
absl::StrCat("Unrecognized certificate provider instance name: ",
|
1954
|
-
|
1955
|
-
.c_str());
|
1928
|
+
certificate_provider_plugin_instance->instance_name));
|
1956
1929
|
}
|
1957
1930
|
return GRPC_ERROR_NONE;
|
1958
1931
|
}
|
1959
1932
|
|
1933
|
+
grpc_error_handle CertificateProviderPluginInstanceParse(
|
1934
|
+
const EncodingContext& context,
|
1935
|
+
const envoy_extensions_transport_sockets_tls_v3_CertificateProviderPluginInstance*
|
1936
|
+
certificate_provider_plugin_instance_proto,
|
1937
|
+
XdsApi::CommonTlsContext::CertificateProviderPluginInstance*
|
1938
|
+
certificate_provider_plugin_instance) {
|
1939
|
+
*certificate_provider_plugin_instance = {
|
1940
|
+
UpbStringToStdString(
|
1941
|
+
envoy_extensions_transport_sockets_tls_v3_CertificateProviderPluginInstance_instance_name(
|
1942
|
+
certificate_provider_plugin_instance_proto)),
|
1943
|
+
UpbStringToStdString(
|
1944
|
+
envoy_extensions_transport_sockets_tls_v3_CertificateProviderPluginInstance_certificate_name(
|
1945
|
+
certificate_provider_plugin_instance_proto))};
|
1946
|
+
if (context.certificate_provider_definition_map->find(
|
1947
|
+
certificate_provider_plugin_instance->instance_name) ==
|
1948
|
+
context.certificate_provider_definition_map->end()) {
|
1949
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
1950
|
+
absl::StrCat("Unrecognized certificate provider instance name: ",
|
1951
|
+
certificate_provider_plugin_instance->instance_name));
|
1952
|
+
}
|
1953
|
+
return GRPC_ERROR_NONE;
|
1954
|
+
}
|
1955
|
+
|
1956
|
+
grpc_error_handle CertificateValidationContextParse(
|
1957
|
+
const EncodingContext& context,
|
1958
|
+
const envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext*
|
1959
|
+
certificate_validation_context_proto,
|
1960
|
+
XdsApi::CommonTlsContext::CertificateValidationContext*
|
1961
|
+
certificate_validation_context) {
|
1962
|
+
std::vector<grpc_error_handle> errors;
|
1963
|
+
size_t len = 0;
|
1964
|
+
auto* subject_alt_names_matchers =
|
1965
|
+
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_match_subject_alt_names(
|
1966
|
+
certificate_validation_context_proto, &len);
|
1967
|
+
for (size_t i = 0; i < len; ++i) {
|
1968
|
+
StringMatcher::Type type;
|
1969
|
+
std::string matcher;
|
1970
|
+
if (envoy_type_matcher_v3_StringMatcher_has_exact(
|
1971
|
+
subject_alt_names_matchers[i])) {
|
1972
|
+
type = StringMatcher::Type::kExact;
|
1973
|
+
matcher = UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_exact(
|
1974
|
+
subject_alt_names_matchers[i]));
|
1975
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_prefix(
|
1976
|
+
subject_alt_names_matchers[i])) {
|
1977
|
+
type = StringMatcher::Type::kPrefix;
|
1978
|
+
matcher = UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_prefix(
|
1979
|
+
subject_alt_names_matchers[i]));
|
1980
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_suffix(
|
1981
|
+
subject_alt_names_matchers[i])) {
|
1982
|
+
type = StringMatcher::Type::kSuffix;
|
1983
|
+
matcher = UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_suffix(
|
1984
|
+
subject_alt_names_matchers[i]));
|
1985
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_contains(
|
1986
|
+
subject_alt_names_matchers[i])) {
|
1987
|
+
type = StringMatcher::Type::kContains;
|
1988
|
+
matcher =
|
1989
|
+
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_contains(
|
1990
|
+
subject_alt_names_matchers[i]));
|
1991
|
+
} else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(
|
1992
|
+
subject_alt_names_matchers[i])) {
|
1993
|
+
type = StringMatcher::Type::kSafeRegex;
|
1994
|
+
auto* regex_matcher = envoy_type_matcher_v3_StringMatcher_safe_regex(
|
1995
|
+
subject_alt_names_matchers[i]);
|
1996
|
+
matcher = UpbStringToStdString(
|
1997
|
+
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
1998
|
+
} else {
|
1999
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2000
|
+
"Invalid StringMatcher specified"));
|
2001
|
+
continue;
|
2002
|
+
}
|
2003
|
+
bool ignore_case = envoy_type_matcher_v3_StringMatcher_ignore_case(
|
2004
|
+
subject_alt_names_matchers[i]);
|
2005
|
+
absl::StatusOr<StringMatcher> string_matcher =
|
2006
|
+
StringMatcher::Create(type, matcher,
|
2007
|
+
/*case_sensitive=*/!ignore_case);
|
2008
|
+
if (!string_matcher.ok()) {
|
2009
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2010
|
+
absl::StrCat("string matcher: ", string_matcher.status().message())));
|
2011
|
+
continue;
|
2012
|
+
}
|
2013
|
+
if (type == StringMatcher::Type::kSafeRegex && ignore_case) {
|
2014
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2015
|
+
"StringMatcher: ignore_case has no effect for SAFE_REGEX."));
|
2016
|
+
continue;
|
2017
|
+
}
|
2018
|
+
certificate_validation_context->match_subject_alt_names.push_back(
|
2019
|
+
std::move(string_matcher.value()));
|
2020
|
+
}
|
2021
|
+
auto* ca_certificate_provider_instance =
|
2022
|
+
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_ca_certificate_provider_instance(
|
2023
|
+
certificate_validation_context_proto);
|
2024
|
+
if (ca_certificate_provider_instance != nullptr) {
|
2025
|
+
grpc_error_handle error = CertificateProviderPluginInstanceParse(
|
2026
|
+
context, ca_certificate_provider_instance,
|
2027
|
+
&certificate_validation_context->ca_certificate_provider_instance);
|
2028
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2029
|
+
}
|
2030
|
+
if (envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_verify_certificate_spki(
|
2031
|
+
certificate_validation_context_proto, nullptr) != nullptr) {
|
2032
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2033
|
+
"CertificateValidationContext: verify_certificate_spki "
|
2034
|
+
"unsupported"));
|
2035
|
+
}
|
2036
|
+
if (envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_verify_certificate_hash(
|
2037
|
+
certificate_validation_context_proto, nullptr) != nullptr) {
|
2038
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2039
|
+
"CertificateValidationContext: verify_certificate_hash "
|
2040
|
+
"unsupported"));
|
2041
|
+
}
|
2042
|
+
auto* require_signed_certificate_timestamp =
|
2043
|
+
envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_require_signed_certificate_timestamp(
|
2044
|
+
certificate_validation_context_proto);
|
2045
|
+
if (require_signed_certificate_timestamp != nullptr &&
|
2046
|
+
google_protobuf_BoolValue_value(require_signed_certificate_timestamp)) {
|
2047
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2048
|
+
"CertificateValidationContext: "
|
2049
|
+
"require_signed_certificate_timestamp unsupported"));
|
2050
|
+
}
|
2051
|
+
if (envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_has_crl(
|
2052
|
+
certificate_validation_context_proto)) {
|
2053
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2054
|
+
"CertificateValidationContext: crl unsupported"));
|
2055
|
+
}
|
2056
|
+
if (envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_has_custom_validator_config(
|
2057
|
+
certificate_validation_context_proto)) {
|
2058
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2059
|
+
"CertificateValidationContext: custom_validator_config "
|
2060
|
+
"unsupported"));
|
2061
|
+
}
|
2062
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR(
|
2063
|
+
"Error parsing CertificateValidationContext", &errors);
|
2064
|
+
}
|
2065
|
+
|
1960
2066
|
grpc_error_handle CommonTlsContextParse(
|
1961
2067
|
const EncodingContext& context,
|
1962
2068
|
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext*
|
1963
2069
|
common_tls_context_proto,
|
1964
2070
|
XdsApi::CommonTlsContext* common_tls_context) {
|
2071
|
+
std::vector<grpc_error_handle> errors;
|
2072
|
+
// The validation context is derived from the oneof in
|
2073
|
+
// 'validation_context_type'. 'validation_context_sds_secret_config' is not
|
2074
|
+
// supported.
|
1965
2075
|
auto* combined_validation_context =
|
1966
2076
|
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_combined_validation_context(
|
1967
2077
|
common_tls_context_proto);
|
@@ -1970,89 +2080,92 @@ grpc_error_handle CommonTlsContextParse(
|
|
1970
2080
|
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CombinedCertificateValidationContext_default_validation_context(
|
1971
2081
|
combined_validation_context);
|
1972
2082
|
if (default_validation_context != nullptr) {
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
subject_alt_names_matchers[i]));
|
1986
|
-
} else if (envoy_type_matcher_v3_StringMatcher_has_prefix(
|
1987
|
-
subject_alt_names_matchers[i])) {
|
1988
|
-
type = StringMatcher::Type::kPrefix;
|
1989
|
-
matcher =
|
1990
|
-
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_prefix(
|
1991
|
-
subject_alt_names_matchers[i]));
|
1992
|
-
} else if (envoy_type_matcher_v3_StringMatcher_has_suffix(
|
1993
|
-
subject_alt_names_matchers[i])) {
|
1994
|
-
type = StringMatcher::Type::kSuffix;
|
1995
|
-
matcher =
|
1996
|
-
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_suffix(
|
1997
|
-
subject_alt_names_matchers[i]));
|
1998
|
-
} else if (envoy_type_matcher_v3_StringMatcher_has_contains(
|
1999
|
-
subject_alt_names_matchers[i])) {
|
2000
|
-
type = StringMatcher::Type::kContains;
|
2001
|
-
matcher =
|
2002
|
-
UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_contains(
|
2003
|
-
subject_alt_names_matchers[i]));
|
2004
|
-
} else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(
|
2005
|
-
subject_alt_names_matchers[i])) {
|
2006
|
-
type = StringMatcher::Type::kSafeRegex;
|
2007
|
-
auto* regex_matcher = envoy_type_matcher_v3_StringMatcher_safe_regex(
|
2008
|
-
subject_alt_names_matchers[i]);
|
2009
|
-
matcher = UpbStringToStdString(
|
2010
|
-
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
2011
|
-
} else {
|
2012
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2013
|
-
"Invalid StringMatcher specified");
|
2014
|
-
}
|
2015
|
-
bool ignore_case = envoy_type_matcher_v3_StringMatcher_ignore_case(
|
2016
|
-
subject_alt_names_matchers[i]);
|
2017
|
-
absl::StatusOr<StringMatcher> string_matcher =
|
2018
|
-
StringMatcher::Create(type, matcher,
|
2019
|
-
/*case_sensitive=*/!ignore_case);
|
2020
|
-
if (!string_matcher.ok()) {
|
2021
|
-
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2022
|
-
absl::StrCat("string matcher: ",
|
2023
|
-
string_matcher.status().message())
|
2024
|
-
.c_str());
|
2025
|
-
}
|
2026
|
-
if (type == StringMatcher::Type::kSafeRegex && ignore_case) {
|
2027
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2028
|
-
"StringMatcher: ignore_case has no effect for SAFE_REGEX.");
|
2029
|
-
}
|
2030
|
-
common_tls_context->combined_validation_context
|
2031
|
-
.default_validation_context.match_subject_alt_names.push_back(
|
2032
|
-
std::move(string_matcher.value()));
|
2033
|
-
}
|
2034
|
-
}
|
2083
|
+
grpc_error_handle error = CertificateValidationContextParse(
|
2084
|
+
context, default_validation_context,
|
2085
|
+
&common_tls_context->certificate_validation_context);
|
2086
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2087
|
+
}
|
2088
|
+
// If after parsing default_validation_context,
|
2089
|
+
// common_tls_context->certificate_validation_context.ca_certificate_provider_instance
|
2090
|
+
// is empty, fall back onto
|
2091
|
+
// 'validation_context_certificate_provider_instance' inside
|
2092
|
+
// 'combined_validation_context'. Note that this way of fetching root
|
2093
|
+
// certificates is deprecated and will be removed in the future.
|
2094
|
+
// TODO(yashykt): Remove this once it's no longer needed.
|
2035
2095
|
auto* validation_context_certificate_provider_instance =
|
2036
2096
|
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CombinedCertificateValidationContext_validation_context_certificate_provider_instance(
|
2037
2097
|
combined_validation_context);
|
2038
|
-
if (
|
2098
|
+
if (common_tls_context->certificate_validation_context
|
2099
|
+
.ca_certificate_provider_instance.Empty() &&
|
2100
|
+
validation_context_certificate_provider_instance != nullptr) {
|
2039
2101
|
grpc_error_handle error = CertificateProviderInstanceParse(
|
2040
2102
|
context, validation_context_certificate_provider_instance,
|
2041
|
-
&common_tls_context->
|
2042
|
-
.
|
2043
|
-
if (error != GRPC_ERROR_NONE)
|
2103
|
+
&common_tls_context->certificate_validation_context
|
2104
|
+
.ca_certificate_provider_instance);
|
2105
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2044
2106
|
}
|
2045
|
-
}
|
2046
|
-
|
2047
|
-
|
2107
|
+
} else {
|
2108
|
+
auto* validation_context =
|
2109
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_validation_context(
|
2110
|
+
common_tls_context_proto);
|
2111
|
+
if (validation_context != nullptr) {
|
2112
|
+
grpc_error_handle error = CertificateValidationContextParse(
|
2113
|
+
context, validation_context,
|
2114
|
+
&common_tls_context->certificate_validation_context);
|
2115
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2116
|
+
} else if (
|
2117
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_validation_context_sds_secret_config(
|
2118
|
+
common_tls_context_proto)) {
|
2119
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2120
|
+
"validation_context_sds_secret_config unsupported"));
|
2121
|
+
}
|
2122
|
+
}
|
2123
|
+
auto* tls_certificate_provider_instance =
|
2124
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_provider_instance(
|
2048
2125
|
common_tls_context_proto);
|
2049
|
-
if (
|
2050
|
-
grpc_error_handle error =
|
2051
|
-
context,
|
2052
|
-
&common_tls_context->
|
2053
|
-
if (error != GRPC_ERROR_NONE)
|
2126
|
+
if (tls_certificate_provider_instance != nullptr) {
|
2127
|
+
grpc_error_handle error = CertificateProviderPluginInstanceParse(
|
2128
|
+
context, tls_certificate_provider_instance,
|
2129
|
+
&common_tls_context->tls_certificate_provider_instance);
|
2130
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2131
|
+
} else {
|
2132
|
+
// Fall back onto 'tls_certificate_certificate_provider_instance'. Note that
|
2133
|
+
// this way of fetching identity certificates is deprecated and will be
|
2134
|
+
// removed in the future.
|
2135
|
+
// TODO(yashykt): Remove this once it's no longer needed.
|
2136
|
+
auto* tls_certificate_certificate_provider_instance =
|
2137
|
+
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_certificate_provider_instance(
|
2138
|
+
common_tls_context_proto);
|
2139
|
+
if (tls_certificate_certificate_provider_instance != nullptr) {
|
2140
|
+
grpc_error_handle error = CertificateProviderInstanceParse(
|
2141
|
+
context, tls_certificate_certificate_provider_instance,
|
2142
|
+
&common_tls_context->tls_certificate_provider_instance);
|
2143
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2144
|
+
} else {
|
2145
|
+
if (envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_tls_certificates(
|
2146
|
+
common_tls_context_proto)) {
|
2147
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2148
|
+
"tls_certificates unsupported"));
|
2149
|
+
}
|
2150
|
+
if (envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_tls_certificate_sds_secret_configs(
|
2151
|
+
common_tls_context_proto)) {
|
2152
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2153
|
+
"tls_certificate_sds_secret_configs unsupported"));
|
2154
|
+
}
|
2155
|
+
}
|
2054
2156
|
}
|
2055
|
-
|
2157
|
+
if (envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_tls_params(
|
2158
|
+
common_tls_context_proto)) {
|
2159
|
+
errors.push_back(
|
2160
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("tls_params unsupported"));
|
2161
|
+
}
|
2162
|
+
if (envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_custom_handshaker(
|
2163
|
+
common_tls_context_proto)) {
|
2164
|
+
errors.push_back(
|
2165
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("custom_handshaker unsupported"));
|
2166
|
+
}
|
2167
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("Error parsing CommonTlsContext",
|
2168
|
+
&errors);
|
2056
2169
|
}
|
2057
2170
|
|
2058
2171
|
grpc_error_handle HttpConnectionManagerParse(
|
@@ -2087,12 +2200,12 @@ grpc_error_handle HttpConnectionManagerParse(
|
|
2087
2200
|
envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter_name(
|
2088
2201
|
http_filter));
|
2089
2202
|
if (name.empty()) {
|
2090
|
-
return
|
2091
|
-
absl::StrCat("empty filter name at index ", i)
|
2203
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2204
|
+
absl::StrCat("empty filter name at index ", i));
|
2092
2205
|
}
|
2093
2206
|
if (names_seen.find(name) != names_seen.end()) {
|
2094
|
-
return
|
2095
|
-
absl::StrCat("duplicate HTTP filter name: ", name)
|
2207
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2208
|
+
absl::StrCat("duplicate HTTP filter name: ", name));
|
2096
2209
|
}
|
2097
2210
|
names_seen.insert(name);
|
2098
2211
|
const bool is_optional =
|
@@ -2103,9 +2216,8 @@ grpc_error_handle HttpConnectionManagerParse(
|
|
2103
2216
|
http_filter);
|
2104
2217
|
if (any == nullptr) {
|
2105
2218
|
if (is_optional) continue;
|
2106
|
-
return
|
2107
|
-
absl::StrCat("no filter config specified for filter name ", name)
|
2108
|
-
.c_str());
|
2219
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2220
|
+
absl::StrCat("no filter config specified for filter name ", name));
|
2109
2221
|
}
|
2110
2222
|
absl::string_view filter_type;
|
2111
2223
|
grpc_error_handle error =
|
@@ -2115,44 +2227,38 @@ grpc_error_handle HttpConnectionManagerParse(
|
|
2115
2227
|
XdsHttpFilterRegistry::GetFilterForType(filter_type);
|
2116
2228
|
if (filter_impl == nullptr) {
|
2117
2229
|
if (is_optional) continue;
|
2118
|
-
return
|
2119
|
-
absl::StrCat("no filter registered for config type ", filter_type)
|
2120
|
-
.c_str());
|
2230
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2231
|
+
absl::StrCat("no filter registered for config type ", filter_type));
|
2121
2232
|
}
|
2122
2233
|
if ((is_client && !filter_impl->IsSupportedOnClients()) ||
|
2123
2234
|
(!is_client && !filter_impl->IsSupportedOnServers())) {
|
2124
2235
|
if (is_optional) continue;
|
2125
|
-
return
|
2236
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2126
2237
|
absl::StrFormat("Filter %s is not supported on %s", filter_type,
|
2127
|
-
is_client ? "clients" : "servers")
|
2128
|
-
.c_str());
|
2238
|
+
is_client ? "clients" : "servers"));
|
2129
2239
|
}
|
2130
2240
|
if (i < num_filters - 1) {
|
2131
2241
|
// Filters before the last filter must not be terminal.
|
2132
2242
|
if (filter_impl->IsTerminalFilter()) {
|
2133
|
-
return
|
2243
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2134
2244
|
absl::StrCat("terminal filter for config type ", filter_type,
|
2135
|
-
" must be the last filter in the chain")
|
2136
|
-
.c_str());
|
2245
|
+
" must be the last filter in the chain"));
|
2137
2246
|
}
|
2138
2247
|
} else {
|
2139
2248
|
// The last filter must be terminal.
|
2140
2249
|
if (!filter_impl->IsTerminalFilter()) {
|
2141
|
-
return
|
2250
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2142
2251
|
absl::StrCat("non-terminal filter for config type ", filter_type,
|
2143
|
-
" is the last filter in the chain")
|
2144
|
-
.c_str());
|
2252
|
+
" is the last filter in the chain"));
|
2145
2253
|
}
|
2146
2254
|
}
|
2147
2255
|
absl::StatusOr<XdsHttpFilterImpl::FilterConfig> filter_config =
|
2148
2256
|
filter_impl->GenerateFilterConfig(google_protobuf_Any_value(any),
|
2149
2257
|
context.arena);
|
2150
2258
|
if (!filter_config.ok()) {
|
2151
|
-
return
|
2152
|
-
|
2153
|
-
|
2154
|
-
" failed to parse: ", filter_config.status().ToString())
|
2155
|
-
.c_str());
|
2259
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrCat(
|
2260
|
+
"filter config for type ", filter_type,
|
2261
|
+
" failed to parse: ", filter_config.status().ToString()));
|
2156
2262
|
}
|
2157
2263
|
http_connection_manager->http_filters.emplace_back(
|
2158
2264
|
XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter{
|
@@ -2176,7 +2282,7 @@ grpc_error_handle HttpConnectionManagerParse(
|
|
2176
2282
|
http_connection_manager_proto);
|
2177
2283
|
XdsApi::RdsUpdate rds_update;
|
2178
2284
|
grpc_error_handle error =
|
2179
|
-
RouteConfigParse(context, route_config, &rds_update);
|
2285
|
+
RouteConfigParse(context, route_config, is_v2, &rds_update);
|
2180
2286
|
if (error != GRPC_ERROR_NONE) return error;
|
2181
2287
|
http_connection_manager->rds_update = std::move(rds_update);
|
2182
2288
|
return GRPC_ERROR_NONE;
|
@@ -2209,7 +2315,7 @@ grpc_error_handle HttpConnectionManagerParse(
|
|
2209
2315
|
return GRPC_ERROR_NONE;
|
2210
2316
|
}
|
2211
2317
|
|
2212
|
-
grpc_error_handle
|
2318
|
+
grpc_error_handle LdsResourceParseClient(
|
2213
2319
|
const EncodingContext& context,
|
2214
2320
|
const envoy_config_listener_v3_ApiListener* api_listener, bool is_v2,
|
2215
2321
|
XdsApi::LdsUpdate* lds_update) {
|
@@ -2235,11 +2341,12 @@ grpc_error_handle DownstreamTlsContextParse(
|
|
2235
2341
|
absl::string_view name = UpbStringToAbsl(
|
2236
2342
|
envoy_config_core_v3_TransportSocket_name(transport_socket));
|
2237
2343
|
if (name != "envoy.transport_sockets.tls") {
|
2238
|
-
return
|
2239
|
-
absl::StrCat("Unrecognized transport socket: ", name)
|
2344
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2345
|
+
absl::StrCat("Unrecognized transport socket: ", name));
|
2240
2346
|
}
|
2241
2347
|
auto* typed_config =
|
2242
2348
|
envoy_config_core_v3_TransportSocket_typed_config(transport_socket);
|
2349
|
+
std::vector<grpc_error_handle> errors;
|
2243
2350
|
if (typed_config != nullptr) {
|
2244
2351
|
const upb_strview encoded_downstream_tls_context =
|
2245
2352
|
google_protobuf_Any_value(typed_config);
|
@@ -2258,7 +2365,7 @@ grpc_error_handle DownstreamTlsContextParse(
|
|
2258
2365
|
grpc_error_handle error =
|
2259
2366
|
CommonTlsContextParse(context, common_tls_context,
|
2260
2367
|
&downstream_tls_context->common_tls_context);
|
2261
|
-
if (error != GRPC_ERROR_NONE)
|
2368
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2262
2369
|
}
|
2263
2370
|
auto* require_client_certificate =
|
2264
2371
|
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_require_client_certificate(
|
@@ -2267,23 +2374,41 @@ grpc_error_handle DownstreamTlsContextParse(
|
|
2267
2374
|
downstream_tls_context->require_client_certificate =
|
2268
2375
|
google_protobuf_BoolValue_value(require_client_certificate);
|
2269
2376
|
}
|
2377
|
+
auto* require_sni =
|
2378
|
+
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_require_sni(
|
2379
|
+
downstream_tls_context_proto);
|
2380
|
+
if (require_sni != nullptr &&
|
2381
|
+
google_protobuf_BoolValue_value(require_sni)) {
|
2382
|
+
errors.push_back(
|
2383
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("require_sni: unsupported"));
|
2384
|
+
}
|
2385
|
+
if (envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_ocsp_staple_policy(
|
2386
|
+
downstream_tls_context_proto) !=
|
2387
|
+
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_LENIENT_STAPLING) {
|
2388
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2389
|
+
"ocsp_staple_policy: Only LENIENT_STAPLING supported"));
|
2390
|
+
}
|
2270
2391
|
}
|
2271
2392
|
if (downstream_tls_context->common_tls_context
|
2272
|
-
.
|
2273
|
-
|
2274
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2393
|
+
.tls_certificate_provider_instance.instance_name.empty()) {
|
2394
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2275
2395
|
"TLS configuration provided but no "
|
2276
|
-
"
|
2396
|
+
"tls_certificate_provider_instance found."));
|
2277
2397
|
}
|
2278
2398
|
if (downstream_tls_context->require_client_certificate &&
|
2279
|
-
downstream_tls_context->common_tls_context.
|
2280
|
-
.
|
2281
|
-
|
2282
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2399
|
+
downstream_tls_context->common_tls_context.certificate_validation_context
|
2400
|
+
.ca_certificate_provider_instance.instance_name.empty()) {
|
2401
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2283
2402
|
"TLS configuration requires client certificates but no certificate "
|
2284
|
-
"provider instance specified for validation.");
|
2403
|
+
"provider instance specified for validation."));
|
2285
2404
|
}
|
2286
|
-
|
2405
|
+
if (!downstream_tls_context->common_tls_context.certificate_validation_context
|
2406
|
+
.match_subject_alt_names.empty()) {
|
2407
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2408
|
+
"match_subject_alt_names not supported on servers"));
|
2409
|
+
}
|
2410
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("Error parsing DownstreamTlsContext",
|
2411
|
+
&errors);
|
2287
2412
|
}
|
2288
2413
|
|
2289
2414
|
grpc_error_handle CidrRangeParse(
|
@@ -2374,67 +2499,69 @@ grpc_error_handle FilterChainParse(
|
|
2374
2499
|
const EncodingContext& context,
|
2375
2500
|
const envoy_config_listener_v3_FilterChain* filter_chain_proto, bool is_v2,
|
2376
2501
|
FilterChain* filter_chain) {
|
2377
|
-
grpc_error_handle
|
2502
|
+
std::vector<grpc_error_handle> errors;
|
2378
2503
|
auto* filter_chain_match =
|
2379
2504
|
envoy_config_listener_v3_FilterChain_filter_chain_match(
|
2380
2505
|
filter_chain_proto);
|
2381
2506
|
if (filter_chain_match != nullptr) {
|
2382
|
-
error = FilterChainMatchParse(
|
2383
|
-
|
2384
|
-
if (error != GRPC_ERROR_NONE)
|
2507
|
+
grpc_error_handle error = FilterChainMatchParse(
|
2508
|
+
filter_chain_match, &filter_chain->filter_chain_match);
|
2509
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2385
2510
|
}
|
2386
2511
|
// Parse the filters list. Currently we only support HttpConnectionManager.
|
2387
2512
|
size_t size = 0;
|
2388
2513
|
auto* filters =
|
2389
2514
|
envoy_config_listener_v3_FilterChain_filters(filter_chain_proto, &size);
|
2390
2515
|
if (size != 1) {
|
2391
|
-
|
2516
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2392
2517
|
"FilterChain should have exactly one filter: HttpConnectionManager; no "
|
2393
|
-
"other filter is supported at the moment");
|
2394
|
-
}
|
2395
|
-
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2402
|
-
|
2403
|
-
|
2404
|
-
|
2405
|
-
|
2406
|
-
|
2407
|
-
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2417
|
-
|
2418
|
-
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
envoy_config_listener_v3_FilterChain_transport_socket(
|
2430
|
-
filter_chain_proto);
|
2431
|
-
if (transport_socket != nullptr) {
|
2432
|
-
error = DownstreamTlsContextParse(
|
2433
|
-
context, transport_socket,
|
2434
|
-
&filter_chain->filter_chain_data->downstream_tls_context);
|
2518
|
+
"other filter is supported at the moment"));
|
2519
|
+
} else {
|
2520
|
+
auto* typed_config =
|
2521
|
+
envoy_config_listener_v3_Filter_typed_config(filters[0]);
|
2522
|
+
if (typed_config == nullptr) {
|
2523
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2524
|
+
"No typed_config found in filter."));
|
2525
|
+
} else {
|
2526
|
+
absl::string_view type_url =
|
2527
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(typed_config));
|
2528
|
+
if (type_url !=
|
2529
|
+
"type.googleapis.com/"
|
2530
|
+
"envoy.extensions.filters.network.http_connection_manager.v3."
|
2531
|
+
"HttpConnectionManager") {
|
2532
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2533
|
+
absl::StrCat("Unsupported filter type ", type_url)));
|
2534
|
+
} else {
|
2535
|
+
const upb_strview encoded_http_connection_manager =
|
2536
|
+
google_protobuf_Any_value(typed_config);
|
2537
|
+
const auto* http_connection_manager =
|
2538
|
+
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_parse(
|
2539
|
+
encoded_http_connection_manager.data,
|
2540
|
+
encoded_http_connection_manager.size, context.arena);
|
2541
|
+
if (http_connection_manager == nullptr) {
|
2542
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2543
|
+
"Could not parse HttpConnectionManager config from filter "
|
2544
|
+
"typed_config"));
|
2545
|
+
} else {
|
2546
|
+
filter_chain->filter_chain_data =
|
2547
|
+
std::make_shared<XdsApi::LdsUpdate::FilterChainData>();
|
2548
|
+
grpc_error_handle error = HttpConnectionManagerParse(
|
2549
|
+
false /* is_client */, context, http_connection_manager, is_v2,
|
2550
|
+
&filter_chain->filter_chain_data->http_connection_manager);
|
2551
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2552
|
+
}
|
2553
|
+
}
|
2435
2554
|
}
|
2436
2555
|
}
|
2437
|
-
|
2556
|
+
auto* transport_socket =
|
2557
|
+
envoy_config_listener_v3_FilterChain_transport_socket(filter_chain_proto);
|
2558
|
+
if (transport_socket != nullptr) {
|
2559
|
+
grpc_error_handle error = DownstreamTlsContextParse(
|
2560
|
+
context, transport_socket,
|
2561
|
+
&filter_chain->filter_chain_data->downstream_tls_context);
|
2562
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
2563
|
+
}
|
2564
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("Error parsing FilterChain", &errors);
|
2438
2565
|
}
|
2439
2566
|
|
2440
2567
|
grpc_error_handle AddressParse(
|
@@ -2442,7 +2569,7 @@ grpc_error_handle AddressParse(
|
|
2442
2569
|
const auto* socket_address =
|
2443
2570
|
envoy_config_core_v3_Address_socket_address(address_proto);
|
2444
2571
|
if (socket_address == nullptr) {
|
2445
|
-
return
|
2572
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2446
2573
|
"Address does not have socket_address");
|
2447
2574
|
}
|
2448
2575
|
if (envoy_config_core_v3_SocketAddress_protocol(socket_address) !=
|
@@ -2485,11 +2612,9 @@ grpc_error_handle AddFilterChainDataForSourcePort(
|
|
2485
2612
|
port, XdsApi::LdsUpdate::FilterChainMap::FilterChainDataSharedPtr{
|
2486
2613
|
filter_chain.filter_chain_data});
|
2487
2614
|
if (!insert_result.second) {
|
2488
|
-
return
|
2489
|
-
|
2490
|
-
|
2491
|
-
filter_chain.filter_chain_match.ToString())
|
2492
|
-
.c_str());
|
2615
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrCat(
|
2616
|
+
"Duplicate matching rules detected when adding filter chain: ",
|
2617
|
+
filter_chain.filter_chain_match.ToString()));
|
2493
2618
|
}
|
2494
2619
|
return GRPC_ERROR_NONE;
|
2495
2620
|
}
|
@@ -2654,7 +2779,7 @@ grpc_error_handle BuildFilterChainMap(
|
|
2654
2779
|
return GRPC_ERROR_NONE;
|
2655
2780
|
}
|
2656
2781
|
|
2657
|
-
grpc_error_handle
|
2782
|
+
grpc_error_handle LdsResourceParseServer(
|
2658
2783
|
const EncodingContext& context,
|
2659
2784
|
const envoy_config_listener_v3_Listener* listener, bool is_v2,
|
2660
2785
|
XdsApi::LdsUpdate* lds_update) {
|
@@ -2703,166 +2828,31 @@ grpc_error_handle LdsResponseParseServer(
|
|
2703
2828
|
return GRPC_ERROR_NONE;
|
2704
2829
|
}
|
2705
2830
|
|
2706
|
-
grpc_error_handle
|
2831
|
+
grpc_error_handle LdsResourceParse(
|
2707
2832
|
const EncodingContext& context,
|
2708
|
-
const
|
2709
|
-
|
2710
|
-
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
// Check the type_url of the resource.
|
2719
|
-
absl::string_view type_url =
|
2720
|
-
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
2721
|
-
bool is_v2 = false;
|
2722
|
-
if (!IsLds(type_url, &is_v2)) {
|
2723
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2724
|
-
absl::StrCat("resource index ", i, ": Resource is not LDS.")
|
2725
|
-
.c_str()));
|
2726
|
-
continue;
|
2727
|
-
}
|
2728
|
-
// Decode the listener.
|
2729
|
-
const upb_strview encoded_listener =
|
2730
|
-
google_protobuf_Any_value(resources[i]);
|
2731
|
-
const envoy_config_listener_v3_Listener* listener =
|
2732
|
-
envoy_config_listener_v3_Listener_parse(
|
2733
|
-
encoded_listener.data, encoded_listener.size, context.arena);
|
2734
|
-
if (listener == nullptr) {
|
2735
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2736
|
-
absl::StrCat("resource index ", i, ": Can't decode listener.")
|
2737
|
-
.c_str()));
|
2738
|
-
continue;
|
2739
|
-
}
|
2740
|
-
// Check listener name. Ignore unexpected listeners.
|
2741
|
-
std::string listener_name =
|
2742
|
-
UpbStringToStdString(envoy_config_listener_v3_Listener_name(listener));
|
2743
|
-
if (expected_listener_names.find(listener_name) ==
|
2744
|
-
expected_listener_names.end()) {
|
2745
|
-
continue;
|
2746
|
-
}
|
2747
|
-
// Fail if listener name is duplicated.
|
2748
|
-
if (lds_update_map->find(listener_name) != lds_update_map->end()) {
|
2749
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2750
|
-
absl::StrCat("duplicate listener name \"", listener_name, "\"")
|
2751
|
-
.c_str()));
|
2752
|
-
resource_names_failed->insert(listener_name);
|
2753
|
-
continue;
|
2754
|
-
}
|
2755
|
-
// Serialize into JSON and store it in the LdsUpdateMap
|
2756
|
-
XdsApi::LdsResourceData& lds_resource_data =
|
2757
|
-
(*lds_update_map)[listener_name];
|
2758
|
-
XdsApi::LdsUpdate& lds_update = lds_resource_data.resource;
|
2759
|
-
lds_resource_data.serialized_proto = UpbStringToStdString(encoded_listener);
|
2760
|
-
// Check whether it's a client or server listener.
|
2761
|
-
const envoy_config_listener_v3_ApiListener* api_listener =
|
2762
|
-
envoy_config_listener_v3_Listener_api_listener(listener);
|
2763
|
-
const envoy_config_core_v3_Address* address =
|
2764
|
-
envoy_config_listener_v3_Listener_address(listener);
|
2765
|
-
if (api_listener != nullptr && address != nullptr) {
|
2766
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2767
|
-
absl::StrCat(listener_name,
|
2768
|
-
": Listener has both address and ApiListener")
|
2769
|
-
.c_str()));
|
2770
|
-
resource_names_failed->insert(listener_name);
|
2771
|
-
continue;
|
2772
|
-
}
|
2773
|
-
if (api_listener == nullptr && address == nullptr) {
|
2774
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2775
|
-
absl::StrCat(listener_name,
|
2776
|
-
": Listener has neither address nor ApiListener")
|
2777
|
-
.c_str()));
|
2778
|
-
resource_names_failed->insert(listener_name);
|
2779
|
-
continue;
|
2780
|
-
}
|
2781
|
-
grpc_error_handle error = GRPC_ERROR_NONE;
|
2782
|
-
if (api_listener != nullptr) {
|
2783
|
-
error = LdsResponseParseClient(context, api_listener, is_v2, &lds_update);
|
2784
|
-
} else {
|
2785
|
-
error = LdsResponseParseServer(context, listener, is_v2, &lds_update);
|
2786
|
-
}
|
2787
|
-
if (error != GRPC_ERROR_NONE) {
|
2788
|
-
errors.push_back(grpc_error_add_child(
|
2789
|
-
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2790
|
-
absl::StrCat(listener_name, ": validation error").c_str()),
|
2791
|
-
error));
|
2792
|
-
resource_names_failed->insert(listener_name);
|
2793
|
-
}
|
2833
|
+
const envoy_config_listener_v3_Listener* listener, bool is_v2,
|
2834
|
+
XdsApi::LdsUpdate* lds_update) {
|
2835
|
+
// Check whether it's a client or server listener.
|
2836
|
+
const envoy_config_listener_v3_ApiListener* api_listener =
|
2837
|
+
envoy_config_listener_v3_Listener_api_listener(listener);
|
2838
|
+
const envoy_config_core_v3_Address* address =
|
2839
|
+
envoy_config_listener_v3_Listener_address(listener);
|
2840
|
+
if (api_listener != nullptr && address != nullptr) {
|
2841
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2842
|
+
"Listener has both address and ApiListener");
|
2794
2843
|
}
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
// Get the resources from the response.
|
2806
|
-
size_t size;
|
2807
|
-
const google_protobuf_Any* const* resources =
|
2808
|
-
envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
|
2809
|
-
for (size_t i = 0; i < size; ++i) {
|
2810
|
-
// Check the type_url of the resource.
|
2811
|
-
absl::string_view type_url =
|
2812
|
-
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
2813
|
-
if (!IsRds(type_url)) {
|
2814
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2815
|
-
absl::StrCat("resource index ", i, ": Resource is not RDS.")
|
2816
|
-
.c_str()));
|
2817
|
-
continue;
|
2818
|
-
}
|
2819
|
-
// Decode the route_config.
|
2820
|
-
const upb_strview encoded_route_config =
|
2821
|
-
google_protobuf_Any_value(resources[i]);
|
2822
|
-
const envoy_config_route_v3_RouteConfiguration* route_config =
|
2823
|
-
envoy_config_route_v3_RouteConfiguration_parse(
|
2824
|
-
encoded_route_config.data, encoded_route_config.size,
|
2825
|
-
context.arena);
|
2826
|
-
if (route_config == nullptr) {
|
2827
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2828
|
-
absl::StrCat("resource index ", i, ": Can't decode route_config.")
|
2829
|
-
.c_str()));
|
2830
|
-
continue;
|
2831
|
-
}
|
2832
|
-
// Check route_config_name. Ignore unexpected route_config.
|
2833
|
-
std::string route_config_name = UpbStringToStdString(
|
2834
|
-
envoy_config_route_v3_RouteConfiguration_name(route_config));
|
2835
|
-
if (expected_route_configuration_names.find(route_config_name) ==
|
2836
|
-
expected_route_configuration_names.end()) {
|
2837
|
-
continue;
|
2838
|
-
}
|
2839
|
-
// Fail if route config name is duplicated.
|
2840
|
-
if (rds_update_map->find(route_config_name) != rds_update_map->end()) {
|
2841
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2842
|
-
absl::StrCat("duplicate route config name \"", route_config_name,
|
2843
|
-
"\"")
|
2844
|
-
.c_str()));
|
2845
|
-
resource_names_failed->insert(route_config_name);
|
2846
|
-
continue;
|
2847
|
-
}
|
2848
|
-
// Serialize into JSON and store it in the RdsUpdateMap
|
2849
|
-
XdsApi::RdsResourceData& rds_resource_data =
|
2850
|
-
(*rds_update_map)[route_config_name];
|
2851
|
-
XdsApi::RdsUpdate& rds_update = rds_resource_data.resource;
|
2852
|
-
rds_resource_data.serialized_proto =
|
2853
|
-
UpbStringToStdString(encoded_route_config);
|
2854
|
-
// Parse the route_config.
|
2855
|
-
grpc_error_handle error =
|
2856
|
-
RouteConfigParse(context, route_config, &rds_update);
|
2857
|
-
if (error != GRPC_ERROR_NONE) {
|
2858
|
-
errors.push_back(grpc_error_add_child(
|
2859
|
-
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2860
|
-
absl::StrCat(route_config_name, ": validation error").c_str()),
|
2861
|
-
error));
|
2862
|
-
resource_names_failed->insert(route_config_name);
|
2863
|
-
}
|
2844
|
+
if (api_listener == nullptr && address == nullptr) {
|
2845
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2846
|
+
"Listener has neither address nor ApiListener");
|
2847
|
+
}
|
2848
|
+
// Validate Listener fields.
|
2849
|
+
grpc_error_handle error = GRPC_ERROR_NONE;
|
2850
|
+
if (api_listener != nullptr) {
|
2851
|
+
error = LdsResourceParseClient(context, api_listener, is_v2, lds_update);
|
2852
|
+
} else {
|
2853
|
+
error = LdsResourceParseServer(context, listener, is_v2, lds_update);
|
2864
2854
|
}
|
2865
|
-
return
|
2855
|
+
return error;
|
2866
2856
|
}
|
2867
2857
|
|
2868
2858
|
grpc_error_handle UpstreamTlsContextParse(
|
@@ -2873,8 +2863,8 @@ grpc_error_handle UpstreamTlsContextParse(
|
|
2873
2863
|
absl::string_view name = UpbStringToAbsl(
|
2874
2864
|
envoy_config_core_v3_TransportSocket_name(transport_socket));
|
2875
2865
|
if (name != "envoy.transport_sockets.tls") {
|
2876
|
-
return
|
2877
|
-
absl::StrCat("Unrecognized transport socket: ", name)
|
2866
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2867
|
+
absl::StrCat("Unrecognized transport socket: ", name));
|
2878
2868
|
}
|
2879
2869
|
auto* typed_config =
|
2880
2870
|
envoy_config_core_v3_TransportSocket_typed_config(transport_socket);
|
@@ -2902,391 +2892,263 @@ grpc_error_handle UpstreamTlsContextParse(
|
|
2902
2892
|
}
|
2903
2893
|
}
|
2904
2894
|
}
|
2905
|
-
if (common_tls_context->
|
2906
|
-
.
|
2907
|
-
|
2908
|
-
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2895
|
+
if (common_tls_context->certificate_validation_context
|
2896
|
+
.ca_certificate_provider_instance.instance_name.empty()) {
|
2897
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2909
2898
|
"UpstreamTlsContext: TLS configuration provided but no "
|
2910
|
-
"
|
2911
|
-
|
2899
|
+
"ca_certificate_provider_instance found.");
|
2900
|
+
}
|
2901
|
+
return GRPC_ERROR_NONE;
|
2902
|
+
}
|
2903
|
+
|
2904
|
+
grpc_error_handle CdsLogicalDnsParse(
|
2905
|
+
const envoy_config_cluster_v3_Cluster* cluster,
|
2906
|
+
XdsApi::CdsUpdate* cds_update) {
|
2907
|
+
const auto* load_assignment =
|
2908
|
+
envoy_config_cluster_v3_Cluster_load_assignment(cluster);
|
2909
|
+
if (load_assignment == nullptr) {
|
2910
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2911
|
+
"load_assignment not present for LOGICAL_DNS cluster");
|
2912
|
+
}
|
2913
|
+
size_t num_localities;
|
2914
|
+
const auto* const* localities =
|
2915
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(load_assignment,
|
2916
|
+
&num_localities);
|
2917
|
+
if (num_localities != 1) {
|
2918
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2919
|
+
absl::StrCat("load_assignment for LOGICAL_DNS cluster must have "
|
2920
|
+
"exactly one locality, found ",
|
2921
|
+
num_localities));
|
2922
|
+
}
|
2923
|
+
size_t num_endpoints;
|
2924
|
+
const auto* const* endpoints =
|
2925
|
+
envoy_config_endpoint_v3_LocalityLbEndpoints_lb_endpoints(localities[0],
|
2926
|
+
&num_endpoints);
|
2927
|
+
if (num_endpoints != 1) {
|
2928
|
+
return GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
2929
|
+
absl::StrCat("locality for LOGICAL_DNS cluster must have "
|
2930
|
+
"exactly one endpoint, found ",
|
2931
|
+
num_endpoints));
|
2932
|
+
}
|
2933
|
+
const auto* endpoint =
|
2934
|
+
envoy_config_endpoint_v3_LbEndpoint_endpoint(endpoints[0]);
|
2935
|
+
if (endpoint == nullptr) {
|
2936
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2937
|
+
"LbEndpoint endpoint field not set");
|
2938
|
+
}
|
2939
|
+
const auto* address = envoy_config_endpoint_v3_Endpoint_address(endpoint);
|
2940
|
+
if (address == nullptr) {
|
2941
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2942
|
+
"Endpoint address field not set");
|
2943
|
+
}
|
2944
|
+
const auto* socket_address =
|
2945
|
+
envoy_config_core_v3_Address_socket_address(address);
|
2946
|
+
if (socket_address == nullptr) {
|
2947
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2948
|
+
"Address socket_address field not set");
|
2949
|
+
}
|
2950
|
+
if (envoy_config_core_v3_SocketAddress_resolver_name(socket_address).size !=
|
2951
|
+
0) {
|
2952
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2953
|
+
"LOGICAL_DNS clusters must NOT have a custom resolver name set");
|
2954
|
+
}
|
2955
|
+
absl::string_view address_str = UpbStringToAbsl(
|
2956
|
+
envoy_config_core_v3_SocketAddress_address(socket_address));
|
2957
|
+
if (address_str.empty()) {
|
2958
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2959
|
+
"SocketAddress address field not set");
|
2912
2960
|
}
|
2961
|
+
if (!envoy_config_core_v3_SocketAddress_has_port_value(socket_address)) {
|
2962
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
2963
|
+
"SocketAddress port_value field not set");
|
2964
|
+
}
|
2965
|
+
cds_update->dns_hostname = JoinHostPort(
|
2966
|
+
address_str,
|
2967
|
+
envoy_config_core_v3_SocketAddress_port_value(socket_address));
|
2913
2968
|
return GRPC_ERROR_NONE;
|
2914
2969
|
}
|
2915
2970
|
|
2916
|
-
grpc_error_handle
|
2971
|
+
grpc_error_handle CdsResourceParse(
|
2917
2972
|
const EncodingContext& context,
|
2918
|
-
const
|
2919
|
-
|
2920
|
-
XdsApi::CdsUpdateMap* cds_update_map,
|
2921
|
-
std::set<std::string>* resource_names_failed) {
|
2973
|
+
const envoy_config_cluster_v3_Cluster* cluster, bool /*is_v2*/,
|
2974
|
+
XdsApi::CdsUpdate* cds_update) {
|
2922
2975
|
std::vector<grpc_error_handle> errors;
|
2923
|
-
//
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2954
|
-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
absl::StrCat("duplicate resource name \"", cluster_name, "\"")
|
2961
|
-
.c_str()));
|
2962
|
-
resource_names_failed->insert(cluster_name);
|
2963
|
-
continue;
|
2964
|
-
}
|
2965
|
-
// Add the cluster to cds_update_map.
|
2966
|
-
XdsApi::CdsResourceData& cds_resource_data =
|
2967
|
-
(*cds_update_map)[cluster_name];
|
2968
|
-
XdsApi::CdsUpdate& cds_update = cds_resource_data.resource;
|
2969
|
-
// Store serialized proto.
|
2970
|
-
cds_resource_data.serialized_proto = UpbStringToStdString(encoded_cluster);
|
2971
|
-
// Check the cluster_discovery_type.
|
2972
|
-
if (!envoy_config_cluster_v3_Cluster_has_type(cluster) &&
|
2973
|
-
!envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
|
2974
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2975
|
-
absl::StrCat(cluster_name, ": DiscoveryType not found.").c_str()));
|
2976
|
-
resource_names_failed->insert(cluster_name);
|
2977
|
-
continue;
|
2978
|
-
}
|
2979
|
-
if (envoy_config_cluster_v3_Cluster_type(cluster) ==
|
2980
|
-
envoy_config_cluster_v3_Cluster_EDS) {
|
2981
|
-
cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::EDS;
|
2982
|
-
// Check the EDS config source.
|
2983
|
-
const envoy_config_cluster_v3_Cluster_EdsClusterConfig*
|
2984
|
-
eds_cluster_config =
|
2985
|
-
envoy_config_cluster_v3_Cluster_eds_cluster_config(cluster);
|
2986
|
-
const envoy_config_core_v3_ConfigSource* eds_config =
|
2987
|
-
envoy_config_cluster_v3_Cluster_EdsClusterConfig_eds_config(
|
2988
|
-
eds_cluster_config);
|
2989
|
-
if (!envoy_config_core_v3_ConfigSource_has_ads(eds_config)) {
|
2990
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
2991
|
-
absl::StrCat(cluster_name, ": EDS ConfigSource is not ADS.")
|
2992
|
-
.c_str()));
|
2993
|
-
resource_names_failed->insert(cluster_name);
|
2994
|
-
continue;
|
2995
|
-
}
|
2996
|
-
// Record EDS service_name (if any).
|
2997
|
-
upb_strview service_name =
|
2998
|
-
envoy_config_cluster_v3_Cluster_EdsClusterConfig_service_name(
|
2999
|
-
eds_cluster_config);
|
3000
|
-
if (service_name.size != 0) {
|
3001
|
-
cds_update.eds_service_name = UpbStringToStdString(service_name);
|
3002
|
-
}
|
3003
|
-
} else if (!XdsAggregateAndLogicalDnsClusterEnabled()) {
|
3004
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3005
|
-
absl::StrCat(cluster_name, ": DiscoveryType is not valid.").c_str()));
|
3006
|
-
resource_names_failed->insert(cluster_name);
|
3007
|
-
continue;
|
3008
|
-
} else if (envoy_config_cluster_v3_Cluster_type(cluster) ==
|
3009
|
-
envoy_config_cluster_v3_Cluster_LOGICAL_DNS) {
|
3010
|
-
cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::LOGICAL_DNS;
|
3011
|
-
const auto* load_assignment =
|
3012
|
-
envoy_config_cluster_v3_Cluster_load_assignment(cluster);
|
3013
|
-
if (load_assignment == nullptr) {
|
3014
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3015
|
-
absl::StrCat(
|
3016
|
-
cluster_name,
|
3017
|
-
": load_assignment not present for LOGICAL_DNS cluster")
|
3018
|
-
.c_str()));
|
3019
|
-
resource_names_failed->insert(cluster_name);
|
3020
|
-
continue;
|
3021
|
-
}
|
3022
|
-
size_t num_localities;
|
3023
|
-
const auto* const* localities =
|
3024
|
-
envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(
|
3025
|
-
load_assignment, &num_localities);
|
3026
|
-
if (num_localities != 1) {
|
3027
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3028
|
-
absl::StrCat(cluster_name,
|
3029
|
-
": load_assignment for LOGICAL_DNS cluster must have "
|
3030
|
-
"exactly one locality, found ",
|
3031
|
-
num_localities)
|
3032
|
-
.c_str()));
|
3033
|
-
resource_names_failed->insert(cluster_name);
|
3034
|
-
continue;
|
3035
|
-
}
|
3036
|
-
size_t num_endpoints;
|
3037
|
-
const auto* const* endpoints =
|
3038
|
-
envoy_config_endpoint_v3_LocalityLbEndpoints_lb_endpoints(
|
3039
|
-
localities[0], &num_endpoints);
|
3040
|
-
if (num_endpoints != 1) {
|
3041
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3042
|
-
absl::StrCat(cluster_name,
|
3043
|
-
": locality for LOGICAL_DNS cluster must have "
|
3044
|
-
"exactly one endpoint, found ",
|
3045
|
-
num_endpoints)
|
3046
|
-
.c_str()));
|
3047
|
-
resource_names_failed->insert(cluster_name);
|
3048
|
-
continue;
|
3049
|
-
}
|
3050
|
-
const auto* endpoint =
|
3051
|
-
envoy_config_endpoint_v3_LbEndpoint_endpoint(endpoints[0]);
|
3052
|
-
if (endpoint == nullptr) {
|
3053
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3054
|
-
absl::StrCat(cluster_name, ": LbEndpoint endpoint field not set")
|
3055
|
-
.c_str()));
|
3056
|
-
resource_names_failed->insert(cluster_name);
|
3057
|
-
continue;
|
3058
|
-
}
|
3059
|
-
const auto* address = envoy_config_endpoint_v3_Endpoint_address(endpoint);
|
3060
|
-
if (address == nullptr) {
|
3061
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3062
|
-
absl::StrCat(cluster_name, ": Endpoint address field not set")
|
3063
|
-
.c_str()));
|
3064
|
-
resource_names_failed->insert(cluster_name);
|
3065
|
-
continue;
|
3066
|
-
}
|
3067
|
-
const auto* socket_address =
|
3068
|
-
envoy_config_core_v3_Address_socket_address(address);
|
3069
|
-
if (socket_address == nullptr) {
|
3070
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3071
|
-
absl::StrCat(cluster_name, ": Address socket_address field not set")
|
3072
|
-
.c_str()));
|
3073
|
-
resource_names_failed->insert(cluster_name);
|
3074
|
-
continue;
|
3075
|
-
}
|
3076
|
-
if (envoy_config_core_v3_SocketAddress_resolver_name(socket_address)
|
3077
|
-
.size != 0) {
|
3078
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3079
|
-
absl::StrCat(
|
3080
|
-
cluster_name,
|
3081
|
-
": LOGICAL_DNS clusters must NOT have a custom resolver "
|
3082
|
-
"name set")
|
3083
|
-
.c_str()));
|
3084
|
-
resource_names_failed->insert(cluster_name);
|
3085
|
-
continue;
|
3086
|
-
}
|
3087
|
-
absl::string_view address_str = UpbStringToAbsl(
|
3088
|
-
envoy_config_core_v3_SocketAddress_address(socket_address));
|
3089
|
-
if (address_str.empty()) {
|
3090
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3091
|
-
absl::StrCat(cluster_name, ": SocketAddress address field not set")
|
3092
|
-
.c_str()));
|
3093
|
-
resource_names_failed->insert(cluster_name);
|
3094
|
-
continue;
|
3095
|
-
}
|
3096
|
-
if (!envoy_config_core_v3_SocketAddress_has_port_value(socket_address)) {
|
3097
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3098
|
-
absl::StrCat(cluster_name,
|
3099
|
-
": SocketAddress port_value field not set")
|
3100
|
-
.c_str()));
|
3101
|
-
resource_names_failed->insert(cluster_name);
|
3102
|
-
continue;
|
3103
|
-
}
|
3104
|
-
cds_update.dns_hostname = JoinHostPort(
|
3105
|
-
address_str,
|
3106
|
-
envoy_config_core_v3_SocketAddress_port_value(socket_address));
|
2976
|
+
// Check the cluster_discovery_type.
|
2977
|
+
if (!envoy_config_cluster_v3_Cluster_has_type(cluster) &&
|
2978
|
+
!envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
|
2979
|
+
errors.push_back(
|
2980
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("DiscoveryType not found."));
|
2981
|
+
} else if (envoy_config_cluster_v3_Cluster_type(cluster) ==
|
2982
|
+
envoy_config_cluster_v3_Cluster_EDS) {
|
2983
|
+
cds_update->cluster_type = XdsApi::CdsUpdate::ClusterType::EDS;
|
2984
|
+
// Check the EDS config source.
|
2985
|
+
const envoy_config_cluster_v3_Cluster_EdsClusterConfig* eds_cluster_config =
|
2986
|
+
envoy_config_cluster_v3_Cluster_eds_cluster_config(cluster);
|
2987
|
+
const envoy_config_core_v3_ConfigSource* eds_config =
|
2988
|
+
envoy_config_cluster_v3_Cluster_EdsClusterConfig_eds_config(
|
2989
|
+
eds_cluster_config);
|
2990
|
+
if (!envoy_config_core_v3_ConfigSource_has_ads(eds_config)) {
|
2991
|
+
errors.push_back(
|
2992
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("EDS ConfigSource is not ADS."));
|
2993
|
+
}
|
2994
|
+
// Record EDS service_name (if any).
|
2995
|
+
upb_strview service_name =
|
2996
|
+
envoy_config_cluster_v3_Cluster_EdsClusterConfig_service_name(
|
2997
|
+
eds_cluster_config);
|
2998
|
+
if (service_name.size != 0) {
|
2999
|
+
cds_update->eds_service_name = UpbStringToStdString(service_name);
|
3000
|
+
}
|
3001
|
+
} else if (!XdsAggregateAndLogicalDnsClusterEnabled()) {
|
3002
|
+
errors.push_back(
|
3003
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("DiscoveryType is not valid."));
|
3004
|
+
} else if (envoy_config_cluster_v3_Cluster_type(cluster) ==
|
3005
|
+
envoy_config_cluster_v3_Cluster_LOGICAL_DNS) {
|
3006
|
+
cds_update->cluster_type = XdsApi::CdsUpdate::ClusterType::LOGICAL_DNS;
|
3007
|
+
grpc_error_handle error = CdsLogicalDnsParse(cluster, cds_update);
|
3008
|
+
if (error != GRPC_ERROR_NONE) errors.push_back(error);
|
3009
|
+
} else {
|
3010
|
+
if (!envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
|
3011
|
+
errors.push_back(
|
3012
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("DiscoveryType is not valid."));
|
3107
3013
|
} else {
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3014
|
+
const envoy_config_cluster_v3_Cluster_CustomClusterType*
|
3015
|
+
custom_cluster_type =
|
3016
|
+
envoy_config_cluster_v3_Cluster_cluster_type(cluster);
|
3017
|
+
upb_strview type_name =
|
3018
|
+
envoy_config_cluster_v3_Cluster_CustomClusterType_name(
|
3019
|
+
custom_cluster_type);
|
3020
|
+
if (UpbStringToAbsl(type_name) != "envoy.clusters.aggregate") {
|
3021
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3022
|
+
"DiscoveryType is not valid."));
|
3023
|
+
} else {
|
3024
|
+
cds_update->cluster_type = XdsApi::CdsUpdate::ClusterType::AGGREGATE;
|
3025
|
+
// Retrieve aggregate clusters.
|
3026
|
+
const google_protobuf_Any* typed_config =
|
3027
|
+
envoy_config_cluster_v3_Cluster_CustomClusterType_typed_config(
|
3114
3028
|
custom_cluster_type);
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
aggregate_cluster_config_upb_strview.data,
|
3127
|
-
aggregate_cluster_config_upb_strview.size, context.arena);
|
3128
|
-
if (aggregate_cluster_config == nullptr) {
|
3129
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3130
|
-
absl::StrCat(cluster_name, ": Can't parse aggregate cluster.")
|
3131
|
-
.c_str()));
|
3132
|
-
resource_names_failed->insert(cluster_name);
|
3133
|
-
continue;
|
3134
|
-
}
|
3029
|
+
const upb_strview aggregate_cluster_config_upb_strview =
|
3030
|
+
google_protobuf_Any_value(typed_config);
|
3031
|
+
const envoy_extensions_clusters_aggregate_v3_ClusterConfig*
|
3032
|
+
aggregate_cluster_config =
|
3033
|
+
envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse(
|
3034
|
+
aggregate_cluster_config_upb_strview.data,
|
3035
|
+
aggregate_cluster_config_upb_strview.size, context.arena);
|
3036
|
+
if (aggregate_cluster_config == nullptr) {
|
3037
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3038
|
+
"Can't parse aggregate cluster."));
|
3039
|
+
} else {
|
3135
3040
|
size_t size;
|
3136
3041
|
const upb_strview* clusters =
|
3137
3042
|
envoy_extensions_clusters_aggregate_v3_ClusterConfig_clusters(
|
3138
3043
|
aggregate_cluster_config, &size);
|
3139
3044
|
for (size_t i = 0; i < size; ++i) {
|
3140
3045
|
const upb_strview cluster = clusters[i];
|
3141
|
-
cds_update
|
3046
|
+
cds_update->prioritized_cluster_names.emplace_back(
|
3142
3047
|
UpbStringToStdString(cluster));
|
3143
3048
|
}
|
3144
|
-
} else {
|
3145
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3146
|
-
absl::StrCat(cluster_name, ": DiscoveryType is not valid.")
|
3147
|
-
.c_str()));
|
3148
|
-
resource_names_failed->insert(cluster_name);
|
3149
|
-
continue;
|
3150
3049
|
}
|
3151
|
-
} else {
|
3152
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3153
|
-
absl::StrCat(cluster_name, ": DiscoveryType is not valid.")
|
3154
|
-
.c_str()));
|
3155
|
-
resource_names_failed->insert(cluster_name);
|
3156
|
-
continue;
|
3157
3050
|
}
|
3158
3051
|
}
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
": max_ring_size is not in the range of 1 to 8388608.")
|
3182
|
-
.c_str()));
|
3183
|
-
resource_names_failed->insert(cluster_name);
|
3184
|
-
continue;
|
3185
|
-
}
|
3186
|
-
}
|
3187
|
-
const google_protobuf_UInt64Value* min_ring_size =
|
3188
|
-
envoy_config_cluster_v3_Cluster_RingHashLbConfig_minimum_ring_size(
|
3189
|
-
ring_hash_config);
|
3190
|
-
if (min_ring_size != nullptr) {
|
3191
|
-
cds_update.min_ring_size =
|
3192
|
-
google_protobuf_UInt64Value_value(min_ring_size);
|
3193
|
-
if (cds_update.min_ring_size > 8388608 ||
|
3194
|
-
cds_update.min_ring_size == 0) {
|
3195
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3196
|
-
absl::StrCat(
|
3197
|
-
cluster_name,
|
3198
|
-
": min_ring_size is not in the range of 1 to 8388608.")
|
3199
|
-
.c_str()));
|
3200
|
-
resource_names_failed->insert(cluster_name);
|
3201
|
-
continue;
|
3202
|
-
}
|
3203
|
-
if (cds_update.min_ring_size > cds_update.max_ring_size) {
|
3204
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3205
|
-
absl::StrCat(
|
3206
|
-
cluster_name,
|
3207
|
-
": min_ring_size cannot be greater than max_ring_size.")
|
3208
|
-
.c_str()));
|
3209
|
-
resource_names_failed->insert(cluster_name);
|
3210
|
-
continue;
|
3211
|
-
}
|
3212
|
-
}
|
3213
|
-
if (envoy_config_cluster_v3_Cluster_RingHashLbConfig_hash_function(
|
3214
|
-
ring_hash_config) !=
|
3215
|
-
envoy_config_cluster_v3_Cluster_RingHashLbConfig_XX_HASH) {
|
3216
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3217
|
-
absl::StrCat(cluster_name,
|
3218
|
-
": ring hash lb config has invalid hash function.")
|
3219
|
-
.c_str()));
|
3220
|
-
resource_names_failed->insert(cluster_name);
|
3221
|
-
continue;
|
3052
|
+
}
|
3053
|
+
// Check the LB policy.
|
3054
|
+
if (envoy_config_cluster_v3_Cluster_lb_policy(cluster) ==
|
3055
|
+
envoy_config_cluster_v3_Cluster_ROUND_ROBIN) {
|
3056
|
+
cds_update->lb_policy = "ROUND_ROBIN";
|
3057
|
+
} else if (envoy_config_cluster_v3_Cluster_lb_policy(cluster) ==
|
3058
|
+
envoy_config_cluster_v3_Cluster_RING_HASH) {
|
3059
|
+
cds_update->lb_policy = "RING_HASH";
|
3060
|
+
// Record ring hash lb config
|
3061
|
+
auto* ring_hash_config =
|
3062
|
+
envoy_config_cluster_v3_Cluster_ring_hash_lb_config(cluster);
|
3063
|
+
if (ring_hash_config != nullptr) {
|
3064
|
+
const google_protobuf_UInt64Value* max_ring_size =
|
3065
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_maximum_ring_size(
|
3066
|
+
ring_hash_config);
|
3067
|
+
if (max_ring_size != nullptr) {
|
3068
|
+
cds_update->max_ring_size =
|
3069
|
+
google_protobuf_UInt64Value_value(max_ring_size);
|
3070
|
+
if (cds_update->max_ring_size > 8388608 ||
|
3071
|
+
cds_update->max_ring_size == 0) {
|
3072
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3073
|
+
"max_ring_size is not in the range of 1 to 8388608."));
|
3222
3074
|
}
|
3223
3075
|
}
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3239
|
-
absl::StrCat(
|
3240
|
-
"Error parsing security configuration for cluster: ",
|
3241
|
-
cluster_name)
|
3242
|
-
.c_str()),
|
3243
|
-
error));
|
3244
|
-
resource_names_failed->insert(cluster_name);
|
3245
|
-
continue;
|
3076
|
+
const google_protobuf_UInt64Value* min_ring_size =
|
3077
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_minimum_ring_size(
|
3078
|
+
ring_hash_config);
|
3079
|
+
if (min_ring_size != nullptr) {
|
3080
|
+
cds_update->min_ring_size =
|
3081
|
+
google_protobuf_UInt64Value_value(min_ring_size);
|
3082
|
+
if (cds_update->min_ring_size > 8388608 ||
|
3083
|
+
cds_update->min_ring_size == 0) {
|
3084
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3085
|
+
"min_ring_size is not in the range of 1 to 8388608."));
|
3086
|
+
}
|
3087
|
+
if (cds_update->min_ring_size > cds_update->max_ring_size) {
|
3088
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3089
|
+
"min_ring_size cannot be greater than max_ring_size."));
|
3246
3090
|
}
|
3247
3091
|
}
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
if (!envoy_config_core_v3_ConfigSource_has_self(lrs_server)) {
|
3254
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3255
|
-
absl::StrCat(cluster_name, ": LRS ConfigSource is not self.")
|
3256
|
-
.c_str()));
|
3257
|
-
resource_names_failed->insert(cluster_name);
|
3258
|
-
continue;
|
3092
|
+
if (envoy_config_cluster_v3_Cluster_RingHashLbConfig_hash_function(
|
3093
|
+
ring_hash_config) !=
|
3094
|
+
envoy_config_cluster_v3_Cluster_RingHashLbConfig_XX_HASH) {
|
3095
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3096
|
+
"ring hash lb config has invalid hash function."));
|
3259
3097
|
}
|
3260
|
-
cds_update.lrs_load_reporting_server_name.emplace("");
|
3261
3098
|
}
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3099
|
+
} else {
|
3100
|
+
errors.push_back(
|
3101
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("LB policy is not supported."));
|
3102
|
+
}
|
3103
|
+
auto* transport_socket =
|
3104
|
+
envoy_config_cluster_v3_Cluster_transport_socket(cluster);
|
3105
|
+
if (transport_socket != nullptr) {
|
3106
|
+
grpc_error_handle error = UpstreamTlsContextParse(
|
3107
|
+
context, transport_socket, &cds_update->common_tls_context);
|
3108
|
+
if (error != GRPC_ERROR_NONE) {
|
3109
|
+
errors.push_back(
|
3110
|
+
grpc_error_add_child(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3111
|
+
"Error parsing security configuration"),
|
3112
|
+
error));
|
3113
|
+
}
|
3114
|
+
}
|
3115
|
+
// Record LRS server name (if any).
|
3116
|
+
const envoy_config_core_v3_ConfigSource* lrs_server =
|
3117
|
+
envoy_config_cluster_v3_Cluster_lrs_server(cluster);
|
3118
|
+
if (lrs_server != nullptr) {
|
3119
|
+
if (!envoy_config_core_v3_ConfigSource_has_self(lrs_server)) {
|
3120
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3121
|
+
": LRS ConfigSource is not self."));
|
3122
|
+
}
|
3123
|
+
cds_update->lrs_load_reporting_server_name.emplace("");
|
3124
|
+
}
|
3125
|
+
// The Cluster resource encodes the circuit breaking parameters in a list of
|
3126
|
+
// Thresholds messages, where each message specifies the parameters for a
|
3127
|
+
// particular RoutingPriority. we will look only at the first entry in the
|
3128
|
+
// list for priority DEFAULT and default to 1024 if not found.
|
3129
|
+
if (envoy_config_cluster_v3_Cluster_has_circuit_breakers(cluster)) {
|
3130
|
+
const envoy_config_cluster_v3_CircuitBreakers* circuit_breakers =
|
3131
|
+
envoy_config_cluster_v3_Cluster_circuit_breakers(cluster);
|
3132
|
+
size_t num_thresholds;
|
3133
|
+
const envoy_config_cluster_v3_CircuitBreakers_Thresholds* const*
|
3134
|
+
thresholds = envoy_config_cluster_v3_CircuitBreakers_thresholds(
|
3135
|
+
circuit_breakers, &num_thresholds);
|
3136
|
+
for (size_t i = 0; i < num_thresholds; ++i) {
|
3137
|
+
const auto* threshold = thresholds[i];
|
3138
|
+
if (envoy_config_cluster_v3_CircuitBreakers_Thresholds_priority(
|
3139
|
+
threshold) == envoy_config_core_v3_DEFAULT) {
|
3140
|
+
const google_protobuf_UInt32Value* max_requests =
|
3141
|
+
envoy_config_cluster_v3_CircuitBreakers_Thresholds_max_requests(
|
3142
|
+
threshold);
|
3143
|
+
if (max_requests != nullptr) {
|
3144
|
+
cds_update->max_concurrent_requests =
|
3145
|
+
google_protobuf_UInt32Value_value(max_requests);
|
3285
3146
|
}
|
3147
|
+
break;
|
3286
3148
|
}
|
3287
3149
|
}
|
3288
3150
|
}
|
3289
|
-
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing CDS
|
3151
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing CDS resource", &errors);
|
3290
3152
|
}
|
3291
3153
|
|
3292
3154
|
grpc_error_handle ServerAddressParseAndAppend(
|
@@ -3420,12 +3282,79 @@ grpc_error_handle DropParseAndAppend(
|
|
3420
3282
|
return GRPC_ERROR_NONE;
|
3421
3283
|
}
|
3422
3284
|
|
3423
|
-
grpc_error_handle
|
3424
|
-
const EncodingContext& context
|
3285
|
+
grpc_error_handle EdsResourceParse(
|
3286
|
+
const EncodingContext& /*context*/,
|
3287
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment*
|
3288
|
+
cluster_load_assignment,
|
3289
|
+
bool /*is_v2*/, XdsApi::EdsUpdate* eds_update) {
|
3290
|
+
std::vector<grpc_error_handle> errors;
|
3291
|
+
// Get the endpoints.
|
3292
|
+
size_t locality_size;
|
3293
|
+
const envoy_config_endpoint_v3_LocalityLbEndpoints* const* endpoints =
|
3294
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(
|
3295
|
+
cluster_load_assignment, &locality_size);
|
3296
|
+
for (size_t j = 0; j < locality_size; ++j) {
|
3297
|
+
size_t priority;
|
3298
|
+
XdsApi::EdsUpdate::Priority::Locality locality;
|
3299
|
+
grpc_error_handle error = LocalityParse(endpoints[j], &locality, &priority);
|
3300
|
+
if (error != GRPC_ERROR_NONE) {
|
3301
|
+
errors.push_back(error);
|
3302
|
+
continue;
|
3303
|
+
}
|
3304
|
+
// Filter out locality with weight 0.
|
3305
|
+
if (locality.lb_weight == 0) continue;
|
3306
|
+
// Make sure prorities is big enough. Note that they might not
|
3307
|
+
// arrive in priority order.
|
3308
|
+
while (eds_update->priorities.size() < priority + 1) {
|
3309
|
+
eds_update->priorities.emplace_back();
|
3310
|
+
}
|
3311
|
+
eds_update->priorities[priority].localities.emplace(locality.name.get(),
|
3312
|
+
std::move(locality));
|
3313
|
+
}
|
3314
|
+
for (const auto& priority : eds_update->priorities) {
|
3315
|
+
if (priority.localities.empty()) {
|
3316
|
+
errors.push_back(
|
3317
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("sparse priority list"));
|
3318
|
+
}
|
3319
|
+
}
|
3320
|
+
// Get the drop config.
|
3321
|
+
eds_update->drop_config = MakeRefCounted<XdsApi::EdsUpdate::DropConfig>();
|
3322
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy* policy =
|
3323
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_policy(
|
3324
|
+
cluster_load_assignment);
|
3325
|
+
if (policy != nullptr) {
|
3326
|
+
size_t drop_size;
|
3327
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload* const*
|
3328
|
+
drop_overload =
|
3329
|
+
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_drop_overloads(
|
3330
|
+
policy, &drop_size);
|
3331
|
+
for (size_t j = 0; j < drop_size; ++j) {
|
3332
|
+
grpc_error_handle error =
|
3333
|
+
DropParseAndAppend(drop_overload[j], eds_update->drop_config.get());
|
3334
|
+
if (error != GRPC_ERROR_NONE) {
|
3335
|
+
errors.push_back(
|
3336
|
+
grpc_error_add_child(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3337
|
+
"drop config validation error"),
|
3338
|
+
error));
|
3339
|
+
}
|
3340
|
+
}
|
3341
|
+
}
|
3342
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing EDS resource", &errors);
|
3343
|
+
}
|
3344
|
+
|
3345
|
+
template <typename ProtoParseFunction, typename ProtoResourceNameFunction,
|
3346
|
+
typename ResourceTypeSelectorFunction, typename ProtoLogFunction,
|
3347
|
+
typename ResourceParseFunction, typename UpdateMap>
|
3348
|
+
grpc_error_handle AdsResponseParse(
|
3349
|
+
const EncodingContext& context, ProtoParseFunction proto_parse_function,
|
3350
|
+
ProtoResourceNameFunction proto_resource_name_function,
|
3351
|
+
ResourceTypeSelectorFunction resource_type_selector_function,
|
3352
|
+
ProtoLogFunction proto_log_function,
|
3353
|
+
ResourceParseFunction resource_parse_function,
|
3425
3354
|
const envoy_service_discovery_v3_DiscoveryResponse* response,
|
3426
|
-
const
|
3427
|
-
|
3428
|
-
std::set<std::string>* resource_names_failed) {
|
3355
|
+
const char* resource_type_string,
|
3356
|
+
const std::set<absl::string_view>& expected_resource_names,
|
3357
|
+
UpdateMap* update_map, std::set<std::string>* resource_names_failed) {
|
3429
3358
|
std::vector<grpc_error_handle> errors;
|
3430
3359
|
// Get the resources from the response.
|
3431
3360
|
size_t size;
|
@@ -3435,115 +3364,57 @@ grpc_error_handle EdsResponseParse(
|
|
3435
3364
|
// Check the type_url of the resource.
|
3436
3365
|
absl::string_view type_url =
|
3437
3366
|
UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
|
3438
|
-
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3367
|
+
bool is_v2 = false;
|
3368
|
+
if (!resource_type_selector_function(type_url, &is_v2)) {
|
3369
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
3370
|
+
absl::StrCat("resource index ", i, ": Resource is not ",
|
3371
|
+
resource_type_string, ".")));
|
3442
3372
|
continue;
|
3443
3373
|
}
|
3444
|
-
//
|
3445
|
-
upb_strview
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3453
|
-
absl::StrCat("resource index ", i,
|
3454
|
-
": Can't parse cluster_load_assignment.")
|
3455
|
-
.c_str()));
|
3374
|
+
// Parse the resource.
|
3375
|
+
upb_strview serialized_resource = google_protobuf_Any_value(resources[i]);
|
3376
|
+
auto* resource = proto_parse_function(
|
3377
|
+
serialized_resource.data, serialized_resource.size, context.arena);
|
3378
|
+
if (resource == nullptr) {
|
3379
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
3380
|
+
absl::StrCat("resource index ", i, ": Can't parse ",
|
3381
|
+
resource_type_string, " resource.")));
|
3456
3382
|
continue;
|
3457
3383
|
}
|
3458
|
-
|
3459
|
-
// Check the
|
3460
|
-
std::string
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3464
|
-
expected_eds_service_names.end()) {
|
3384
|
+
proto_log_function(context, resource);
|
3385
|
+
// Check the resource name. Ignore unexpected names.
|
3386
|
+
std::string resource_name =
|
3387
|
+
UpbStringToStdString(proto_resource_name_function(resource));
|
3388
|
+
if (expected_resource_names.find(resource_name) ==
|
3389
|
+
expected_resource_names.end()) {
|
3465
3390
|
continue;
|
3466
3391
|
}
|
3467
3392
|
// Fail on duplicate resources.
|
3468
|
-
if (
|
3469
|
-
errors.push_back(
|
3470
|
-
absl::StrCat("duplicate resource name \"",
|
3471
|
-
|
3472
|
-
resource_names_failed->insert(eds_service_name);
|
3393
|
+
if (update_map->find(resource_name) != update_map->end()) {
|
3394
|
+
errors.push_back(GRPC_ERROR_CREATE_FROM_CPP_STRING(
|
3395
|
+
absl::StrCat("duplicate resource name \"", resource_name, "\"")));
|
3396
|
+
resource_names_failed->insert(resource_name);
|
3473
3397
|
continue;
|
3474
3398
|
}
|
3475
|
-
//
|
3476
|
-
|
3477
|
-
|
3478
|
-
|
3479
|
-
eds_resource_data.serialized_proto =
|
3480
|
-
UpbStringToStdString(encoded_cluster_load_assignment);
|
3481
|
-
// Get the endpoints.
|
3482
|
-
size_t locality_size;
|
3483
|
-
const envoy_config_endpoint_v3_LocalityLbEndpoints* const* endpoints =
|
3484
|
-
envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(
|
3485
|
-
cluster_load_assignment, &locality_size);
|
3486
|
-
grpc_error_handle error = GRPC_ERROR_NONE;
|
3487
|
-
for (size_t j = 0; j < locality_size; ++j) {
|
3488
|
-
size_t priority;
|
3489
|
-
XdsApi::EdsUpdate::Priority::Locality locality;
|
3490
|
-
error = LocalityParse(endpoints[j], &locality, &priority);
|
3491
|
-
if (error != GRPC_ERROR_NONE) break;
|
3492
|
-
// Filter out locality with weight 0.
|
3493
|
-
if (locality.lb_weight == 0) continue;
|
3494
|
-
// Make sure prorities is big enough. Note that they might not
|
3495
|
-
// arrive in priority order.
|
3496
|
-
while (eds_update.priorities.size() < priority + 1) {
|
3497
|
-
eds_update.priorities.emplace_back();
|
3498
|
-
}
|
3499
|
-
eds_update.priorities[priority].localities.emplace(locality.name.get(),
|
3500
|
-
std::move(locality));
|
3501
|
-
}
|
3399
|
+
// Validate resource.
|
3400
|
+
decltype(UpdateMap::mapped_type::resource) update;
|
3401
|
+
grpc_error_handle error =
|
3402
|
+
resource_parse_function(context, resource, is_v2, &update);
|
3502
3403
|
if (error != GRPC_ERROR_NONE) {
|
3503
|
-
errors.push_back(
|
3504
|
-
|
3505
|
-
|
3506
|
-
|
3507
|
-
|
3508
|
-
|
3509
|
-
|
3510
|
-
|
3511
|
-
|
3512
|
-
|
3513
|
-
|
3514
|
-
absl::StrCat(eds_service_name, ": sparse priority list").c_str()));
|
3515
|
-
resource_names_failed->insert(eds_service_name);
|
3516
|
-
continue;
|
3517
|
-
}
|
3518
|
-
}
|
3519
|
-
// Get the drop config.
|
3520
|
-
eds_update.drop_config = MakeRefCounted<XdsApi::EdsUpdate::DropConfig>();
|
3521
|
-
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy* policy =
|
3522
|
-
envoy_config_endpoint_v3_ClusterLoadAssignment_policy(
|
3523
|
-
cluster_load_assignment);
|
3524
|
-
if (policy != nullptr) {
|
3525
|
-
size_t drop_size;
|
3526
|
-
const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload* const*
|
3527
|
-
drop_overload =
|
3528
|
-
envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_drop_overloads(
|
3529
|
-
policy, &drop_size);
|
3530
|
-
for (size_t j = 0; j < drop_size; ++j) {
|
3531
|
-
error =
|
3532
|
-
DropParseAndAppend(drop_overload[j], eds_update.drop_config.get());
|
3533
|
-
if (error != GRPC_ERROR_NONE) break;
|
3534
|
-
}
|
3535
|
-
if (error != GRPC_ERROR_NONE) {
|
3536
|
-
errors.push_back(grpc_error_add_child(
|
3537
|
-
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
3538
|
-
absl::StrCat(eds_service_name, ": drop config validation error")
|
3539
|
-
.c_str()),
|
3540
|
-
error));
|
3541
|
-
resource_names_failed->insert(eds_service_name);
|
3542
|
-
continue;
|
3543
|
-
}
|
3404
|
+
errors.push_back(
|
3405
|
+
grpc_error_add_child(GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrCat(
|
3406
|
+
resource_name, ": validation error")),
|
3407
|
+
error));
|
3408
|
+
resource_names_failed->insert(resource_name);
|
3409
|
+
} else {
|
3410
|
+
// Store result in update map, in both validated and serialized form.
|
3411
|
+
auto& resource_data = (*update_map)[resource_name];
|
3412
|
+
resource_data.resource = std::move(update);
|
3413
|
+
resource_data.serialized_proto =
|
3414
|
+
UpbStringToStdString(serialized_resource);
|
3544
3415
|
}
|
3545
3416
|
}
|
3546
|
-
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing
|
3417
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing ADS response", &errors);
|
3547
3418
|
}
|
3548
3419
|
|
3549
3420
|
std::string TypeUrlInternalToExternal(absl::string_view type_url) {
|
@@ -3559,13 +3430,25 @@ std::string TypeUrlInternalToExternal(absl::string_view type_url) {
|
|
3559
3430
|
return std::string(type_url);
|
3560
3431
|
}
|
3561
3432
|
|
3562
|
-
|
3563
|
-
|
3564
|
-
|
3565
|
-
|
3566
|
-
|
3567
|
-
|
3568
|
-
|
3433
|
+
upb_strview LdsResourceName(
|
3434
|
+
const envoy_config_listener_v3_Listener* lds_resource) {
|
3435
|
+
return envoy_config_listener_v3_Listener_name(lds_resource);
|
3436
|
+
}
|
3437
|
+
|
3438
|
+
upb_strview RdsResourceName(
|
3439
|
+
const envoy_config_route_v3_RouteConfiguration* rds_resource) {
|
3440
|
+
return envoy_config_route_v3_RouteConfiguration_name(rds_resource);
|
3441
|
+
}
|
3442
|
+
|
3443
|
+
upb_strview CdsResourceName(
|
3444
|
+
const envoy_config_cluster_v3_Cluster* cds_resource) {
|
3445
|
+
return envoy_config_cluster_v3_Cluster_name(cds_resource);
|
3446
|
+
}
|
3447
|
+
|
3448
|
+
upb_strview EdsResourceName(
|
3449
|
+
const envoy_config_endpoint_v3_ClusterLoadAssignment* eds_resource) {
|
3450
|
+
return envoy_config_endpoint_v3_ClusterLoadAssignment_cluster_name(
|
3451
|
+
eds_resource);
|
3569
3452
|
}
|
3570
3453
|
|
3571
3454
|
} // namespace
|
@@ -3604,38 +3487,33 @@ XdsApi::AdsParseResult XdsApi::ParseAdsResponse(
|
|
3604
3487
|
result.nonce = UpbStringToStdString(
|
3605
3488
|
envoy_service_discovery_v3_DiscoveryResponse_nonce(response));
|
3606
3489
|
// Parse the response according to the resource type.
|
3490
|
+
// TODO(roth): When we have time, consider defining an interface for the
|
3491
|
+
// methods of each resource type, so that we don't have to pass
|
3492
|
+
// individual functions into each call to AdsResponseParse().
|
3607
3493
|
if (IsLds(result.type_url)) {
|
3608
|
-
result.parse_error =
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3612
|
-
|
3613
|
-
&result.resource_names_failed);
|
3614
|
-
}
|
3494
|
+
result.parse_error = AdsResponseParse(
|
3495
|
+
context, envoy_config_listener_v3_Listener_parse, LdsResourceName,
|
3496
|
+
IsLds, MaybeLogListener, LdsResourceParse, response, "LDS",
|
3497
|
+
expected_listener_names, &result.lds_update_map,
|
3498
|
+
&result.resource_names_failed);
|
3615
3499
|
} else if (IsRds(result.type_url)) {
|
3616
|
-
result.parse_error =
|
3617
|
-
|
3618
|
-
|
3619
|
-
|
3620
|
-
|
3621
|
-
&result.resource_names_failed);
|
3622
|
-
}
|
3500
|
+
result.parse_error = AdsResponseParse(
|
3501
|
+
context, envoy_config_route_v3_RouteConfiguration_parse,
|
3502
|
+
RdsResourceName, IsRds, MaybeLogRouteConfiguration, RouteConfigParse,
|
3503
|
+
response, "RDS", expected_route_configuration_names,
|
3504
|
+
&result.rds_update_map, &result.resource_names_failed);
|
3623
3505
|
} else if (IsCds(result.type_url)) {
|
3624
|
-
result.parse_error =
|
3625
|
-
|
3626
|
-
|
3627
|
-
|
3628
|
-
|
3629
|
-
&result.resource_names_failed);
|
3630
|
-
}
|
3506
|
+
result.parse_error = AdsResponseParse(
|
3507
|
+
context, envoy_config_cluster_v3_Cluster_parse, CdsResourceName, IsCds,
|
3508
|
+
MaybeLogCluster, CdsResourceParse, response, "CDS",
|
3509
|
+
expected_cluster_names, &result.cds_update_map,
|
3510
|
+
&result.resource_names_failed);
|
3631
3511
|
} else if (IsEds(result.type_url)) {
|
3632
|
-
result.parse_error =
|
3633
|
-
|
3634
|
-
|
3635
|
-
|
3636
|
-
|
3637
|
-
&result.resource_names_failed);
|
3638
|
-
}
|
3512
|
+
result.parse_error = AdsResponseParse(
|
3513
|
+
context, envoy_config_endpoint_v3_ClusterLoadAssignment_parse,
|
3514
|
+
EdsResourceName, IsEds, MaybeLogClusterLoadAssignment, EdsResourceParse,
|
3515
|
+
response, "EDS", expected_eds_service_names, &result.eds_update_map,
|
3516
|
+
&result.resource_names_failed);
|
3639
3517
|
}
|
3640
3518
|
return result;
|
3641
3519
|
}
|