Skip to content

Commit

Permalink
Merge branch 'envoyproxy:main' into Add-Vectorscan-(same-ABI-as-Hyper…
Browse files Browse the repository at this point in the history
…scan)-for-Arm-64
  • Loading branch information
sambercovici authored Nov 28, 2023
2 parents 9d5148f + 7f84968 commit d070ed7
Show file tree
Hide file tree
Showing 82 changed files with 368 additions and 921 deletions.
11 changes: 5 additions & 6 deletions api/envoy/config/route/v3/route_components.proto
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ message RouteMatch {
google.protobuf.BoolValue validated = 2;
}

// An extensible message for matching CONNECT requests.
// An extensible message for matching CONNECT or CONNECT-UDP requests.
message ConnectMatcher {
}

Expand Down Expand Up @@ -577,11 +577,10 @@ message RouteMatch {
// stripping. This needs more thought.]
type.matcher.v3.RegexMatcher safe_regex = 10 [(validate.rules).message = {required: true}];

// If this is used as the matcher, the matcher will only match CONNECT requests.
// Note that this will not match HTTP/2 upgrade-style CONNECT requests
// (WebSocket and the like) as they are normalized in Envoy as HTTP/1.1 style
// upgrades.
// This is the only way to match CONNECT requests for HTTP/1.1. For HTTP/2,
// If this is used as the matcher, the matcher will only match CONNECT or CONNECT-UDP requests.
// Note that this will not match other Extended CONNECT requests (WebSocket and the like) as
// they are normalized in Envoy as HTTP/1.1 style upgrades.
// This is the only way to match CONNECT requests for HTTP/1.1. For HTTP/2 and HTTP/3,
// where Extended CONNECT requests may have a path, the path matchers will work if
// there is a path present.
// Note that CONNECT support is currently considered alpha in Envoy.
Expand Down
4 changes: 4 additions & 0 deletions api/envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,15 @@ message ExternalProcessor {
// for a reply.
bool async_mode = 4;

// [#not-implemented-hide:]
// Envoy provides a number of :ref:`attributes <arch_overview_attributes>`
// for expressive policies. Each attribute name provided in this field will be
// matched against that list and populated in the request_headers message.
// See the :ref:`attribute documentation <arch_overview_request_attributes>`
// for the list of supported attributes and their types.
repeated string request_attributes = 5;

// [#not-implemented-hide:]
// Envoy provides a number of :ref:`attributes <arch_overview_attributes>`
// for expressive policies. Each attribute name provided in this field will be
// matched against that list and populated in the response_headers message.
Expand Down Expand Up @@ -255,10 +257,12 @@ message ExtProcOverrides {
// Set a different asynchronous processing option than the default.
bool async_mode = 2;

// [#not-implemented-hide:]
// Set different optional attributes than the default setting of the
// ``request_attributes`` field.
repeated string request_attributes = 3;

// [#not-implemented-hide:]
// Set different optional properties than the default setting of the
// ``response_attributes`` field.
repeated string response_attributes = 4;
Expand Down
9 changes: 1 addition & 8 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ removed_config_or_runtime:
Removed ``envoy.reloadable_features.expand_agnostic_stream_lifetime`` and legacy code paths.
- area: http
change: |
removed ``envoy.reloadable_features.correctly_validate_alpn`` and legacy code paths.
removed ``envoy.reloadable_features.sanitize_original_path`` and legacy code paths.
- area: maglev
change: |
Removed ``envoy.reloadable_features.allow_compact_maglev`` and legacy code paths.
Expand Down Expand Up @@ -203,13 +203,6 @@ new_features:
- area: tracing
change: |
Provide initial span attributes to a sampler used in the OpenTelemetry tracer.
- area: ext_proc
change: |
implemented
:ref:`request_attributes <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.request_attributes>`
and
:ref:`response_attributes <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.response_attributes>`
config APIs to enable sending and receiving attributes from/to the external processing server.
- area: tracing
change: |
Added support to configure a Dynatrace resource detector for the OpenTelemetry tracer.
Expand Down
13 changes: 3 additions & 10 deletions contrib/generic_proxy/filters/network/source/file_access_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class FileAccessLogFactoryBase : public AccessLog::AccessLogInstanceFactoryBase<
AccessLog::InstanceBaseSharedPtr<Context>
createAccessLogInstance(const Protobuf::Message& config,
AccessLog::FilterBasePtr<Context>&& filter,
Server::Configuration::CommonFactoryContext& context) override {
Server::Configuration::FactoryContext& context) override {
const auto& typed_config = MessageUtil::downcastAndValidate<
const envoy::extensions::access_loggers::file::v3::FileAccessLog&>(
config, context.messageValidationVisitor());
Expand Down Expand Up @@ -93,15 +93,8 @@ class FileAccessLogFactoryBase : public AccessLog::AccessLogInstanceFactoryBase<

Filesystem::FilePathAndType file_info{Filesystem::DestinationType::File, typed_config.path()};
return std::make_shared<FileAccessLogBase<Context>>(
file_info, std::move(filter), std::move(formatter), context.accessLogManager());
}

AccessLog::InstanceBaseSharedPtr<Context> createAccessLogInstance(
const Protobuf::Message& config, AccessLog::FilterBasePtr<Context>&& filter,
Server::Configuration::ListenerAccessLogFactoryContext& context) override {
return createAccessLogInstance(
config, std::move(filter),
static_cast<Server::Configuration::CommonFactoryContext&>(context));
file_info, std::move(filter), std::move(formatter),
context.getServerFactoryContext().accessLogManager());
}

ProtobufTypes::MessagePtr createEmptyConfigProto() override {
Expand Down
10 changes: 5 additions & 5 deletions contrib/generic_proxy/filters/network/test/proxy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ class FilterConfigTest : public testing::Test {
Envoy::Formatter::SubstitutionFormatStringUtils::fromProtoConfig<FormatterContext>(
sff_config, factory_context_);

return std::make_shared<FileAccessLog>(Filesystem::FilePathAndType{}, nullptr,
std::move(formatter),
factory_context_.accessLogManager());
return std::make_shared<FileAccessLog>(
Filesystem::FilePathAndType{}, nullptr, std::move(formatter),
factory_context_.server_factory_context_.accessLogManager());
}

std::shared_ptr<NiceMock<Tracing::MockTracer>> tracer_;
Expand Down Expand Up @@ -708,7 +708,7 @@ TEST_F(FilterTest, NewStreamAndReplyNormally) {
}));

EXPECT_CALL(
*factory_context_.access_log_manager_.file_,
*factory_context_.server_factory_context_.access_log_manager_.file_,
write("host-value /path-value method-value protocol-value request-value response-value -"));

EXPECT_CALL(factory_context_.drain_manager_, drainClose()).WillOnce(Return(false));
Expand Down Expand Up @@ -767,7 +767,7 @@ TEST_F(FilterTest, NewStreamAndReplyNormallyWithMultipleFrames) {
auto active_stream = filter_->activeStreamsForTest().begin()->get();

EXPECT_CALL(
*factory_context_.access_log_manager_.file_,
*factory_context_.server_factory_context_.access_log_manager_.file_,
write("host-value /path-value method-value protocol-value request-value response-value -"));

EXPECT_CALL(factory_context_.drain_manager_, drainClose()).WillOnce(Return(false));
Expand Down
20 changes: 3 additions & 17 deletions envoy/access_log/access_log_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ template <class Context> class ExtensionFilterFactoryBase : public Config::Typed
* implementation is unable to produce a filter with the provided parameters, it should throw an
* EnvoyException. The returned pointer should never be nullptr.
* @param config supplies the custom configuration for this filter type.
* @param context supplies the server factory context.
* @param context supplies the factory context.
* @return an instance of extension filter implementation from a config proto.
*/
virtual FilterBasePtr<Context>
createFilter(const envoy::config::accesslog::v3::ExtensionFilter& config,
Server::Configuration::CommonFactoryContext& context) PURE;
Server::Configuration::FactoryContext& context) PURE;

std::string category() const override { return category_; }

Expand Down Expand Up @@ -74,21 +74,7 @@ template <class Context> class AccessLogInstanceFactoryBase : public Config::Typ
virtual AccessLog::InstanceBaseSharedPtr<Context>
createAccessLogInstance(const Protobuf::Message& config,
AccessLog::FilterBasePtr<Context>&& filter,
Server::Configuration::ListenerAccessLogFactoryContext& context) PURE;

/**
* Create a particular AccessLog::Instance implementation from a config proto. If the
* implementation is unable to produce a factory with the provided parameters, it should throw an
* EnvoyException. The returned pointer should never be nullptr.
* @param config the custom configuration for this access log type.
* @param filter filter to determine whether a particular request should be logged. If no filter
* was specified in the configuration, argument will be nullptr.
* @param context general filter context through which persistent resources can be accessed.
*/
virtual AccessLog::InstanceBaseSharedPtr<Context>
createAccessLogInstance(const Protobuf::Message& config,
AccessLog::FilterBasePtr<Context>&& filter,
Server::Configuration::CommonFactoryContext& context) PURE;
Server::Configuration::FactoryContext& context) PURE;

