Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions bazel/external/quiche.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,7 @@ envoy_cc_library(
":quic_core_crypto_encryption_lib",
":quic_core_framer_lib",
":quic_core_idle_network_detector_lib",
":quic_core_legacy_version_encapsulator_lib",
":quic_core_mtu_discovery_lib",
":quic_core_network_blackhole_detector_lib",
":quic_core_one_block_arena_lib",
Expand Down Expand Up @@ -2192,6 +2193,7 @@ envoy_cc_library(
name = "quic_core_frames_frames_lib",
srcs = [
"quiche/quic/core/frames/quic_ack_frame.cc",
"quiche/quic/core/frames/quic_ack_frequency_frame.cc",
"quiche/quic/core/frames/quic_blocked_frame.cc",
"quiche/quic/core/frames/quic_connection_close_frame.cc",
"quiche/quic/core/frames/quic_crypto_frame.cc",
Expand All @@ -2216,6 +2218,7 @@ envoy_cc_library(
],
hdrs = [
"quiche/quic/core/frames/quic_ack_frame.h",
"quiche/quic/core/frames/quic_ack_frequency_frame.h",
"quiche/quic/core/frames/quic_blocked_frame.h",
"quiche/quic/core/frames/quic_connection_close_frame.h",
"quiche/quic/core/frames/quic_crypto_frame.h",
Expand Down Expand Up @@ -2567,6 +2570,29 @@ envoy_cc_library(
],
)

envoy_cc_library(
name = "quic_core_legacy_version_encapsulator_lib",
srcs = [
"quiche/quic/core/quic_legacy_version_encapsulator.cc",
],
hdrs = [
"quiche/quic/core/quic_legacy_version_encapsulator.h",
],
copts = quiche_copts,
repository = "@envoy",
tags = ["nofips"],
deps = [
":quic_core_crypto_crypto_handshake_lib",
":quic_core_crypto_encryption_lib",
":quic_core_packet_creator_lib",
":quic_core_packets_lib",
":quic_core_types_lib",
":quic_core_utils_lib",
":quic_platform",
":quiche_common_platform",
],
)

envoy_cc_library(
name = "quic_core_linux_socket_utils_lib",
srcs = select({
Expand Down
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ DEPENDENCY_REPOSITORIES = dict(
cpe = "N/A",
),
com_googlesource_quiche = dict(
# Static snapshot of https://quiche.googlesource.com/quiche/+archive/d88a2f7a9ff5f9f6be2f50411b15b091affe04d3.tar.gz
sha256 = "c1c5dc165f0509097fa3917d81988e4ac5f9f3da4c2361ee435dfa7f8f428016",
urls = ["https://storage.googleapis.com/quiche-envoy-integration/d88a2f7a9ff5f9f6be2f50411b15b091affe04d3.tar.gz"],
# Static snapshot of https://quiche.googlesource.com/quiche/+archive/b2b8ff25f5a565324b93411ca29c3403ccbca969.tar.gz
sha256 = "792924bbf27203bb0d1d08c99597a30793ef8f4cfa2df99792aea7200f1b27e3",
urls = ["https://storage.googleapis.com/quiche-envoy-integration/b2b8ff25f5a565324b93411ca29c3403ccbca969.tar.gz"],
use_category = ["dataplane"],
cpe = "N/A",
),
Expand Down
159 changes: 76 additions & 83 deletions source/extensions/quic_listeners/quiche/platform/flags_list.h

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ class ActiveQuicListenerTest : public QuicMultiVersionTest {
return quic::CurrentSupportedVersionsWithQuicCrypto();
}
bool use_http3 = GetParam().second == QuicVersionType::Iquic;
SetQuicReloadableFlag(quic_enable_version_draft_28, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_27, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_25_v3, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_29, use_http3);
SetQuicReloadableFlag(quic_disable_version_draft_27, use_http3);
SetQuicReloadableFlag(quic_disable_version_draft_25, use_http3);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the two flags are quic_disable_*, it seems you meant !use_http3.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return quic::CurrentSupportedVersions();
}()[0]) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ class EnvoyQuicClientSessionTest : public testing::TestWithParam<bool> {
: api_(Api::createApiForTest(time_system_)),
dispatcher_(api_->allocateDispatcher("test_thread")), connection_helper_(*dispatcher_),
alarm_factory_(*dispatcher_, *connection_helper_.GetClock()), quic_version_([]() {
SetQuicReloadableFlag(quic_enable_version_draft_28, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_27, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_25_v3, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_29, GetParam());
SetQuicReloadableFlag(quic_disable_version_draft_27, GetParam());
SetQuicReloadableFlag(quic_disable_version_draft_25, GetParam());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return quic::ParsedVersionOfIndex(quic::CurrentSupportedVersions(), 0);
}()),
peer_addr_(Network::Utility::getAddressWithPort(*Network::Utility::getIpv6LoopbackAddress(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class EnvoyQuicClientStreamTest : public testing::TestWithParam<bool> {
: api_(Api::createApiForTest()), dispatcher_(api_->allocateDispatcher("test_thread")),
connection_helper_(*dispatcher_),
alarm_factory_(*dispatcher_, *connection_helper_.GetClock()), quic_version_([]() {
SetQuicReloadableFlag(quic_enable_version_draft_28, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_27, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_25_v3, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_29, GetParam());
SetQuicReloadableFlag(quic_disable_version_draft_27, !GetParam());
SetQuicReloadableFlag(quic_disable_version_draft_25, !GetParam());
return quic::CurrentSupportedVersions()[0];
}()),
peer_addr_(Network::Utility::getAddressWithPort(*Network::Utility::getIpv6LoopbackAddress(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class EnvoyQuicDispatcherTest : public QuicMultiVersionTest,
return quic::CurrentSupportedVersionsWithQuicCrypto();
}
bool use_http3 = GetParam().second == QuicVersionType::Iquic;
SetQuicReloadableFlag(quic_enable_version_draft_28, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_27, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_25_v3, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_29, use_http3);
SetQuicReloadableFlag(quic_disable_version_draft_27, use_http3);
SetQuicReloadableFlag(quic_disable_version_draft_25, use_http3);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return quic::CurrentSupportedVersions();
}()),
quic_version_(version_manager_.GetSupportedVersions()[0]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ class EnvoyQuicServerSessionTest : public testing::TestWithParam<bool> {
: api_(Api::createApiForTest(time_system_)),
dispatcher_(api_->allocateDispatcher("test_thread")), connection_helper_(*dispatcher_),
alarm_factory_(*dispatcher_, *connection_helper_.GetClock()), quic_version_([]() {
SetQuicReloadableFlag(quic_enable_version_draft_28, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_27, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_25_v3, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_29, GetParam());
SetQuicReloadableFlag(quic_disable_version_draft_27, !GetParam());
SetQuicReloadableFlag(quic_disable_version_draft_25, !GetParam());
return quic::ParsedVersionOfIndex(quic::CurrentSupportedVersions(), 0);
}()),
listener_stats_({ALL_LISTENER_STATS(POOL_COUNTER(listener_config_.listenerScope()),
Expand Down Expand Up @@ -143,6 +143,7 @@ class EnvoyQuicServerSessionTest : public testing::TestWithParam<bool> {
envoy_quic_session_.Initialize();
setQuicConfigWithDefaultValues(envoy_quic_session_.config());
envoy_quic_session_.OnConfigNegotiated();
quic::test::QuicConnectionPeer::SetAddressValidated(quic_connection_);

// Switch to a encryption forward secure crypto stream.
quic::test::QuicServerSessionBasePeer::SetCryptoStream(&envoy_quic_session_, nullptr);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#include <string>

#pragma GCC diagnostic push
// QUICHE allows unused parameters.
#pragma GCC diagnostic ignored "-Wunused-parameter"
// QUICHE uses offsetof().
#pragma GCC diagnostic ignored "-Winvalid-offsetof"

#include "quiche/quic/test_tools/quic_connection_peer.h"
#pragma GCC diagnostic pop

#include "common/event/libevent_scheduler.h"
#include "common/http/headers.h"

Expand Down Expand Up @@ -30,9 +39,9 @@ class EnvoyQuicServerStreamTest : public testing::TestWithParam<bool> {
: api_(Api::createApiForTest()), dispatcher_(api_->allocateDispatcher("test_thread")),
connection_helper_(*dispatcher_),
alarm_factory_(*dispatcher_, *connection_helper_.GetClock()), quic_version_([]() {
SetQuicReloadableFlag(quic_enable_version_draft_28, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_27, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_25_v3, GetParam());
SetQuicReloadableFlag(quic_enable_version_draft_29, GetParam());
SetQuicReloadableFlag(quic_disable_version_draft_27, !GetParam());
SetQuicReloadableFlag(quic_disable_version_draft_25, !GetParam());
return quic::CurrentSupportedVersions()[0];
}()),
listener_stats_({ALL_LISTENER_STATS(POOL_COUNTER(listener_config_.listenerScope()),
Expand All @@ -51,6 +60,7 @@ class EnvoyQuicServerStreamTest : public testing::TestWithParam<bool> {
response_trailers_{{"trailer-key", "trailer-value"}} {
quic_stream_->setRequestDecoder(stream_decoder_);
quic_stream_->addCallbacks(stream_callbacks_);
quic::test::QuicConnectionPeer::SetAddressValidated(&quic_connection_);
quic_session_.ActivateStream(std::unique_ptr<EnvoyQuicServerStream>(quic_stream_));
EXPECT_CALL(quic_session_, ShouldYield(_)).WillRepeatedly(testing::Return(false));
EXPECT_CALL(quic_session_, WritevData(_, _, _, _, _, _))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class QuicHttpIntegrationTest : public HttpIntegrationTest, public QuicMultiVers
return quic::CurrentSupportedVersionsWithQuicCrypto();
}
bool use_http3 = GetParam().second == QuicVersionType::Iquic;
SetQuicReloadableFlag(quic_enable_version_draft_28, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_27, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_25_v3, use_http3);
SetQuicReloadableFlag(quic_enable_version_draft_29, use_http3);
SetQuicReloadableFlag(quic_disable_version_draft_27, !use_http3);
SetQuicReloadableFlag(quic_disable_version_draft_25, !use_http3);
return quic::CurrentSupportedVersions();
}()),
crypto_config_(std::make_unique<EnvoyQuicFakeProofVerifier>()), conn_helper_(*dispatcher_),
Expand All @@ -77,7 +77,7 @@ class QuicHttpIntegrationTest : public HttpIntegrationTest, public QuicMultiVers
// TODO(danzh) Implement retry upon version mismatch and modify test frame work to specify a
// different version set on server side to test that.
auto connection = std::make_unique<EnvoyQuicClientConnection>(
getNextServerDesignatedConnectionId(), server_addr_, conn_helper_, alarm_factory_,
getNextConnectionId(), server_addr_, conn_helper_, alarm_factory_,
quic::ParsedQuicVersionVector{supported_versions_[0]}, local_addr, *dispatcher_, nullptr);
quic_connection_ = connection.get();
auto session = std::make_unique<EnvoyQuicClientSession>(
Expand Down Expand Up @@ -107,14 +107,13 @@ class QuicHttpIntegrationTest : public HttpIntegrationTest, public QuicMultiVers
return codec;
}

quic::QuicConnectionId getNextServerDesignatedConnectionId() {
quic::QuicCryptoClientConfig::CachedState* cached = crypto_config_.LookupOrCreate(server_id_);
// If the cached state indicates that we should use a server-designated
// connection ID, then return that connection ID.
quic::QuicConnectionId conn_id = cached->has_server_designated_connection_id()
? cached->GetNextServerDesignatedConnectionId()
: quic::EmptyQuicConnectionId();
return conn_id.IsEmpty() ? quic::QuicUtils::CreateRandomConnectionId() : conn_id;
quic::QuicConnectionId getNextConnectionId() {
if (designated_connection_ids_.empty()) {
return quic::QuicUtils::CreateRandomConnectionId();
}
quic::QuicConnectionId cid = designated_connection_ids_.front();
designated_connection_ids_.pop_front();
return cid;
}

void initialize() override {
Expand Down Expand Up @@ -189,6 +188,7 @@ class QuicHttpIntegrationTest : public HttpIntegrationTest, public QuicMultiVers
bool set_reuse_port_{false};
const std::string injected_resource_filename_;
AtomicFileUpdater file_updater_;
std::list<quic::QuicConnectionId> designated_connection_ids_;
};

INSTANTIATE_TEST_SUITE_P(QuicHttpIntegrationTests, QuicHttpIntegrationTest,
Expand Down Expand Up @@ -290,13 +290,12 @@ TEST_P(QuicHttpIntegrationTest, MultipleQuicListenersWithBPF) {
set_reuse_port_ = true;
initialize();
std::vector<IntegrationCodecClientPtr> codec_clients;
quic::QuicCryptoClientConfig::CachedState* cached = crypto_config_.LookupOrCreate(server_id_);
for (size_t i = 1; i <= concurrency_; ++i) {
// The BPF filter looks at the 1st word of connection id in the packet
// header. And currently all QUIC versions support 8 bytes connection id. So
// create connections with the first 4 bytes of connection id different from each
// other so they should be evenly distributed.
Comment on lines 294 to 297

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, we have change the BPF internally to inspect the 4 bytes starting from byte 1 (0-based). You may want to do the same here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. I will make another change accordingly. What's the reason behind the change?

cached->add_server_designated_connection_id(quic::test::TestConnectionId(i << 32));
designated_connection_ids_.push_back(quic::test::TestConnectionId(i << 32));
codec_clients.push_back(makeHttpConnection(lookupPort("http")));
}
if (GetParam().first == Network::Address::IpVersion::v4) {
Expand Down Expand Up @@ -333,13 +332,12 @@ TEST_P(QuicHttpIntegrationTest, MultipleQuicListenersNoBPF) {
#undef SO_ATTACH_REUSEPORT_CBPF
#endif
std::vector<IntegrationCodecClientPtr> codec_clients;
quic::QuicCryptoClientConfig::CachedState* cached = crypto_config_.LookupOrCreate(server_id_);
for (size_t i = 1; i <= concurrency_; ++i) {
// The BPF filter looks at the 1st byte of connection id in the packet
// header. And currently all QUIC versions support 8 bytes connection id. So
// create connections with the first 4 bytes of connection id different from each
// other so they should be evenly distributed.
cached->add_server_designated_connection_id(quic::test::TestConnectionId(i << 32));
designated_connection_ids_.push_back(quic::test::TestConnectionId(i << 32));
codec_clients.push_back(makeHttpConnection(lookupPort("http")));
}
if (GetParam().first == Network::Address::IpVersion::v4) {
Expand Down