Merge remote-tracking branch 'upstream/master' into dns-empty-hostname

pull/35306/head
yijiem 12 months ago
commit 9c7f67c27a
  1. 11
      src/core/ext/xds/xds_common_types.cc
  2. 6
      src/core/ext/xds/xds_http_rbac_filter.cc
  3. 8
      src/core/ext/xds/xds_listener.cc
  4. 47
      src/core/lib/promise/poll.h

@ -385,13 +385,16 @@ CommonTlsContext CommonTlsContext::Parse(
CertificateProviderInstanceParse( CertificateProviderInstanceParse(
context, tls_certificate_certificate_provider_instance, errors); context, tls_certificate_certificate_provider_instance, errors);
} else { } else {
if (envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_tls_certificates( size_t size;
common_tls_context_proto)) { envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificates(
common_tls_context_proto, &size);
if (size != 0) {
ValidationErrors::ScopedField field(errors, ".tls_certificates"); ValidationErrors::ScopedField field(errors, ".tls_certificates");
errors->AddError("feature unsupported"); errors->AddError("feature unsupported");
} }
if (envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_has_tls_certificate_sds_secret_configs( envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_sds_secret_configs(
common_tls_context_proto)) { common_tls_context_proto, &size);
if (size != 0) {
ValidationErrors::ScopedField field( ValidationErrors::ScopedField field(
errors, ".tls_certificate_sds_secret_configs"); errors, ".tls_certificate_sds_secret_configs");
errors->AddError("feature unsupported"); errors->AddError("feature unsupported");

@ -486,8 +486,10 @@ Json ParseHttpRbacToJson(const XdsResourceType::DecodeContext& context,
ValidationErrors::ScopedField field(errors, ".audit_condition"); ValidationErrors::ScopedField field(errors, ".audit_condition");
errors->AddError("invalid audit condition"); errors->AddError("invalid audit condition");
} }
if (envoy_config_rbac_v3_RBAC_AuditLoggingOptions_has_logger_configs( size_t size;
audit_logging_options)) { envoy_config_rbac_v3_RBAC_AuditLoggingOptions_logger_configs(
audit_logging_options, &size);
if (size != 0) {
inner_rbac_json.emplace("audit_loggers", inner_rbac_json.emplace("audit_loggers",
ParseAuditLoggerConfigsToJson( ParseAuditLoggerConfigsToJson(
context, audit_logging_options, errors)); context, audit_logging_options, errors));

@ -332,12 +332,16 @@ XdsListenerResource::HttpConnectionManager HttpConnectionManagerParse(
} }
// original_ip_detection_extensions -- must be empty as per // original_ip_detection_extensions -- must be empty as per
// https://github.com/grpc/proposal/blob/master/A41-xds-rbac.md // https://github.com/grpc/proposal/blob/master/A41-xds-rbac.md
if (envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_original_ip_detection_extensions( {
http_connection_manager_proto)) { size_t size;
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_original_ip_detection_extensions(
http_connection_manager_proto, &size);
if (size != 0) {
ValidationErrors::ScopedField field(errors, ValidationErrors::ScopedField field(errors,
".original_ip_detection_extensions"); ".original_ip_detection_extensions");
errors->AddError("must be empty"); errors->AddError("must be empty");
} }
}
// common_http_protocol_options // common_http_protocol_options
const envoy_config_core_v3_HttpProtocolOptions* options = const envoy_config_core_v3_HttpProtocolOptions* options =
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_common_http_protocol_options( envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_common_http_protocol_options(

@ -186,6 +186,21 @@ class Poll<Pending>;
template <class T> template <class T>
class Poll<Poll<T>>; class Poll<Poll<T>>;
// PollTraits tells us whether a type is Poll<> or some other type, and is
// leveraged in the PromiseLike/PromiseFactory machinery to select the
// appropriate implementation of those concepts based upon the return type of a
// lambda, for example (via enable_if).
template <typename T>
struct PollTraits {
static constexpr bool is_poll() { return false; }
};
template <typename T>
struct PollTraits<Poll<T>> {
using Type = T;
static constexpr bool is_poll() { return true; }
};
template <typename T> template <typename T>
bool operator==(const Poll<T>& a, const Poll<T>& b) { bool operator==(const Poll<T>& a, const Poll<T>& b) {
if (a.pending() && b.pending()) return true; if (a.pending() && b.pending()) return true;
@ -193,27 +208,37 @@ bool operator==(const Poll<T>& a, const Poll<T>& b) {
return false; return false;
} }
template <typename T, typename U, typename SfinaeVoid = void>
struct PollCastImpl;
template <typename T, typename U> template <typename T, typename U>
Poll<T> poll_cast(Poll<U> poll) { struct PollCastImpl<T, Poll<U>> {
static Poll<T> Cast(Poll<U>&& poll) {
if (poll.pending()) return Pending{}; if (poll.pending()) return Pending{};
return static_cast<T>(std::move(poll.value())); return static_cast<T>(std::move(poll.value()));
} }
};
template <typename T, typename U>
struct PollCastImpl<T, U, std::enable_if<!PollTraits<U>::is_poll()>> {
static Poll<T> Cast(U&& poll) { return Poll<T>(T(std::move(poll))); }
};
// PollTraits tells us whether a type is Poll<> or some other type, and is
// leveraged in the PromiseLike/PromiseFactory machinery to select the
// appropriate implementation of those concepts based upon the return type of a
// lambda, for example (via enable_if).
template <typename T> template <typename T>
struct PollTraits { struct PollCastImpl<T, T> {
static constexpr bool is_poll() { return false; } static Poll<T> Cast(T&& poll) { return Poll<T>(std::move(poll)); }
}; };
template <typename T> template <typename T>
struct PollTraits<Poll<T>> { struct PollCastImpl<T, Poll<T>> {
using Type = T; static Poll<T> Cast(Poll<T>&& poll) { return std::move(poll); }
static constexpr bool is_poll() { return true; }
}; };
template <typename T, typename U>
Poll<T> poll_cast(U poll) {
return PollCastImpl<T, U>::Cast(std::move(poll));
}
// Convert a poll to a string // Convert a poll to a string
template <typename T, typename F> template <typename T, typename F>
std::string PollToString( std::string PollToString(

Loading…
Cancel
Save