std::string category() const override { return category_; }

Expand Down
5 changes: 0 additions & 5 deletions envoy/http/query_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ namespace Envoy {
namespace Http {
namespace Utility {

// TODO(jmarantz): this should probably be a proper class, with methods to serialize
// using proper formatting. Perhaps similar to
// https://github.com/apache/incubator-pagespeed-mod/blob/master/pagespeed/kernel/http/query_params.h

using QueryParams = std::map<std::string, std::string>;
using QueryParamsVector = std::vector<std::pair<std::string, std::string>>;

class QueryParamsMulti {
Expand Down
2 changes: 1 addition & 1 deletion envoy/server/admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class AdminStream {
*
* @param The query name/value map.
*/
virtual Http::Utility::QueryParams queryParams() const PURE;
virtual Http::Utility::QueryParamsMulti queryParams() const PURE;
};

/**
Expand Down
33 changes: 8 additions & 25 deletions source/common/access_log/access_log_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ bool ComparisonFilter::compareAgainstValue(uint64_t lhs) const {
}

FilterPtr FilterFactory::fromProto(const envoy::config::accesslog::v3::AccessLogFilter& config,
Server::Configuration::CommonFactoryContext& context) {
Runtime::Loader& runtime = context.runtime();
Random::RandomGenerator& random = context.api().randomGenerator();
Server::Configuration::FactoryContext& context) {
Runtime::Loader& runtime = context.getServerFactoryContext().runtime();
Random::RandomGenerator& random = context.getServerFactoryContext().api().randomGenerator();
ProtobufMessage::ValidationVisitor& validation_visitor = context.messageValidationVisitor();
switch (config.filter_specifier_case()) {
case envoy::config::accesslog::v3::AccessLogFilter::FilterSpecifierCase::kStatusCodeFilter:
Expand Down Expand Up @@ -156,7 +156,7 @@ bool RuntimeFilter::evaluate(const Formatter::HttpFormatterContext&,

OperatorFilter::OperatorFilter(
const Protobuf::RepeatedPtrField<envoy::config::accesslog::v3::AccessLogFilter>& configs,
Server::Configuration::CommonFactoryContext& context) {
Server::Configuration::FactoryContext& context) {
for (const auto& config : configs) {
auto filter = FilterFactory::fromProto(config, context);
if (filter != nullptr) {
Expand All @@ -166,11 +166,11 @@ OperatorFilter::OperatorFilter(
}

OrFilter::OrFilter(const envoy::config::accesslog::v3::OrFilter& config,
Server::Configuration::CommonFactoryContext& context)
Server::Configuration::FactoryContext& context)
: OperatorFilter(config.filters(), context) {}

AndFilter::AndFilter(const envoy::config::accesslog::v3::AndFilter& config,
Server::Configuration::CommonFactoryContext& context)
Server::Configuration::FactoryContext& context)
: OperatorFilter(config.filters(), context) {}

bool OrFilter::evaluate(const Formatter::HttpFormatterContext& context,
Expand Down Expand Up @@ -311,11 +311,8 @@ bool MetadataFilter::evaluate(const Formatter::HttpFormatterContext&,
return default_match_;
}

namespace {

template <typename FactoryContext>
InstanceSharedPtr makeAccessLogInstance(const envoy::config::accesslog::v3::AccessLog& config,
FactoryContext& context) {
InstanceSharedPtr AccessLogFactory::fromProto(const envoy::config::accesslog::v3::AccessLog& config,
Server::Configuration::FactoryContext& context) {
FilterPtr filter;
if (config.has_filter()) {
filter = FilterFactory::fromProto(config.filter(), context);
Expand All @@ -328,19 +325,5 @@ InstanceSharedPtr makeAccessLogInstance(const envoy::config::accesslog::v3::Acce
return factory.createAccessLogInstance(*message, std::move(filter), context);
}

} // namespace

InstanceSharedPtr
AccessLogFactory::fromProto(const envoy::config::accesslog::v3::AccessLog& config,
Server::Configuration::ListenerAccessLogFactoryContext& context) {
return makeAccessLogInstance(config, context);
}

InstanceSharedPtr
AccessLogFactory::fromProto(const envoy::config::accesslog::v3::AccessLog& config,
Server::Configuration::CommonFactoryContext& context) {
return makeAccessLogInstance(config, context);
}

} // namespace AccessLog
} // namespace Envoy
22 changes: 7 additions & 15 deletions source/common/access_log/access_log_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FilterFactory {
* Read a filter definition from proto and instantiate a concrete filter class.
*/
static FilterPtr fromProto(const envoy::config::accesslog::v3::AccessLogFilter& config,
Server::Configuration::CommonFactoryContext& context);
Server::Configuration::FactoryContext& context);
};

/**
Expand Down Expand Up @@ -87,7 +87,7 @@ class OperatorFilter : public Filter {
public:
OperatorFilter(
const Protobuf::RepeatedPtrField<envoy::config::accesslog::v3::AccessLogFilter>& configs,
Server::Configuration::CommonFactoryContext& context);
Server::Configuration::FactoryContext& context);

protected:
std::vector<FilterPtr> filters_;
Expand All @@ -99,7 +99,7 @@ class OperatorFilter : public Filter {
class AndFilter : public OperatorFilter {
public:
AndFilter(const envoy::config::accesslog::v3::AndFilter& config,
Server::Configuration::CommonFactoryContext& context);
Server::Configuration::FactoryContext& context);

// AccessLog::Filter
bool evaluate(const Formatter::HttpFormatterContext& context,
Expand All @@ -112,7 +112,7 @@ class AndFilter : public OperatorFilter {
class OrFilter : public OperatorFilter {
public:
OrFilter(const envoy::config::accesslog::v3::OrFilter& config,
Server::Configuration::CommonFactoryContext& context);
Server::Configuration::FactoryContext& context);

// AccessLog::Filter
bool evaluate(const Formatter::HttpFormatterContext& context,
Expand Down Expand Up @@ -265,16 +265,8 @@ class AccessLogFactory {
* Read a filter definition from proto and instantiate an Instance. This method is used
* to create access log instances that need access to listener properties.
*/
static InstanceSharedPtr
fromProto(const envoy::config::accesslog::v3::AccessLog& config,
Server::Configuration::ListenerAccessLogFactoryContext& context);

/**
* Read a filter definition from proto and instantiate an Instance. This method does not
* have access to listener properties, for example for access loggers of admin interface.
*/
static InstanceSharedPtr fromProto(const envoy::config::accesslog::v3::AccessLog& config,
Server::Configuration::CommonFactoryContext& context);
Server::Configuration::FactoryContext& context);

/**
* Template method to create an access log filter from proto configuration for non-HTTP access
Expand All @@ -283,7 +275,7 @@ class AccessLogFactory {
template <class Context>
static FilterBasePtr<Context>
accessLogFilterFromProto(const envoy::config::accesslog::v3::AccessLogFilter& config,
Server::Configuration::CommonFactoryContext& context) {
Server::Configuration::FactoryContext& context) {
if (!config.has_extension_filter()) {
ExceptionUtil::throwEnvoyException(
"Access log filter: only extension filter is supported by non-HTTP access loggers.");
Expand All @@ -301,7 +293,7 @@ class AccessLogFactory {
template <class Context>
static InstanceBaseSharedPtr<Context>
accessLoggerFromProto(const envoy::config::accesslog::v3::AccessLog& config,
Server::Configuration::CommonFactoryContext& context) {
Server::Configuration::FactoryContext& context) {
FilterBasePtr<Context> filter;
if (config.has_filter()) {
filter = accessLogFilterFromProto<Context>(config.filter(), context);
Expand Down
Loading

0 comments on commit d070ed7

Please sign in to comment.