Skip to content

Commit

Permalink
Only enable gQUIC v46 protocol (youtube#3526)
Browse files Browse the repository at this point in the history
To facilitate http3 experiments, let's disable http3(RFCv1 QUIC) for now
and only allowlist v46 to make Cobalt behave the same as 24LTS.

b/205134049

Change-Id: I10cfae57194da14c971ac3bfa2c3c9bb6c9a547b
  • Loading branch information
johnxwork authored Jun 12, 2024
1 parent 6eba837 commit 66936f4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cobalt/network/url_request_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/proxy_resolution/proxy_config.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/quic/quic_context.h"
#include "net/ssl/ssl_config_service.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "starboard/common/murmurhash2.h"
Expand Down Expand Up @@ -203,6 +204,11 @@ URLRequestContext::URLRequestContext(
new ProxyConfigService(proxy_config)),
net::NetLog::Get(), /*quick_check_enabled=*/true));

auto quic_context = std::make_unique<net::QuicContext>();
quic_context->params()->supported_versions =
quic::ParsedQuicVersionVector{quic::ParsedQuicVersion::Q046()};
url_request_context_builder->set_quic_context(std::move(quic_context));

#if !defined(QUIC_DISABLED_FOR_STARBOARD)
bool quic_enabled =
configuration::Configuration::GetInstance()->CobaltEnableQuic();
Expand Down
4 changes: 4 additions & 0 deletions net/quic/quic_chromium_client_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,9 @@ bool QuicChromiumClientSession::GetSSLInfo(SSLInfo* ssl_info) const {
ssl_info->signed_certificate_timestamps = cert_verify_result_->scts;
ssl_info->ct_policy_compliance = cert_verify_result_->policy_compliance;

#if !defined(STARBOARD)
DCHECK(connection()->version().UsesTls());
#endif
const auto& crypto_params = crypto_stream_->crypto_negotiated_params();
uint16_t cipher_suite = crypto_params.cipher_suite;
int ssl_connection_status = 0;
Expand Down Expand Up @@ -2036,8 +2038,10 @@ void QuicChromiumClientSession::OnConnectionClosed(
tick_clock_->NowTicks() - connect_timing_.connect_end);
UMA_HISTOGRAM_COUNTS_100("Net.QuicSession.NumMigrations", num_migrations_);

#if !defined(STARBOARD)
// KeyUpdates are used in TLS, but we no longer support pre-TLS QUIC.
DCHECK(connection()->version().UsesTls());
#endif
base::UmaHistogramCounts100("Net.QuicSession.KeyUpdate.PerConnection2",
connection()->GetStats().key_update_count);
base::UmaHistogramCounts100(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ bool QuicBufferedPacketStore::IngestPacketForTlsChloExtraction(
QUICHE_DCHECK_NE(out_alpns, nullptr);
QUICHE_DCHECK_NE(out_sni, nullptr);
QUICHE_DCHECK_NE(tls_alert, nullptr);
#if !defined(STARBOARD)
QUICHE_DCHECK_EQ(version.handshake_protocol, PROTOCOL_TLS1_3);
#endif
auto it = undecryptable_packets_.find(connection_id);
if (it == undecryptable_packets_.end()) {
QUIC_BUG(quic_bug_10838_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6167,7 +6167,9 @@ bool QuicConnection::IsHandshakeComplete() const {
}

bool QuicConnection::IsHandshakeConfirmed() const {
#if !defined(STARBOARD)
QUICHE_DCHECK_EQ(PROTOCOL_TLS1_3, version().handshake_protocol);
#endif
return visitor_->GetHandshakeState() == HANDSHAKE_CONFIRMED;
}

Expand Down
8 changes: 8 additions & 0 deletions net/third_party/quiche/src/quiche/quic/core/quic_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,9 @@ void QuicSession::OnNewStreamFlowControlWindow(QuicStreamOffset new_window) {

void QuicSession::OnNewStreamUnidirectionalFlowControlWindow(
QuicStreamOffset new_window) {
#if !defined(STARBOARD)
QUICHE_DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
#endif
QUIC_DVLOG(1) << ENDPOINT << "OnNewStreamUnidirectionalFlowControlWindow "
<< new_window;
// Inform all existing outgoing unidirectional streams about the new window.
Expand Down Expand Up @@ -1496,7 +1498,9 @@ void QuicSession::OnNewStreamUnidirectionalFlowControlWindow(

void QuicSession::OnNewStreamOutgoingBidirectionalFlowControlWindow(
QuicStreamOffset new_window) {
#if !defined(STARBOARD)
QUICHE_DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
#endif
QUIC_DVLOG(1) << ENDPOINT
<< "OnNewStreamOutgoingBidirectionalFlowControlWindow "
<< new_window;
Expand Down Expand Up @@ -1527,7 +1531,9 @@ void QuicSession::OnNewStreamOutgoingBidirectionalFlowControlWindow(

void QuicSession::OnNewStreamIncomingBidirectionalFlowControlWindow(
QuicStreamOffset new_window) {
#if !defined(STARBOARD)
QUICHE_DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
#endif
QUIC_DVLOG(1) << ENDPOINT
<< "OnNewStreamIncomingBidirectionalFlowControlWindow "
<< new_window;
Expand Down Expand Up @@ -1692,7 +1698,9 @@ void QuicSession::SetDefaultEncryptionLevel(EncryptionLevel level) {
}

void QuicSession::OnTlsHandshakeComplete() {
#if !defined(STARBOARD)
QUICHE_DCHECK_EQ(PROTOCOL_TLS1_3, connection_->version().handshake_protocol);
#endif
QUIC_BUG_IF(quic_bug_12435_9,
!GetCryptoStream()->crypto_negotiated_params().cipher_suite)
<< ENDPOINT << "Handshake completes without cipher suite negotiation.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ TlsServerHandshaker::TlsServerHandshaker(
QUIC_DVLOG(1) << "TlsServerHandshaker: client_cert_mode initial value: "
<< client_cert_mode();

#if !defined(STARBOARD)
QUICHE_DCHECK_EQ(PROTOCOL_TLS1_3,
session->connection()->version().handshake_protocol);
#endif

// Configure the SSL to be a server.
SSL_set_accept_state(ssl());
Expand Down

0 comments on commit 66936f4

Please sign in to comment.