From 9a0617085404d16bc1220e5ab57ca04a83092e32 Mon Sep 17 00:00:00 2001 From: johnlanni Date: Thu, 29 Jan 2026 14:31:12 +0800 Subject: [PATCH 1/4] fix(build): update build dependencies to adapt to envoy 1.36.4 - Comment out and remove deprecated extensions removed in Envoy 1.36 such as aws_iam, dynamic_ot, opencensus, wavm, squash, and trie_matcher - Update build targets to new paths and replace source/exe:envoy_common_lib with minimal_logger_lib and proper filter and server interfaces - Upgrade Bazel C++ standard from C++17 to C++20 for Linux and macOS builds - Change release binary script to require Ubuntu Bionic instead of Xenial - Replace absl endian conversions with platform-specific htobe32 and be32toh for metadata exchange filter - Adjust dependencies in extension BUILD files to use updated libraries and interfaces - Update Kafka broker and dlb contrib extension paths for compatibility --- BUILD | 4 ++-- .../extensions_build_config.bzl | 22 +++++++++---------- envoy.bazelrc | 6 +++-- extensions/common/BUILD | 5 ++++- scripts/release-binary.sh | 4 ++-- source/extensions/common/BUILD | 7 ++++-- source/extensions/filters/http/alpn/BUILD | 2 +- source/extensions/filters/http/authn/BUILD | 4 +++- .../network/forward_downstream_sni/BUILD | 7 ++++-- .../filters/network/metadata_exchange/BUILD | 2 +- .../metadata_exchange/metadata_exchange.cc | 10 ++++----- .../metadata_exchange_test.cc | 6 +++-- .../filters/network/sni_verifier/BUILD | 8 +++++-- .../filters/network/tcp_cluster_rewrite/BUILD | 7 ++++-- 14 files changed, 58 insertions(+), 36 deletions(-) diff --git a/BUILD b/BUILD index 43e4a1a7ebb..35f1e5a1735 100644 --- a/BUILD +++ b/BUILD @@ -37,7 +37,7 @@ envoy_cc_binary( deps = [ "//extensions/access_log_policy:access_log_policy_lib", "//extensions/metadata_exchange:metadata_exchange_lib", - "//extensions/stackdriver:stackdriver_plugin", + # "//extensions/stackdriver:stackdriver_plugin", "//source/extensions/common/workload_discovery:api_lib", # Experimental: WIP "//source/extensions/filters/http/alpn:config_lib", "//source/extensions/filters/http/authn:filter_lib", @@ -58,7 +58,7 @@ envoy_cc_binary( "@envoy//contrib/golang/router/cluster_specifier/source:config", "@envoy//contrib/mcp_sse_stateful_session/filters/http/source:config", "@envoy//contrib/mcp_sse_stateful_session/http/source:config", - "@envoy//source/common/http/match_delegate:config", + "@envoy//source/extensions/filters/http/match_delegate:config", "@envoy//source/exe:envoy_main_entry_lib", ], ) diff --git a/bazel/extension_config/extensions_build_config.bzl b/bazel/extension_config/extensions_build_config.bzl index 753b721370f..ec2af0f4afa 100644 --- a/bazel/extension_config/extensions_build_config.bzl +++ b/bazel/extension_config/extensions_build_config.bzl @@ -43,7 +43,7 @@ ENVOY_EXTENSIONS = { # "envoy.grpc_credentials.file_based_metadata": "//source/extensions/grpc_credentials/file_based_metadata:config", - "envoy.grpc_credentials.aws_iam": "//source/extensions/grpc_credentials/aws_iam:config", + # "envoy.grpc_credentials.aws_iam" removed in Envoy 1.36 # # WASM @@ -219,10 +219,10 @@ ENVOY_EXTENSIONS = { # Tracers # - "envoy.tracers.dynamic_ot": "//source/extensions/tracers/dynamic_ot:config", + # "envoy.tracers.dynamic_ot" removed in Envoy 1.36 "envoy.tracers.datadog": "//source/extensions/tracers/datadog:config", "envoy.tracers.zipkin": "//source/extensions/tracers/zipkin:config", - "envoy.tracers.opencensus": "//source/extensions/tracers/opencensus:config", + # "envoy.tracers.opencensus" removed in Envoy 1.36 "envoy.tracers.xray": "//source/extensions/tracers/xray:config", "envoy.tracers.skywalking": "//source/extensions/tracers/skywalking:config", "envoy.tracers.opentelemetry": "//source/extensions/tracers/opentelemetry:config", @@ -287,7 +287,7 @@ ENVOY_EXTENSIONS = { "envoy.wasm.runtime.null": "//source/extensions/wasm_runtime/null:config", "envoy.wasm.runtime.v8": "//source/extensions/wasm_runtime/v8:config", "envoy.wasm.runtime.wamr": "//source/extensions/wasm_runtime/wamr:config", - "envoy.wasm.runtime.wavm": "//source/extensions/wasm_runtime/wavm:config", + # "envoy.wasm.runtime.wavm" removed in Envoy 1.36 "envoy.wasm.runtime.wasmtime": "//source/extensions/wasm_runtime/wasmtime:config", # @@ -340,7 +340,7 @@ ENVOY_EXTENSIONS = { # QUIC extensions # - "envoy.quic.deterministic_connection_id_generator": "//source/extensions/quic/connection_id_generator:envoy_deterministic_connection_id_generator_config", + "envoy.quic.deterministic_connection_id_generator": "//source/extensions/quic/connection_id_generator/deterministic:envoy_deterministic_connection_id_generator_config", "envoy.quic.crypto_stream.server.quiche": "//source/extensions/quic/crypto_stream:envoy_quic_default_crypto_server_stream", "envoy.quic.proof_source.filter_chain": "//source/extensions/quic/proof_source:envoy_quic_default_proof_source", @@ -382,7 +382,7 @@ ENVOY_EXTENSIONS = { # Custom matchers # - "envoy.matching.custom_matchers.trie_matcher": "//source/extensions/common/matcher:trie_matcher_lib", + # "envoy.matching.custom_matchers.trie_matcher" removed in Envoy 1.36, use ip_range_matcher or domain_matcher instead # # Header Validators @@ -419,9 +419,9 @@ ENVOY_CONTRIB_EXTENSIONS = { # HTTP filters # - "envoy.filters.http.dynamo": "//contrib/dynamo/filters/http/dynamo:config", + "envoy.filters.http.dynamo": "//contrib/dynamo/filters/http/source:config", "envoy.filters.http.golang": "//contrib/golang/filters/http/source:config", - "envoy.filters.http.squash": "//contrib/squash/filters/http/source:config", + # "envoy.filters.http.squash" removed in Envoy 1.36 "envoy.filters.http.sxg": "//contrib/sxg/filters/http/source:config", # @@ -430,7 +430,7 @@ ENVOY_CONTRIB_EXTENSIONS = { "envoy.filters.network.client_ssl_auth": "//contrib/client_ssl_auth/filters/network/source:config", "envoy.filters.network.golang": "//contrib/golang/filters/network/source:config", - "envoy.filters.network.kafka_broker": "//contrib/kafka/filters/network/source:kafka_broker_config_lib", + "envoy.filters.network.kafka_broker": "//contrib/kafka/filters/network/source/broker:config_lib", "envoy.filters.network.kafka_mesh": "//contrib/kafka/filters/network/source/mesh:config_lib", "envoy.filters.network.mysql_proxy": "//contrib/mysql_proxy/filters/network/source:config", "envoy.filters.network.postgres_proxy": "//contrib/postgres_proxy/filters/network/source:config", @@ -462,7 +462,7 @@ ENVOY_CONTRIB_EXTENSIONS = { # Connection Balance extensions # - "envoy.network.connection_balance.dlb": "//contrib/network/connection_balance/dlb/source:connection_balancer", + "envoy.network.connection_balance.dlb": "//contrib/dlb/source:connection_balancer", } @@ -473,7 +473,7 @@ ISTIO_DISABLED_EXTENSIONS = [ # on istio 1.12 we enable all contrib extension for 0 migration pain. ISTIO_ENABLED_CONTRIB_EXTENSIONS = [ - "envoy.filters.http.squash", + # "envoy.filters.http.squash", # Removed in Envoy 1.36 "envoy.filters.http.sxg", "envoy.filters.network.kafka_broker", "envoy.filters.network.kafka_mesh", diff --git a/envoy.bazelrc b/envoy.bazelrc index 6b080508f38..6ca5a927bb0 100644 --- a/envoy.bazelrc +++ b/envoy.bazelrc @@ -10,6 +10,8 @@ # Startup options cannot be selected via config. startup --host_jvm_args=-Xmx3g +common --noenable_bzlmod + fetch --color=yes run --color=yes @@ -57,7 +59,7 @@ common --experimental_allow_tags_propagation # (Workaround for https://github.com/bazelbuild/rules_foreign_cc/issues/421) build:linux --copt=-fPIC build:linux --copt=-Wno-deprecated-declarations -build:linux --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 +build:linux --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 build:linux --conlyopt=-fexceptions build:linux --fission=dbg,opt build:linux --features=per_object_debug_info @@ -117,7 +119,7 @@ build:clang-asan --linkopt --rtlib=compiler-rt build:clang-asan --linkopt --unwindlib=libgcc # macOS -build:macos --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 +build:macos --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 build:macos --action_env=PATH=/opt/homebrew/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin build:macos --host_action_env=PATH=/opt/homebrew/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin build:macos --define tcmalloc=disabled diff --git a/extensions/common/BUILD b/extensions/common/BUILD index 5533164bd7f..296cdbbfbf6 100644 --- a/extensions/common/BUILD +++ b/extensions/common/BUILD @@ -182,6 +182,9 @@ envoy_cc_library( ], repository = "@envoy", visibility = ["//visibility:public"], + deps = [ + "@com_google_absl//absl/strings", + ], ) envoy_cc_library( @@ -193,7 +196,7 @@ envoy_cc_library( deps = [ ":node_info_fb_cc", "@envoy//envoy/network:filter_interface", - "@envoy//source/exe:envoy_common_lib", + "@envoy//source/common/common:minimal_logger_lib", ], ) diff --git a/scripts/release-binary.sh b/scripts/release-binary.sh index 326d3abea47..32b0398a2cd 100755 --- a/scripts/release-binary.sh +++ b/scripts/release-binary.sh @@ -83,11 +83,11 @@ if [ "${DST}" == "none" ]; then DST="" fi -# Make sure the release binaries are built on x86_64 Ubuntu 16.04 (Xenial) +# Make sure the release binaries are built on x86_64 Ubuntu 18.04 (Bionic) if [ "${CHECK}" -eq 1 ] ; then if [[ "${BAZEL_BUILD_ARGS}" != *"--config=remote-"* ]]; then UBUNTU_RELEASE=${UBUNTU_RELEASE:-$(lsb_release -c -s)} - [[ "${UBUNTU_RELEASE}" == 'xenial' ]] || { echo 'Must run on Ubuntu 16.04 (Xenial).'; exit 1; } + [[ "${UBUNTU_RELEASE}" == 'bionic' ]] || { echo 'Must run on Ubuntu Bionic.'; exit 1; } fi [[ "$(uname -m)" == 'x86_64' ]] || { echo 'Must run on x86_64.'; exit 1; } fi diff --git a/source/extensions/common/BUILD b/source/extensions/common/BUILD index d26e122b839..b7ae4c10d39 100644 --- a/source/extensions/common/BUILD +++ b/source/extensions/common/BUILD @@ -36,7 +36,8 @@ envoy_cc_library( ":utils_lib", "//src/istio/authn:context_proto_cc_proto", "//src/istio/utils:attribute_names_lib", - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/http:filter_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) @@ -52,7 +53,9 @@ envoy_cc_library( repository = "@envoy", visibility = ["//visibility:public"], deps = [ - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/network:connection_interface", + "@envoy//envoy/ssl:connection_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) diff --git a/source/extensions/filters/http/alpn/BUILD b/source/extensions/filters/http/alpn/BUILD index 59354fa0003..32660be2282 100644 --- a/source/extensions/filters/http/alpn/BUILD +++ b/source/extensions/filters/http/alpn/BUILD @@ -47,7 +47,7 @@ envoy_cc_library( ":alpn_filter", "//source/extensions/common:filter_names_lib", "@envoy//envoy/registry", - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/server:filter_config_interface", "@envoy//source/extensions/filters/http/common:factory_base_lib", ], ) diff --git a/source/extensions/filters/http/authn/BUILD b/source/extensions/filters/http/authn/BUILD index 1c8d9a365dc..b717dad2f0f 100644 --- a/source/extensions/filters/http/authn/BUILD +++ b/source/extensions/filters/http/authn/BUILD @@ -69,7 +69,9 @@ envoy_cc_library( "//source/extensions/common:filter_names_lib", "//source/extensions/common:utils_lib", "//src/istio/authn:context_proto_cc_proto", - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/http:filter_interface", + "@envoy//envoy/server:filter_config_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) diff --git a/source/extensions/filters/network/forward_downstream_sni/BUILD b/source/extensions/filters/network/forward_downstream_sni/BUILD index 12a4d7aef66..c823b6faa09 100644 --- a/source/extensions/filters/network/forward_downstream_sni/BUILD +++ b/source/extensions/filters/network/forward_downstream_sni/BUILD @@ -30,7 +30,9 @@ envoy_cc_library( deps = [ ":config_cc_proto", ":forward_downstream_sni_lib", - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/network:filter_interface", + "@envoy//envoy/server:filter_config_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) @@ -40,7 +42,8 @@ envoy_cc_library( hdrs = ["forward_downstream_sni.h"], repository = "@envoy", deps = [ - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/network:filter_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) diff --git a/source/extensions/filters/network/metadata_exchange/BUILD b/source/extensions/filters/network/metadata_exchange/BUILD index 7b788545647..fbf3fbf8547 100644 --- a/source/extensions/filters/network/metadata_exchange/BUILD +++ b/source/extensions/filters/network/metadata_exchange/BUILD @@ -42,8 +42,8 @@ envoy_cc_library( "//extensions/common:proto_util", "//source/extensions/filters/network/metadata_exchange/config:metadata_exchange_cc_proto", "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:endian", "@com_google_absl//absl/strings", + "@envoy//envoy/common:base_includes", "@envoy//envoy/local_info:local_info_interface", "@envoy//envoy/network:connection_interface", "@envoy//envoy/network:filter_interface", diff --git a/source/extensions/filters/network/metadata_exchange/metadata_exchange.cc b/source/extensions/filters/network/metadata_exchange/metadata_exchange.cc index a660bb1f356..e4e7a109c1e 100644 --- a/source/extensions/filters/network/metadata_exchange/metadata_exchange.cc +++ b/source/extensions/filters/network/metadata_exchange/metadata_exchange.cc @@ -18,7 +18,7 @@ #include #include -#include "absl/base/internal/endian.h" +#include "envoy/common/platform.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" #include "envoy/network/connection.h" @@ -38,8 +38,8 @@ constructProxyHeaderData(const Envoy::ProtobufWkt::Any& proxy_data) { std::string proxy_data_str = proxy_data.SerializeAsString(); // Converting from host to network byte order so that most significant byte is // placed first. - initial_header.magic = absl::ghtonl(MetadataExchangeInitialHeader::magic_number); - initial_header.data_size = absl::ghtonl(proxy_data_str.length()); + initial_header.magic = htobe32(MetadataExchangeInitialHeader::magic_number); + initial_header.data_size = htobe32(proxy_data_str.length()); ::Envoy::Buffer::OwnedImpl initial_header_buffer{absl::string_view( reinterpret_cast(&initial_header), sizeof(MetadataExchangeInitialHeader))}; @@ -219,7 +219,7 @@ void MetadataExchangeFilter::tryReadInitialProxyHeader(Buffer::Instance& data) { } MetadataExchangeInitialHeader initial_header; data.copyOut(0, initial_header_length, &initial_header); - if (absl::gntohl(initial_header.magic) != MetadataExchangeInitialHeader::magic_number) { + if (be32toh(initial_header.magic) != MetadataExchangeInitialHeader::magic_number) { config_->stats().initial_header_not_found_.inc(); setMetadataNotFoundFilterState(); ENVOY_LOG(warn, "Incorrect istio-peer-exchange ALPN magic. Peer missing TCP " @@ -227,7 +227,7 @@ void MetadataExchangeFilter::tryReadInitialProxyHeader(Buffer::Instance& data) { conn_state_ = Invalid; return; } - proxy_data_length_ = absl::gntohl(initial_header.data_size); + proxy_data_length_ = be32toh(initial_header.data_size); // Drain the initial header length bytes read. data.drain(initial_header_length); conn_state_ = ReadingProxyHeader; diff --git a/source/extensions/filters/network/metadata_exchange/metadata_exchange_test.cc b/source/extensions/filters/network/metadata_exchange/metadata_exchange_test.cc index 7925570305b..9906ff0173c 100644 --- a/source/extensions/filters/network/metadata_exchange/metadata_exchange_test.cc +++ b/source/extensions/filters/network/metadata_exchange/metadata_exchange_test.cc @@ -15,6 +15,8 @@ #include "source/extensions/filters/network/metadata_exchange/metadata_exchange.h" +#include "envoy/common/platform.h" + #include "gmock/gmock.h" #include "google/protobuf/util/message_differencer.h" #include "gtest/gtest.h" @@ -42,8 +44,8 @@ void ConstructProxyHeaderData(::Envoy::Buffer::OwnedImpl& serialized_header, MetadataExchangeInitialHeader* initial_header) { std::string serialized_proxy_header = proxy_header.SerializeAsString(); memset(initial_header, 0, sizeof(MetadataExchangeInitialHeader)); - initial_header->magic = absl::ghtonl(MetadataExchangeInitialHeader::magic_number); - initial_header->data_size = absl::ghtonl(serialized_proxy_header.length()); + initial_header->magic = htobe32(MetadataExchangeInitialHeader::magic_number); + initial_header->data_size = htobe32(serialized_proxy_header.length()); serialized_header.add(::Envoy::Buffer::OwnedImpl{absl::string_view( reinterpret_cast(initial_header), sizeof(MetadataExchangeInitialHeader))}); serialized_header.add(::Envoy::Buffer::OwnedImpl{serialized_proxy_header}); diff --git a/source/extensions/filters/network/sni_verifier/BUILD b/source/extensions/filters/network/sni_verifier/BUILD index ba4fff0e89d..d6380b6fcf7 100644 --- a/source/extensions/filters/network/sni_verifier/BUILD +++ b/source/extensions/filters/network/sni_verifier/BUILD @@ -30,7 +30,9 @@ envoy_cc_library( deps = [ ":config_cc_proto", ":sni_verifier_lib", - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/network:filter_interface", + "@envoy//envoy/server:filter_config_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) @@ -41,7 +43,9 @@ envoy_cc_library( external_deps = ["ssl"], repository = "@envoy", deps = [ - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/network:filter_interface", + "@envoy//envoy/stats:stats_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) diff --git a/source/extensions/filters/network/tcp_cluster_rewrite/BUILD b/source/extensions/filters/network/tcp_cluster_rewrite/BUILD index d9bc3c0e08e..df134ba1eaf 100644 --- a/source/extensions/filters/network/tcp_cluster_rewrite/BUILD +++ b/source/extensions/filters/network/tcp_cluster_rewrite/BUILD @@ -30,7 +30,8 @@ envoy_cc_library( repository = "@envoy", deps = [ "//external:tcp_cluster_rewrite_config_cc_proto", - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/network:filter_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) @@ -42,7 +43,9 @@ envoy_cc_library( deps = [ ":tcp_cluster_rewrite_lib", "//external:tcp_cluster_rewrite_config_cc_proto", - "@envoy//source/exe:envoy_common_lib", + "@envoy//envoy/network:filter_interface", + "@envoy//envoy/server:filter_config_interface", + "@envoy//source/common/common:minimal_logger_lib", ], ) From 1b6adde1dc0670241561ae1b29fe17f0e7bfe1bf Mon Sep 17 00:00:00 2001 From: johnlanni Date: Thu, 29 Jan 2026 14:52:40 +0800 Subject: [PATCH 2/4] fix(build): add connection_interface dependencies to network filters - Add connection_interface dependency to forward_downstream_sni filter BUILD file - Include connection_interface and buffer_interface in sni_verifier filter dependencies - Add connection_interface to tcp_cluster_rewrite filter dependencies in two BUILD targets - Update common extension BUILD to include hashable_interface, connection_interface, and filter_state_interface dependencies - Ensure proper declaration of interface dependencies across network filter extensions --- extensions/common/BUILD | 3 +++ source/extensions/filters/network/forward_downstream_sni/BUILD | 1 + source/extensions/filters/network/sni_verifier/BUILD | 2 ++ source/extensions/filters/network/tcp_cluster_rewrite/BUILD | 2 ++ 4 files changed, 8 insertions(+) diff --git a/extensions/common/BUILD b/extensions/common/BUILD index 296cdbbfbf6..163e0a666a5 100644 --- a/extensions/common/BUILD +++ b/extensions/common/BUILD @@ -195,7 +195,10 @@ envoy_cc_library( visibility = ["//visibility:public"], deps = [ ":node_info_fb_cc", + "@envoy//envoy/common:hashable_interface", "@envoy//envoy/network:filter_interface", + "@envoy//envoy/ssl:connection_interface", + "@envoy//envoy/stream_info:filter_state_interface", "@envoy//source/common/common:minimal_logger_lib", ], ) diff --git a/source/extensions/filters/network/forward_downstream_sni/BUILD b/source/extensions/filters/network/forward_downstream_sni/BUILD index c823b6faa09..69bb21bee79 100644 --- a/source/extensions/filters/network/forward_downstream_sni/BUILD +++ b/source/extensions/filters/network/forward_downstream_sni/BUILD @@ -42,6 +42,7 @@ envoy_cc_library( hdrs = ["forward_downstream_sni.h"], repository = "@envoy", deps = [ + "@envoy//envoy/network:connection_interface", "@envoy//envoy/network:filter_interface", "@envoy//source/common/common:minimal_logger_lib", ], diff --git a/source/extensions/filters/network/sni_verifier/BUILD b/source/extensions/filters/network/sni_verifier/BUILD index d6380b6fcf7..45a4c82be83 100644 --- a/source/extensions/filters/network/sni_verifier/BUILD +++ b/source/extensions/filters/network/sni_verifier/BUILD @@ -43,6 +43,8 @@ envoy_cc_library( external_deps = ["ssl"], repository = "@envoy", deps = [ + "@envoy//envoy/buffer:buffer_interface", + "@envoy//envoy/network:connection_interface", "@envoy//envoy/network:filter_interface", "@envoy//envoy/stats:stats_interface", "@envoy//source/common/common:minimal_logger_lib", diff --git a/source/extensions/filters/network/tcp_cluster_rewrite/BUILD b/source/extensions/filters/network/tcp_cluster_rewrite/BUILD index df134ba1eaf..b398cd9e4e9 100644 --- a/source/extensions/filters/network/tcp_cluster_rewrite/BUILD +++ b/source/extensions/filters/network/tcp_cluster_rewrite/BUILD @@ -30,6 +30,7 @@ envoy_cc_library( repository = "@envoy", deps = [ "//external:tcp_cluster_rewrite_config_cc_proto", + "@envoy//envoy/network:connection_interface", "@envoy//envoy/network:filter_interface", "@envoy//source/common/common:minimal_logger_lib", ], @@ -43,6 +44,7 @@ envoy_cc_library( deps = [ ":tcp_cluster_rewrite_lib", "//external:tcp_cluster_rewrite_config_cc_proto", + "@envoy//envoy/network:connection_interface", "@envoy//envoy/network:filter_interface", "@envoy//envoy/server:filter_config_interface", "@envoy//source/common/common:minimal_logger_lib", From e65c7a44a0caae3acb0983143454126e96359b25 Mon Sep 17 00:00:00 2001 From: johnlanni Date: Thu, 29 Jan 2026 16:08:54 +0800 Subject: [PATCH 3/4] fix(build): update protobuf usage and adopt absl::StatusOr in filter factories - Replace ProtobufWkt::Struct with ::google::protobuf::Struct across multiple components - Modify filter factory methods to return absl::StatusOr for better error handling - Update metadata exchange and authentication filters to use google::protobuf types consistently - Adjust Istio Stats filter to access server factory context properly - Enhance tcp and network filter configurations with consistent absl::StatusOr return types - Refactor expression handling in Istio Stats filter for improved CEL expression creation and evaluation - Fix log message parameter casting for authentication binding errors - Add missing base64_lib and http utility dependencies in build files - Use standardized key strings for filter state data storage in network listener filters --- source/extensions/common/BUILD | 1 + source/extensions/common/authn.cc | 2 +- source/extensions/common/authn.h | 2 +- .../common/workload_discovery/api.cc | 14 +++- source/extensions/filters/http/alpn/config.cc | 4 +- source/extensions/filters/http/alpn/config.h | 2 +- source/extensions/filters/http/authn/BUILD | 3 + .../filters/http/authn/authn_utils.cc | 2 - .../filters/http/authn/filter_context.cc | 2 +- .../filters/http/authn/http_filter.cc | 2 +- .../filters/http/authn/http_filter_factory.cc | 2 +- .../filters/http/authn/http_filter_test.cc | 4 +- .../filters/http/connect_authority/filter.h | 2 +- .../filters/http/istio_stats/istio_stats.cc | 70 ++++++++++--------- .../filters/http/peer_metadata/filter.cc | 6 +- .../set_internal_dst_address/filter.cc | 8 +-- .../network/forward_downstream_sni/BUILD | 1 + .../network/forward_downstream_sni/config.cc | 2 +- .../network/forward_downstream_sni/config.h | 2 +- .../network/metadata_exchange/config.cc | 6 +- .../network/metadata_exchange/config.h | 2 +- .../metadata_exchange/metadata_exchange.cc | 18 ++--- .../metadata_exchange/metadata_exchange.h | 2 +- .../metadata_exchange_test.cc | 8 +-- .../filters/network/sni_verifier/config.cc | 2 +- .../filters/network/sni_verifier/config.h | 2 +- .../filters/network/tcp_cluster_rewrite/BUILD | 1 + .../network/tcp_cluster_rewrite/config.cc | 2 +- .../network/tcp_cluster_rewrite/config.h | 2 +- 29 files changed, 97 insertions(+), 79 deletions(-) diff --git a/source/extensions/common/BUILD b/source/extensions/common/BUILD index b7ae4c10d39..3742cb8fd36 100644 --- a/source/extensions/common/BUILD +++ b/source/extensions/common/BUILD @@ -37,6 +37,7 @@ envoy_cc_library( "//src/istio/authn:context_proto_cc_proto", "//src/istio/utils:attribute_names_lib", "@envoy//envoy/http:filter_interface", + "@envoy//source/common/common:base64_lib", "@envoy//source/common/common:minimal_logger_lib", ], ) diff --git a/source/extensions/common/authn.cc b/source/extensions/common/authn.cc index 51660fdce88..9e65b1efb35 100644 --- a/source/extensions/common/authn.cc +++ b/source/extensions/common/authn.cc @@ -72,7 +72,7 @@ void Authentication::SaveAuthAttributesToStruct(const istio::authn::Result& resu } } -const ProtobufWkt::Struct* +const ::google::protobuf::Struct* Authentication::GetResultFromMetadata(const envoy::config::core::v3::Metadata& metadata) { const auto& iter = metadata.filter_metadata().find(Utils::IstioFilterName::kAuthentication); if (iter == metadata.filter_metadata().end()) { diff --git a/source/extensions/common/authn.h b/source/extensions/common/authn.h index 5333f30b93e..4f213a64de0 100644 --- a/source/extensions/common/authn.h +++ b/source/extensions/common/authn.h @@ -32,7 +32,7 @@ class Authentication : public Logger::Loggable { // the input metadata is the request info's dynamic metadata. Authentication // result, if available, is stored under authentication filter metdata. // Returns nullptr if there is no data for that filter. - static const ProtobufWkt::Struct* + static const ::google::protobuf::Struct* GetResultFromMetadata(const envoy::config::core::v3::Metadata& metadata); }; diff --git a/source/extensions/common/workload_discovery/api.cc b/source/extensions/common/workload_discovery/api.cc index 36929e17cc9..cf58d75f1f2 100644 --- a/source/extensions/common/workload_discovery/api.cc +++ b/source/extensions/common/workload_discovery/api.cc @@ -120,17 +120,19 @@ class WorkloadMetadataProviderImpl : public WorkloadMetadataProvider, public Sin : Config::SubscriptionBase( parent.factory_context_.messageValidationVisitor(), "uid"), parent_(parent) { - subscription_ = parent.factory_context_.clusterManager() + auto subscription_or_error = parent.factory_context_.clusterManager() .subscriptionFactory() .subscriptionFromConfigSource( parent.config_source_, Grpc::Common::typeUrl(getResourceName()), *parent.scope_, *this, resource_decoder_, {}); + THROW_IF_NOT_OK(subscription_or_error.status()); + subscription_ = std::move(subscription_or_error.value()); } void start() { subscription_->start({}); } private: // Config::SubscriptionCallbacks - void onConfigUpdate(const std::vector& resources, + absl::Status onConfigUpdate(const std::vector& resources, const std::string&) override { AddressIndexSharedPtr index = std::make_shared(); for (const auto& resource : resources) { @@ -143,8 +145,9 @@ class WorkloadMetadataProviderImpl : public WorkloadMetadataProvider, public Sin } } parent_.reset(index); + return absl::OkStatus(); } - void onConfigUpdate(const std::vector& added_resources, + absl::Status onConfigUpdate(const std::vector& added_resources, const Protobuf::RepeatedPtrField& removed_resources, const std::string&) override { AddressIndexSharedPtr added = std::make_shared(); @@ -163,6 +166,7 @@ class WorkloadMetadataProviderImpl : public WorkloadMetadataProvider, public Sin removed->push_back(resource); } parent_.update(added, removed); + return absl::OkStatus(); } void onConfigUpdateFailed(Config::ConfigUpdateFailureReason, const EnvoyException*) override { // Do nothing - feature is automatically disabled. @@ -211,6 +215,10 @@ class WorkloadDiscoveryExtension : public Server::BootstrapExtension { factory_context_); }); } + + void onWorkerThreadInitialized() override { + // No per-worker initialization needed + } private: Server::Configuration::ServerFactoryContext& factory_context_; diff --git a/source/extensions/filters/http/alpn/config.cc b/source/extensions/filters/http/alpn/config.cc index 8bceff018cb..6b823e577a8 100644 --- a/source/extensions/filters/http/alpn/config.cc +++ b/source/extensions/filters/http/alpn/config.cc @@ -24,10 +24,10 @@ using istio::envoy::config::filter::http::alpn::v2alpha1::FilterConfig; namespace Envoy { namespace Http { namespace Alpn { -Http::FilterFactoryCb +absl::StatusOr AlpnConfigFactory::createFilterFactoryFromProto(const Protobuf::Message& config, const std::string&, Server::Configuration::FactoryContext& context) { - return createFilterFactory(dynamic_cast(config), context.clusterManager()); + return createFilterFactory(dynamic_cast(config), context.serverFactoryContext().clusterManager()); } ProtobufTypes::MessagePtr AlpnConfigFactory::createEmptyConfigProto() { diff --git a/source/extensions/filters/http/alpn/config.h b/source/extensions/filters/http/alpn/config.h index fedfc70c7cb..8e8189efe7e 100644 --- a/source/extensions/filters/http/alpn/config.h +++ b/source/extensions/filters/http/alpn/config.h @@ -28,7 +28,7 @@ namespace Alpn { class AlpnConfigFactory : public Server::Configuration::NamedHttpFilterConfigFactory { public: // Server::Configuration::NamedHttpFilterConfigFactory - Http::FilterFactoryCb + absl::StatusOr createFilterFactoryFromProto(const Protobuf::Message& config, const std::string& stat_prefix, Server::Configuration::FactoryContext& context) override; ProtobufTypes::MessagePtr createEmptyConfigProto() override; diff --git a/source/extensions/filters/http/authn/BUILD b/source/extensions/filters/http/authn/BUILD index b717dad2f0f..8b686335f3a 100644 --- a/source/extensions/filters/http/authn/BUILD +++ b/source/extensions/filters/http/authn/BUILD @@ -47,7 +47,9 @@ envoy_cc_library( "//source/extensions/common:filter_names_lib", "//source/extensions/common:utils_lib", "//src/istio/authn:context_proto_cc_proto", + "@envoy//source/common/config:metadata_lib", "@envoy//source/common/http:headers_lib", + "@envoy//source/common/http:utility_lib", "@envoy//source/extensions/filters/http:well_known_names", ], ) @@ -72,6 +74,7 @@ envoy_cc_library( "@envoy//envoy/http:filter_interface", "@envoy//envoy/server:filter_config_interface", "@envoy//source/common/common:minimal_logger_lib", + "@envoy//source/common/http:utility_lib", ], ) diff --git a/source/extensions/filters/http/authn/authn_utils.cc b/source/extensions/filters/http/authn/authn_utils.cc index 5566e18278a..8e138763726 100644 --- a/source/extensions/filters/http/authn/authn_utils.cc +++ b/source/extensions/filters/http/authn/authn_utils.cc @@ -29,8 +29,6 @@ namespace AuthN { namespace { // The JWT audience key name static const std::string kJwtAudienceKey = "aud"; -// The JWT issuer key name -static const std::string kJwtIssuerKey = "iss"; // The key name for the original claims in an exchanged token static const std::string kExchangedTokenOriginalPayload = "original_claims"; diff --git a/source/extensions/filters/http/authn/filter_context.cc b/source/extensions/filters/http/authn/filter_context.cc index 82268d5e4a0..17937966b42 100644 --- a/source/extensions/filters/http/authn/filter_context.cc +++ b/source/extensions/filters/http/authn/filter_context.cc @@ -67,7 +67,7 @@ void FilterContext::setPrincipal(const iaapi::PrincipalBinding& binding) { return; default: // Should never come here. - ENVOY_LOG(error, "Invalid binding value {}", binding); + ENVOY_LOG(error, "Invalid binding value {}", static_cast(binding)); return; } } diff --git a/source/extensions/filters/http/authn/http_filter.cc b/source/extensions/filters/http/authn/http_filter.cc index dbbc037d22f..09ed0b0234e 100644 --- a/source/extensions/filters/http/authn/http_filter.cc +++ b/source/extensions/filters/http/authn/http_filter.cc @@ -78,7 +78,7 @@ FilterHeadersStatus AuthenticationFilter::decodeHeaders(RequestHeaderMap& header if (filter_context_ != nullptr) { // Save auth results in the metadata, could be used later by RBAC and/or // mixer filter. - ProtobufWkt::Struct data; + ::google::protobuf::Struct data; Utils::Authentication::SaveAuthAttributesToStruct(filter_context_->authenticationResult(), data); decoder_callbacks_->streamInfo().setDynamicMetadata(Utils::IstioFilterName::kAuthentication, diff --git a/source/extensions/filters/http/authn/http_filter_factory.cc b/source/extensions/filters/http/authn/http_filter_factory.cc index b024f46cab4..0c5a7fd018f 100644 --- a/source/extensions/filters/http/authn/http_filter_factory.cc +++ b/source/extensions/filters/http/authn/http_filter_factory.cc @@ -32,7 +32,7 @@ namespace iaapi = istio::authentication::v1alpha1; class AuthnFilterConfig : public NamedHttpFilterConfigFactory, public Logger::Loggable { public: - Http::FilterFactoryCb createFilterFactoryFromProto(const Protobuf::Message& proto_config, + absl::StatusOr createFilterFactoryFromProto(const Protobuf::Message& proto_config, const std::string&, FactoryContext&) override { auto filter_config = dynamic_cast(proto_config); return createFilterFactory(filter_config); diff --git a/source/extensions/filters/http/authn/http_filter_test.cc b/source/extensions/filters/http/authn/http_filter_test.cc index bf0912d2723..2e36ab050d1 100644 --- a/source/extensions/filters/http/authn/http_filter_test.cc +++ b/source/extensions/filters/http/authn/http_filter_test.cc @@ -172,7 +172,7 @@ TEST_F(AuthenticationFilterTest, AllPass) { const auto* data = Utils::Authentication::GetResultFromMetadata(stream_info.dynamicMetadata()); ASSERT_TRUE(data); - ProtobufWkt::Struct expected_data; + ::google::protobuf::Struct expected_data; ASSERT_TRUE(Protobuf::TextFormat::ParseFromString(R"( fields { key: "source.namespace" @@ -237,7 +237,7 @@ TEST_F(AuthenticationFilterTest, IgnoreBothPass) { const auto* data = Utils::Authentication::GetResultFromMetadata(stream_info.dynamicMetadata()); ASSERT_TRUE(data); - ProtobufWkt::Struct expected_data; + ::google::protobuf::Struct expected_data; ASSERT_TRUE(Protobuf::TextFormat::ParseFromString(R"( fields { key: "source.namespace" diff --git a/source/extensions/filters/http/connect_authority/filter.h b/source/extensions/filters/http/connect_authority/filter.h index e7ebe8aba2c..536d6c9cef9 100644 --- a/source/extensions/filters/http/connect_authority/filter.h +++ b/source/extensions/filters/http/connect_authority/filter.h @@ -56,7 +56,7 @@ class FilterConfigFactory : public Common::FactoryBase createRouteSpecificFilterConfigTyped(const io::istio::http::connect_authority::Config& config, Envoy::Server::Configuration::ServerFactoryContext&, ProtobufMessage::ValidationVisitor&) override { diff --git a/source/extensions/filters/http/istio_stats/istio_stats.cc b/source/extensions/filters/http/istio_stats/istio_stats.cc index aacdbde70ce..a70a7e0dae1 100644 --- a/source/extensions/filters/http/istio_stats/istio_stats.cc +++ b/source/extensions/filters/http/istio_stats/istio_stats.cc @@ -19,10 +19,21 @@ #include "envoy/registry/registry.h" #include "envoy/server/factory_context.h" #include "envoy/singleton/manager.h" + +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + #include "eval/public/builtin_func_registrar.h" #include "eval/public/cel_expr_builder_factory.h" -#include "extensions/common/metadata_object.h" #include "parser/parser.h" + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + +#include "extensions/common/metadata_object.h" #include "source/common/grpc/common.h" #include "source/common/http/header_map_impl.h" #include "source/common/http/header_utility.h" @@ -44,7 +55,7 @@ namespace IstioStats { namespace { constexpr absl::string_view CustomStatNamespace = "istiocustom"; -absl::string_view extractString(const ProtobufWkt::Struct& metadata, const std::string& key) { +absl::string_view extractString(const ::google::protobuf::Struct& metadata, const std::string& key) { const auto& it = metadata.fields().find(key); if (it == metadata.fields().end()) { return {}; @@ -52,7 +63,7 @@ absl::string_view extractString(const ProtobufWkt::Struct& metadata, const std:: return it->second.string_value(); } -absl::string_view extractMapString(const ProtobufWkt::Struct& metadata, const std::string& map_key, +absl::string_view extractMapString(const ::google::protobuf::Struct& metadata, const std::string& map_key, const std::string& key) { const auto& it = metadata.fields().find(map_key); if (it == metadata.fields().end()) { @@ -359,26 +370,20 @@ struct MetricOverrides : public Logger::Loggable { return {}; } if (expr_builder_ == nullptr) { - google::api::expr::runtime::InterpreterOptions options; - expr_builder_ = google::api::expr::runtime::CreateCelExpressionBuilder(options); - auto register_status = google::api::expr::runtime::RegisterBuiltinFunctions( - expr_builder_->GetRegistry(), options); - if (!register_status.ok()) { - throw Extensions::Filters::Common::Expr::CelException( - absl::StrCat("failed to register built-in functions: ", register_status.message())); - } + expr_builder_ = Extensions::Filters::Common::Expr::createBuilder(nullptr); } - parsed_exprs_.push_back(parse_status.value().expr()); - compiled_exprs_.push_back(std::make_pair( - Extensions::Filters::Common::Expr::createExpression(*expr_builder_, parsed_exprs_.back()), - int_expr)); + auto create_status = Extensions::Filters::Common::Expr::CompiledExpression::Create( + expr_builder_, parse_status.value().expr()); + if (!create_status.ok()) { + return {}; + } + compiled_exprs_.push_back(std::make_pair(std::move(create_status.value()), int_expr)); uint32_t id = compiled_exprs_.size() - 1; expression_ids_.emplace(expr, id); return {id}; } - Filters::Common::Expr::BuilderPtr expr_builder_; - std::vector parsed_exprs_; - std::vector> compiled_exprs_; + Filters::Common::Expr::BuilderInstanceSharedPtr expr_builder_; + std::vector> compiled_exprs_; absl::flat_hash_map expression_ids_; }; @@ -408,7 +413,7 @@ class RotatingScope : public Logger::Loggable { if (rotate_interval_ms_ > 0) { ASSERT(delete_interval_ms_ < rotate_interval_ms_); ASSERT(delete_interval_ms_ >= 1000); - Event::Dispatcher& dispatcher = factory_context.mainThreadDispatcher(); + Event::Dispatcher& dispatcher = factory_context.serverFactoryContext().mainThreadDispatcher(); rotate_timer_ = dispatcher.createTimer([this] { onRotate(); }); delete_timer_ = dispatcher.createTimer([this] { onDelete(); }); rotate_timer_->enableTimer(std::chrono::milliseconds(rotate_interval_ms_)); @@ -452,11 +457,11 @@ class RotatingScope : public Logger::Loggable { struct Config : public Logger::Loggable { Config(const stats::PluginConfig& proto_config, Server::Configuration::FactoryContext& factory_context) - : context_(factory_context.singletonManager().getTyped( + : context_(factory_context.serverFactoryContext().singletonManager().getTyped( SINGLETON_MANAGER_REGISTERED_NAME(Context), [&factory_context] { - return std::make_shared(factory_context.serverScope().symbolTable(), - factory_context.localInfo().node()); + return std::make_shared(factory_context.serverFactoryContext().serverScope().symbolTable(), + factory_context.serverFactoryContext().localInfo().node()); })), scope_(factory_context, PROTOBUF_GET_MS_OR_DEFAULT(proto_config, rotation_interval, 0), PROTOBUF_GET_MS_OR_DEFAULT(proto_config, graceful_deletion_interval, @@ -467,7 +472,7 @@ struct Config : public Logger::Loggable { reporter_ = Reporter::ClientSidecar; switch (proto_config.reporter()) { case stats::Reporter::UNSPECIFIED: - switch (factory_context.direction()) { + switch (factory_context.listenerInfo().direction()) { case envoy::config::core::v3::TrafficDirection::INBOUND: reporter_ = Reporter::ServerSidecar; break; @@ -617,7 +622,7 @@ struct Config : public Logger::Loggable { expr_values_.reserve(compiled_exprs.size()); for (size_t id = 0; id < compiled_exprs.size(); id++) { Protobuf::Arena arena; - auto eval_status = compiled_exprs[id].first->Evaluate(*this, &arena); + auto eval_status = compiled_exprs[id].first.evaluate(*this, &arena); if (!eval_status.ok() || eval_status.value().IsError()) { expr_values_.push_back(std::make_pair(parent_.context_->unknown_, 0)); } else { @@ -783,10 +788,7 @@ class IstioStatsFilter : public Http::PassThroughFilter, } // AccessLog::Instance - void log(const Http::RequestHeaderMap* request_headers, - const Http::ResponseHeaderMap* response_headers, - const Http::ResponseTrailerMap* response_trailers, const StreamInfo::StreamInfo& info, - AccessLog::AccessLogType) override { + void log(const AccessLog::LogContext& context, const StreamInfo::StreamInfo& info) override { reportHelper(true); if (is_grpc_) { tags_.push_back({context_.request_protocol_, context_.grpc_}); @@ -799,9 +801,9 @@ class IstioStatsFilter : public Http::PassThroughFilter, {context_.response_code_, pool_.add(absl::StrCat(info.responseCode().value_or(0)))}); if (is_grpc_) { auto const& optional_status = Grpc::Common::getGrpcStatus( - response_trailers ? *response_trailers + context.hasResponseTrailers() ? context.responseTrailers() : *Http::StaticEmptyHeaders::get().response_trailers, - response_headers ? *response_headers : *Http::StaticEmptyHeaders::get().response_headers, + context.hasResponseHeaders() ? context.responseHeaders() : *Http::StaticEmptyHeaders::get().response_headers, info); tags_.push_back( {context_.grpc_response_status_, @@ -811,6 +813,10 @@ class IstioStatsFilter : public Http::PassThroughFilter, } populateFlagsAndConnectionSecurity(info); + const Http::RequestHeaderMap* request_headers = context.hasRequestHeaders() ? &context.requestHeaders() : nullptr; + const Http::ResponseHeaderMap* response_headers = context.hasResponseHeaders() ? &context.responseHeaders() : nullptr; + const Http::ResponseTrailerMap* response_trailers = context.hasResponseTrailers() ? &context.responseTrailers() : nullptr; + Config::StreamOverrides stream(*config_, pool_, info, request_headers, response_headers, response_trailers); stream.addCounter(context_.requests_total_, tags_); @@ -1201,7 +1207,7 @@ class IstioStatsFilter : public Http::PassThroughFilter, Http::FilterFactoryCb IstioStatsFilterConfigFactory::createFilterFactoryFromProtoTyped( const stats::PluginConfig& proto_config, const std::string&, Server::Configuration::FactoryContext& factory_context) { - factory_context.api().customStatNamespaces().registerStatNamespace(CustomStatNamespace); + factory_context.serverFactoryContext().api().customStatNamespaces().registerStatNamespace(CustomStatNamespace); ConfigSharedPtr config = std::make_shared(proto_config, factory_context); config->recordVersion(); return [config](Http::FilterChainFactoryCallbacks& callbacks) { @@ -1219,7 +1225,7 @@ REGISTER_FACTORY(IstioStatsFilterConfigFactory, Network::FilterFactoryCb IstioStatsNetworkFilterConfigFactory::createFilterFactoryFromProtoTyped( const stats::PluginConfig& proto_config, Server::Configuration::FactoryContext& factory_context) { - factory_context.api().customStatNamespaces().registerStatNamespace(CustomStatNamespace); + factory_context.serverFactoryContext().api().customStatNamespaces().registerStatNamespace(CustomStatNamespace); ConfigSharedPtr config = std::make_shared(proto_config, factory_context); config->recordVersion(); return [config](Network::FilterManager& filter_manager) { diff --git a/source/extensions/filters/http/peer_metadata/filter.cc b/source/extensions/filters/http/peer_metadata/filter.cc index 279e9b836d0..95e8069a45f 100644 --- a/source/extensions/filters/http/peer_metadata/filter.cc +++ b/source/extensions/filters/http/peer_metadata/filter.cc @@ -245,12 +245,12 @@ std::vector FilterConfig::buildDiscoveryMethods( case io::istio::http::peer_metadata::Config::DiscoveryMethod::MethodSpecifierCase:: kWorkloadDiscovery: methods.push_back( - std::make_unique(downstream, factory_context.getServerFactoryContext())); + std::make_unique(downstream, factory_context.serverFactoryContext())); break; case io::istio::http::peer_metadata::Config::DiscoveryMethod::MethodSpecifierCase:: kIstioHeaders: methods.push_back( - std::make_unique(downstream, factory_context.getServerFactoryContext())); + std::make_unique(downstream, factory_context.serverFactoryContext())); break; default: break; @@ -270,7 +270,7 @@ std::vector FilterConfig::buildPropagationMethods( case io::istio::http::peer_metadata::Config::PropagationMethod::MethodSpecifierCase:: kIstioHeaders: methods.push_back(std::make_unique( - downstream, factory_context.getServerFactoryContext(), method.istio_headers())); + downstream, factory_context.serverFactoryContext(), method.istio_headers())); break; default: break; diff --git a/source/extensions/filters/listener/set_internal_dst_address/filter.cc b/source/extensions/filters/listener/set_internal_dst_address/filter.cc index 62005197e3d..11844952308 100644 --- a/source/extensions/filters/listener/set_internal_dst_address/filter.cc +++ b/source/extensions/filters/listener/set_internal_dst_address/filter.cc @@ -57,8 +57,8 @@ Envoy::Network::FilterStatus Filter::onAccept(Envoy::Network::ListenerFilterCall ENVOY_LOG_MISC(trace, "Restore ORIGINAL_DST address: {}", tunnel_address->asString()); // Should never throw as the stream info is initialized as empty. cb.filterState().setData( - Envoy::Network::DestinationAddress::key(), - std::make_shared(tunnel_address), + "envoy.network.transport_socket.original_dst_address", + std::make_shared(tunnel_address), Envoy::StreamInfo::FilterState::StateType::ReadOnly); } else { ENVOY_LOG_MISC(trace, "Failed to parse {} address: {}", TunnelAddressField, @@ -84,8 +84,8 @@ Envoy::Network::FilterStatus Filter::onAccept(Envoy::Network::ListenerFilterCall object->port_ > 0 ? Envoy::Network::Utility::getAddressWithPort(*local_address, object->port_) : local_address; - cb.filterState().setData(Envoy::Network::DestinationAddress::key(), - std::make_shared(tunnel_address), + cb.filterState().setData("envoy.network.transport_socket.original_dst_address", + std::make_shared(tunnel_address), Envoy::StreamInfo::FilterState::StateType::ReadOnly); } else { ENVOY_LOG_MISC(trace, "Failed to parse filter state address: {}", object->value_); diff --git a/source/extensions/filters/network/forward_downstream_sni/BUILD b/source/extensions/filters/network/forward_downstream_sni/BUILD index 69bb21bee79..d4b9357df1d 100644 --- a/source/extensions/filters/network/forward_downstream_sni/BUILD +++ b/source/extensions/filters/network/forward_downstream_sni/BUILD @@ -45,6 +45,7 @@ envoy_cc_library( "@envoy//envoy/network:connection_interface", "@envoy//envoy/network:filter_interface", "@envoy//source/common/common:minimal_logger_lib", + "@envoy//source/common/network:upstream_server_name_lib", ], ) diff --git a/source/extensions/filters/network/forward_downstream_sni/config.cc b/source/extensions/filters/network/forward_downstream_sni/config.cc index d564503cd65..fc40834b7a7 100644 --- a/source/extensions/filters/network/forward_downstream_sni/config.cc +++ b/source/extensions/filters/network/forward_downstream_sni/config.cc @@ -23,7 +23,7 @@ namespace Envoy { namespace Tcp { namespace ForwardDownstreamSni { -Network::FilterFactoryCb +absl::StatusOr ForwardDownstreamSniNetworkFilterConfigFactory::createFilterFactoryFromProto( const Protobuf::Message&, Server::Configuration::FactoryContext&) { return [](Network::FilterManager& filter_manager) -> void { diff --git a/source/extensions/filters/network/forward_downstream_sni/config.h b/source/extensions/filters/network/forward_downstream_sni/config.h index e7f6527c42d..18191f3aaae 100644 --- a/source/extensions/filters/network/forward_downstream_sni/config.h +++ b/source/extensions/filters/network/forward_downstream_sni/config.h @@ -29,7 +29,7 @@ class ForwardDownstreamSniNetworkFilterConfigFactory : public Server::Configuration::NamedNetworkFilterConfigFactory { public: // NamedNetworkFilterConfigFactory - Network::FilterFactoryCb + absl::StatusOr createFilterFactoryFromProto(const Protobuf::Message&, Server::Configuration::FactoryContext&) override; ProtobufTypes::MessagePtr createEmptyConfigProto() override; diff --git a/source/extensions/filters/network/metadata_exchange/config.cc b/source/extensions/filters/network/metadata_exchange/config.cc index 98104b1c47b..f787b6acb4a 100644 --- a/source/extensions/filters/network/metadata_exchange/config.cc +++ b/source/extensions/filters/network/metadata_exchange/config.cc @@ -40,7 +40,7 @@ Network::FilterFactoryCb createFilterFactoryHelper( } } // namespace -Network::FilterFactoryCb MetadataExchangeConfigFactory::createFilterFactoryFromProto( +absl::StatusOr MetadataExchangeConfigFactory::createFilterFactoryFromProto( const Protobuf::Message& config, Server::Configuration::FactoryContext& context) { return createFilterFactory( dynamic_cast(config), context); @@ -53,7 +53,7 @@ ProtobufTypes::MessagePtr MetadataExchangeConfigFactory::createEmptyConfigProto( Network::FilterFactoryCb MetadataExchangeConfigFactory::createFilterFactory( const envoy::tcp::metadataexchange::config::MetadataExchange& proto_config, Server::Configuration::FactoryContext& context) { - return createFilterFactoryHelper(proto_config, context.getServerFactoryContext(), + return createFilterFactoryHelper(proto_config, context.serverFactoryContext(), FilterDirection::Downstream); } @@ -70,7 +70,7 @@ ProtobufTypes::MessagePtr MetadataExchangeUpstreamConfigFactory::createEmptyConf Network::FilterFactoryCb MetadataExchangeUpstreamConfigFactory::createFilterFactory( const envoy::tcp::metadataexchange::config::MetadataExchange& proto_config, Server::Configuration::UpstreamFactoryContext& context) { - return createFilterFactoryHelper(proto_config, context.getServerFactoryContext(), + return createFilterFactoryHelper(proto_config, context.serverFactoryContext(), FilterDirection::Upstream); } diff --git a/source/extensions/filters/network/metadata_exchange/config.h b/source/extensions/filters/network/metadata_exchange/config.h index 0f771d3aaca..fc97c636b1b 100644 --- a/source/extensions/filters/network/metadata_exchange/config.h +++ b/source/extensions/filters/network/metadata_exchange/config.h @@ -29,7 +29,7 @@ namespace MetadataExchange { class MetadataExchangeConfigFactory : public Server::Configuration::NamedNetworkFilterConfigFactory { public: - Network::FilterFactoryCb + absl::StatusOr createFilterFactoryFromProto(const Protobuf::Message&, Server::Configuration::FactoryContext&) override; diff --git a/source/extensions/filters/network/metadata_exchange/metadata_exchange.cc b/source/extensions/filters/network/metadata_exchange/metadata_exchange.cc index e4e7a109c1e..9290c5beafb 100644 --- a/source/extensions/filters/network/metadata_exchange/metadata_exchange.cc +++ b/source/extensions/filters/network/metadata_exchange/metadata_exchange.cc @@ -33,7 +33,7 @@ namespace MetadataExchange { namespace { std::unique_ptr<::Envoy::Buffer::OwnedImpl> -constructProxyHeaderData(const Envoy::ProtobufWkt::Any& proxy_data) { +constructProxyHeaderData(const google::protobuf::Any& proxy_data) { MetadataExchangeInitialHeader initial_header; std::string proxy_data_str = proxy_data.SerializeAsString(); // Converting from host to network byte order so that most significant byte is @@ -183,8 +183,8 @@ void MetadataExchangeFilter::writeNodeMetadata() { return; } - Envoy::ProtobufWkt::Struct data; - Envoy::ProtobufWkt::Struct* metadata = + google::protobuf::Struct data; + google::protobuf::Struct* metadata = (*data.mutable_fields())[ExchangeMetadataHeader].mutable_struct_value(); getMetadata(metadata); std::string metadata_id = getMetadataId(); @@ -192,7 +192,7 @@ void MetadataExchangeFilter::writeNodeMetadata() { (*data.mutable_fields())[ExchangeMetadataHeaderId].set_string_value(metadata_id); } if (data.fields_size() > 0) { - Envoy::ProtobufWkt::Any metadata_any_value; + google::protobuf::Any metadata_any_value; *metadata_any_value.mutable_type_url() = StructTypeUrl; std::string serialized_data; serializeToStringDeterministic(data, &serialized_data); @@ -245,7 +245,7 @@ void MetadataExchangeFilter::tryReadProxyData(Buffer::Instance& data) { } std::string proxy_data_buf = std::string(static_cast(data.linearize(proxy_data_length_)), proxy_data_length_); - Envoy::ProtobufWkt::Any proxy_data; + google::protobuf::Any proxy_data; if (!proxy_data.ParseFromString(proxy_data_buf)) { config_->stats().header_not_found_.inc(); setMetadataNotFoundFilterState(); @@ -256,15 +256,15 @@ void MetadataExchangeFilter::tryReadProxyData(Buffer::Instance& data) { data.drain(proxy_data_length_); // Set Metadata - Envoy::ProtobufWkt::Struct value_struct = - Envoy::MessageUtil::anyConvert(proxy_data); + google::protobuf::Struct value_struct = + Envoy::MessageUtil::anyConvert(proxy_data); auto key_metadata_it = value_struct.fields().find(ExchangeMetadataHeader); if (key_metadata_it != value_struct.fields().end()) { updatePeer(key_metadata_it->second.struct_value()); } const auto key_metadata_id_it = value_struct.fields().find(ExchangeMetadataHeaderId); if (key_metadata_id_it != value_struct.fields().end()) { - Envoy::ProtobufWkt::Value val = key_metadata_id_it->second; + google::protobuf::Value val = key_metadata_id_it->second; updatePeerId(toAbslStringView(config_->filter_direction_ == FilterDirection::Downstream ? ::Wasm::Common::kDownstreamMetadataIdKey : ::Wasm::Common::kUpstreamMetadataIdKey), @@ -272,7 +272,7 @@ void MetadataExchangeFilter::tryReadProxyData(Buffer::Instance& data) { } } -void MetadataExchangeFilter::updatePeer(const Envoy::ProtobufWkt::Struct& struct_value) { +void MetadataExchangeFilter::updatePeer(const google::protobuf::Struct& struct_value) { const auto fb = ::Wasm::Common::extractNodeFlatBufferFromStruct(struct_value); // Filter object captures schema by view, hence the global singleton for the diff --git a/source/extensions/filters/network/metadata_exchange/metadata_exchange.h b/source/extensions/filters/network/metadata_exchange/metadata_exchange.h index 71ea3dd357e..26a52dda8ed 100644 --- a/source/extensions/filters/network/metadata_exchange/metadata_exchange.h +++ b/source/extensions/filters/network/metadata_exchange/metadata_exchange.h @@ -133,7 +133,7 @@ class MetadataExchangeFilter : public Network::Filter, void tryReadProxyData(Buffer::Instance& data); // Helper function to share the metadata with other filters. - void updatePeer(const Envoy::ProtobufWkt::Struct& struct_value); + void updatePeer(const google::protobuf::Struct& struct_value); void updatePeerId(absl::string_view key, absl::string_view value); // Helper function to get Dynamic metadata. diff --git a/source/extensions/filters/network/metadata_exchange/metadata_exchange_test.cc b/source/extensions/filters/network/metadata_exchange/metadata_exchange_test.cc index 9906ff0173c..5a4c399d451 100644 --- a/source/extensions/filters/network/metadata_exchange/metadata_exchange_test.cc +++ b/source/extensions/filters/network/metadata_exchange/metadata_exchange_test.cc @@ -40,7 +40,7 @@ namespace { MATCHER_P(MapEq, rhs, "") { return MessageDifferencer::Equals(arg, rhs); } void ConstructProxyHeaderData(::Envoy::Buffer::OwnedImpl& serialized_header, - Envoy::ProtobufWkt::Any& proxy_header, + google::protobuf::Any& proxy_header, MetadataExchangeInitialHeader* initial_header) { std::string serialized_proxy_header = proxy_header.SerializeAsString(); memset(initial_header, 0, sizeof(MetadataExchangeInitialHeader)); @@ -80,8 +80,8 @@ class MetadataExchangeFilterTest : public testing::Test { (*productpage_value_.mutable_fields())["labels"].set_string_value("{app, productpage}"); } - Envoy::ProtobufWkt::Struct details_value_; - Envoy::ProtobufWkt::Struct productpage_value_; + google::protobuf::Struct details_value_; + google::protobuf::Struct productpage_value_; MetadataExchangeConfigSharedPtr config_; std::unique_ptr filter_; Stats::IsolatedStoreImpl scope_; @@ -102,7 +102,7 @@ TEST_F(MetadataExchangeFilterTest, MetadataExchangeFound) { ::Envoy::Buffer::OwnedImpl data; MetadataExchangeInitialHeader initial_header; - Envoy::ProtobufWkt::Any productpage_any_value; + google::protobuf::Any productpage_any_value; *productpage_any_value.mutable_type_url() = "type.googleapis.com/google.protobuf.Struct"; *productpage_any_value.mutable_value() = productpage_value_.SerializeAsString(); ConstructProxyHeaderData(data, productpage_any_value, &initial_header); diff --git a/source/extensions/filters/network/sni_verifier/config.cc b/source/extensions/filters/network/sni_verifier/config.cc index d1147c7bfd5..703cc22755d 100644 --- a/source/extensions/filters/network/sni_verifier/config.cc +++ b/source/extensions/filters/network/sni_verifier/config.cc @@ -23,7 +23,7 @@ namespace Envoy { namespace Tcp { namespace SniVerifier { -Network::FilterFactoryCb SniVerifierConfigFactory::createFilterFactoryFromProto( +absl::StatusOr SniVerifierConfigFactory::createFilterFactoryFromProto( const Protobuf::Message&, Server::Configuration::FactoryContext& context) { return createFilterFactoryFromContext(context); } diff --git a/source/extensions/filters/network/sni_verifier/config.h b/source/extensions/filters/network/sni_verifier/config.h index d55900a3464..2fe408efbb6 100644 --- a/source/extensions/filters/network/sni_verifier/config.h +++ b/source/extensions/filters/network/sni_verifier/config.h @@ -26,7 +26,7 @@ namespace SniVerifier { class SniVerifierConfigFactory : public Server::Configuration::NamedNetworkFilterConfigFactory { public: // NamedNetworkFilterConfigFactory - Network::FilterFactoryCb + absl::StatusOr createFilterFactoryFromProto(const Protobuf::Message&, Server::Configuration::FactoryContext& context) override; diff --git a/source/extensions/filters/network/tcp_cluster_rewrite/BUILD b/source/extensions/filters/network/tcp_cluster_rewrite/BUILD index b398cd9e4e9..2ec73f5f21c 100644 --- a/source/extensions/filters/network/tcp_cluster_rewrite/BUILD +++ b/source/extensions/filters/network/tcp_cluster_rewrite/BUILD @@ -33,6 +33,7 @@ envoy_cc_library( "@envoy//envoy/network:connection_interface", "@envoy//envoy/network:filter_interface", "@envoy//source/common/common:minimal_logger_lib", + "@envoy//source/common/tcp_proxy:tcp_proxy", ], ) diff --git a/source/extensions/filters/network/tcp_cluster_rewrite/config.cc b/source/extensions/filters/network/tcp_cluster_rewrite/config.cc index f23c19ab89c..927e9b77d58 100644 --- a/source/extensions/filters/network/tcp_cluster_rewrite/config.cc +++ b/source/extensions/filters/network/tcp_cluster_rewrite/config.cc @@ -25,7 +25,7 @@ namespace Envoy { namespace Tcp { namespace TcpClusterRewrite { -Network::FilterFactoryCb TcpClusterRewriteFilterConfigFactory::createFilterFactoryFromProto( +absl::StatusOr TcpClusterRewriteFilterConfigFactory::createFilterFactoryFromProto( const Protobuf::Message& config, Server::Configuration::FactoryContext&) { return createFilterFactory(dynamic_cast(config)); } diff --git a/source/extensions/filters/network/tcp_cluster_rewrite/config.h b/source/extensions/filters/network/tcp_cluster_rewrite/config.h index 44b0ded87bf..cf4e4996d51 100644 --- a/source/extensions/filters/network/tcp_cluster_rewrite/config.h +++ b/source/extensions/filters/network/tcp_cluster_rewrite/config.h @@ -34,7 +34,7 @@ namespace TcpClusterRewrite { class TcpClusterRewriteFilterConfigFactory : public Server::Configuration::NamedNetworkFilterConfigFactory { public: - Network::FilterFactoryCb + absl::StatusOr createFilterFactoryFromProto(const Protobuf::Message&, Server::Configuration::FactoryContext&) override; From 1636537b9639a2bcd45dffd77a925dc2b3416c5c Mon Sep 17 00:00:00 2001 From: johnlanni Date: Thu, 29 Jan 2026 16:44:17 +0800 Subject: [PATCH 4/4] fix(bazel): update Bazel version from 6.3.2 to 7.7.1 --- .bazelversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelversion b/.bazelversion index 91e4a9f2622..bfe365e7779 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.3.2 +7.7.1 \ No newline at end of file