| Index: net/quic/core/crypto/quic_crypto_server_config.cc
|
| diff --git a/net/quic/core/crypto/quic_crypto_server_config.cc b/net/quic/core/crypto/quic_crypto_server_config.cc
|
| index 171e4b510b9d6038b74892b55f6d40d9aa0039f8..20a762fe5cd341ad4299bf42204985d618dd2b63 100644
|
| --- a/net/quic/core/crypto/quic_crypto_server_config.cc
|
| +++ b/net/quic/core/crypto/quic_crypto_server_config.cc
|
| @@ -36,7 +36,6 @@
|
| #include "net/quic/core/quic_utils.h"
|
| #include "net/quic/platform/api/quic_bug_tracker.h"
|
| #include "net/quic/platform/api/quic_clock.h"
|
| -#include "net/quic/platform/api/quic_logging.h"
|
| #include "net/quic/platform/api/quic_reference_counted.h"
|
| #include "net/quic/platform/api/quic_text_utils.h"
|
|
|
| @@ -301,22 +300,22 @@
|
| CryptoFramer::ParseMessage(protobuf->config()));
|
|
|
| if (!msg.get()) {
|
| - QUIC_LOG(WARNING) << "Failed to parse server config message";
|
| + LOG(WARNING) << "Failed to parse server config message";
|
| return nullptr;
|
| }
|
|
|
| QuicReferenceCountedPointer<Config> config(ParseConfigProtobuf(protobuf));
|
| if (!config.get()) {
|
| - QUIC_LOG(WARNING) << "Failed to parse server config message";
|
| + LOG(WARNING) << "Failed to parse server config message";
|
| return nullptr;
|
| }
|
|
|
| {
|
| QuicWriterMutexLock locked(&configs_lock_);
|
| if (configs_.find(config->id) != configs_.end()) {
|
| - QUIC_LOG(WARNING) << "Failed to add config because another with the same "
|
| - "server config id already exists: "
|
| - << QuicTextUtils::HexEncode(config->id);
|
| + LOG(WARNING) << "Failed to add config because another with the same "
|
| + "server config id already exists: "
|
| + << QuicTextUtils::HexEncode(config->id);
|
| return nullptr;
|
| }
|
|
|
| @@ -354,14 +353,14 @@
|
| }
|
|
|
| if (parsed_configs.empty()) {
|
| - QUIC_LOG(WARNING) << "New config list is empty.";
|
| + LOG(WARNING) << "New config list is empty.";
|
| ok = false;
|
| }
|
|
|
| if (!ok) {
|
| - QUIC_LOG(WARNING) << "Rejecting QUIC configs because of above errors";
|
| + LOG(WARNING) << "Rejecting QUIC configs because of above errors";
|
| } else {
|
| - QUIC_LOG(INFO) << "Updating configs:";
|
| + VLOG(1) << "Updating configs:";
|
|
|
| QuicWriterMutexLock locked(&configs_lock_);
|
| ConfigMap new_configs;
|
| @@ -373,30 +372,25 @@
|
|
|
| ConfigMap::iterator it = configs_.find(config->id);
|
| if (it != configs_.end()) {
|
| - QUIC_LOG(INFO) << "Keeping scid: "
|
| - << QuicTextUtils::HexEncode(config->id) << " orbit: "
|
| - << QuicTextUtils::HexEncode(
|
| - reinterpret_cast<const char*>(config->orbit),
|
| - kOrbitSize)
|
| - << " new primary_time "
|
| - << config->primary_time.ToUNIXSeconds()
|
| - << " old primary_time "
|
| - << it->second->primary_time.ToUNIXSeconds()
|
| - << " new priority " << config->priority
|
| - << " old priority " << it->second->priority;
|
| + VLOG(1) << "Keeping scid: " << QuicTextUtils::HexEncode(config->id)
|
| + << " orbit: "
|
| + << QuicTextUtils::HexEncode(
|
| + reinterpret_cast<const char*>(config->orbit), kOrbitSize)
|
| + << " new primary_time " << config->primary_time.ToUNIXSeconds()
|
| + << " old primary_time "
|
| + << it->second->primary_time.ToUNIXSeconds() << " new priority "
|
| + << config->priority << " old priority " << it->second->priority;
|
| // Update primary_time and priority.
|
| it->second->primary_time = config->primary_time;
|
| it->second->priority = config->priority;
|
| new_configs.insert(*it);
|
| } else {
|
| - QUIC_LOG(INFO) << "Adding scid: "
|
| - << QuicTextUtils::HexEncode(config->id) << " orbit: "
|
| - << QuicTextUtils::HexEncode(
|
| - reinterpret_cast<const char*>(config->orbit),
|
| - kOrbitSize)
|
| - << " primary_time "
|
| - << config->primary_time.ToUNIXSeconds() << " priority "
|
| - << config->priority;
|
| + VLOG(1) << "Adding scid: " << QuicTextUtils::HexEncode(config->id)
|
| + << " orbit: "
|
| + << QuicTextUtils::HexEncode(
|
| + reinterpret_cast<const char*>(config->orbit), kOrbitSize)
|
| + << " primary_time " << config->primary_time.ToUNIXSeconds()
|
| + << " priority " << config->priority;
|
| new_configs.insert(std::make_pair(config->id, config));
|
| }
|
| }
|
| @@ -1102,10 +1096,10 @@
|
| }
|
| primary_config_ = new_primary;
|
| new_primary->is_primary = true;
|
| - QUIC_DLOG(INFO) << "New primary config. orbit: "
|
| - << QuicTextUtils::HexEncode(reinterpret_cast<const char*>(
|
| - primary_config_->orbit),
|
| - kOrbitSize);
|
| + DVLOG(1) << "New primary config. orbit: "
|
| + << QuicTextUtils::HexEncode(
|
| + reinterpret_cast<const char*>(primary_config_->orbit),
|
| + kOrbitSize);
|
| if (primary_config_changed_cb_.get() != nullptr) {
|
| primary_config_changed_cb_->Run(primary_config_->id);
|
| }
|
| @@ -1121,11 +1115,11 @@
|
| }
|
| primary_config_ = new_primary;
|
| new_primary->is_primary = true;
|
| - QUIC_DLOG(INFO) << "New primary config. orbit: "
|
| - << QuicTextUtils::HexEncode(
|
| - reinterpret_cast<const char*>(primary_config_->orbit),
|
| - kOrbitSize)
|
| - << " scid: " << QuicTextUtils::HexEncode(primary_config_->id);
|
| + DVLOG(1) << "New primary config. orbit: "
|
| + << QuicTextUtils::HexEncode(
|
| + reinterpret_cast<const char*>(primary_config_->orbit),
|
| + kOrbitSize)
|
| + << " scid: " << QuicTextUtils::HexEncode(primary_config_->id);
|
| next_config_promotion_time_ = QuicWallTime::Zero();
|
| if (primary_config_changed_cb_.get() != nullptr) {
|
| primary_config_changed_cb_->Run(primary_config_->id);
|
| @@ -1341,15 +1335,14 @@
|
| if (info->client_nonce.size() != kNonceSize) {
|
| info->reject_reasons.push_back(CLIENT_NONCE_INVALID_FAILURE);
|
| // Invalid client nonce.
|
| - QUIC_LOG_FIRST_N(ERROR, 2) << "Invalid client nonce: "
|
| - << client_hello.DebugString();
|
| - QUIC_DLOG(INFO) << "Invalid client nonce.";
|
| + LOG(ERROR) << "Invalid client nonce: " << client_hello.DebugString();
|
| + DVLOG(1) << "Invalid client nonce.";
|
| }
|
|
|
| // Server nonce is optional, and used for key derivation if present.
|
| client_hello.GetStringPiece(kServerNonceTag, &info->server_nonce);
|
|
|
| - QUIC_DVLOG(1) << "No 0-RTT replay protection in QUIC_VERSION_33 and higher.";
|
| + DVLOG(1) << "No 0-RTT replay protection in QUIC_VERSION_33 and higher.";
|
| // If the server nonce is empty and we're requiring handshake confirmation
|
| // for DoS reasons then we must reject the CHLO.
|
| if (FLAGS_quic_reloadable_flag_quic_require_handshake_confirmation &&
|
| @@ -1396,7 +1389,7 @@
|
| QuicCryptoProof proof;
|
| if (!proof_source_->GetProof(server_address, params.sni, serialized, version,
|
| chlo_hash, connection_options, &chain, &proof)) {
|
| - QUIC_DVLOG(1) << "Server: failed to get proof.";
|
| + DVLOG(1) << "Server: failed to get proof.";
|
| return false;
|
| }
|
|
|
| @@ -1408,9 +1401,8 @@
|
| out->SetStringPiece(kPROF, proof.signature);
|
| if (params.sct_supported_by_client && enable_serving_sct_) {
|
| if (proof.leaf_cert_scts.empty()) {
|
| - QUIC_LOG_EVERY_N_SEC(WARNING, 60)
|
| - << "SCT is expected but it is empty. sni: " << params.sni
|
| - << " server_address: " << server_address.ToString();
|
| + DLOG(WARNING) << "SCT is expected but it is empty. sni: " << params.sni
|
| + << " server_address: " << server_address.ToString();
|
| } else {
|
| out->SetStringPiece(kCertificateSCTTag, proof.leaf_cert_scts);
|
| }
|
| @@ -1526,7 +1518,7 @@
|
| message.SetStringPiece(kPROF, signature);
|
| if (sct_supported_by_client && enable_serving_sct_) {
|
| if (leaf_cert_sct.empty()) {
|
| - QUIC_LOG_EVERY_N_SEC(WARNING, 60) << "SCT is expected but it is empty.";
|
| + DLOG(WARNING) << "SCT is expected but it is empty.";
|
| } else {
|
| message.SetStringPiece(kCertificateSCTTag, leaf_cert_sct);
|
| }
|
| @@ -1553,9 +1545,9 @@
|
| CryptoHandshakeMessage* out) const {
|
| if (FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support &&
|
| use_stateless_rejects) {
|
| - QUIC_DVLOG(1) << "QUIC Crypto server config returning stateless reject "
|
| - << "with server-designated connection ID "
|
| - << server_designated_connection_id;
|
| + DVLOG(1) << "QUIC Crypto server config returning stateless reject "
|
| + << "with server-designated connection ID "
|
| + << server_designated_connection_id;
|
| out->set_tag(kSREJ);
|
| out->SetValue(kRCID, server_designated_connection_id);
|
| } else {
|
| @@ -1624,17 +1616,17 @@
|
| out->SetStringPiece(kPROF, signed_config.proof.signature);
|
| if (should_return_sct) {
|
| if (cert_sct.empty()) {
|
| - QUIC_LOG_EVERY_N_SEC(WARNING, 60) << "SCT is expected but it is empty.";
|
| + DLOG(WARNING) << "SCT is expected but it is empty.";
|
| } else {
|
| out->SetStringPiece(kCertificateSCTTag, cert_sct);
|
| }
|
| }
|
| } else {
|
| - QUIC_LOG_EVERY_N_SEC(WARNING, 60)
|
| - << "Sending inchoate REJ for hostname: " << info.sni
|
| - << " signature: " << signed_config.proof.signature.size()
|
| - << " cert: " << compressed.size() << " sct:" << sct_size
|
| - << " total: " << total_size << " max: " << max_unverified_size;
|
| + DLOG(WARNING) << "Sending inchoate REJ for hostname: " << info.sni
|
| + << " signature: " << signed_config.proof.signature.size()
|
| + << " cert: " << compressed.size() << " sct:" << sct_size
|
| + << " total: " << total_size
|
| + << " max: " << max_unverified_size;
|
| }
|
| }
|
|
|
| @@ -1669,8 +1661,8 @@
|
| CryptoFramer::ParseMessage(protobuf->config()));
|
|
|
| if (msg->tag() != kSCFG) {
|
| - QUIC_LOG(WARNING) << "Server config message has tag " << msg->tag()
|
| - << " expected " << kSCFG;
|
| + LOG(WARNING) << "Server config message has tag " << msg->tag()
|
| + << " expected " << kSCFG;
|
| return nullptr;
|
| }
|
|
|
| @@ -1687,7 +1679,7 @@
|
|
|
| StringPiece scid;
|
| if (!msg->GetStringPiece(kSCID, &scid)) {
|
| - QUIC_LOG(WARNING) << "Server config message is missing SCID";
|
| + LOG(WARNING) << "Server config message is missing SCID";
|
| return nullptr;
|
| }
|
| config->id = scid.as_string();
|
| @@ -1695,7 +1687,7 @@
|
| const QuicTag* aead_tags;
|
| size_t aead_len;
|
| if (msg->GetTaglist(kAEAD, &aead_tags, &aead_len) != QUIC_NO_ERROR) {
|
| - QUIC_LOG(WARNING) << "Server config message is missing AEAD";
|
| + LOG(WARNING) << "Server config message is missing AEAD";
|
| return nullptr;
|
| }
|
| config->aead = std::vector<QuicTag>(aead_tags, aead_tags + aead_len);
|
| @@ -1703,7 +1695,7 @@
|
| const QuicTag* kexs_tags;
|
| size_t kexs_len;
|
| if (msg->GetTaglist(kKEXS, &kexs_tags, &kexs_len) != QUIC_NO_ERROR) {
|
| - QUIC_LOG(WARNING) << "Server config message is missing KEXS";
|
| + LOG(WARNING) << "Server config message is missing KEXS";
|
| return nullptr;
|
| }
|
|
|
| @@ -1713,30 +1705,30 @@
|
| if ((err = msg->GetTaglist(kTBKP, &tbkp_tags, &tbkp_len)) !=
|
| QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND &&
|
| err != QUIC_NO_ERROR) {
|
| - QUIC_LOG(WARNING) << "Server config message is missing or has invalid TBKP";
|
| + LOG(WARNING) << "Server config message is missing or has invalid TBKP";
|
| return nullptr;
|
| }
|
| config->tb_key_params = std::vector<QuicTag>(tbkp_tags, tbkp_tags + tbkp_len);
|
|
|
| StringPiece orbit;
|
| if (!msg->GetStringPiece(kORBT, &orbit)) {
|
| - QUIC_LOG(WARNING) << "Server config message is missing ORBT";
|
| + LOG(WARNING) << "Server config message is missing ORBT";
|
| return nullptr;
|
| }
|
|
|
| if (orbit.size() != kOrbitSize) {
|
| - QUIC_LOG(WARNING) << "Orbit value in server config is the wrong length."
|
| - " Got "
|
| - << orbit.size() << " want " << kOrbitSize;
|
| + LOG(WARNING) << "Orbit value in server config is the wrong length."
|
| + " Got "
|
| + << orbit.size() << " want " << kOrbitSize;
|
| return nullptr;
|
| }
|
| static_assert(sizeof(config->orbit) == kOrbitSize, "incorrect orbit size");
|
| memcpy(config->orbit, orbit.data(), sizeof(config->orbit));
|
|
|
| if (kexs_len != protobuf->key_size()) {
|
| - QUIC_LOG(WARNING) << "Server config has " << kexs_len
|
| - << " key exchange methods configured, but "
|
| - << protobuf->key_size() << " private keys";
|
| + LOG(WARNING) << "Server config has " << kexs_len
|
| + << " key exchange methods configured, but "
|
| + << protobuf->key_size() << " private keys";
|
| return nullptr;
|
| }
|
|
|
| @@ -1767,9 +1759,9 @@
|
| }
|
|
|
| if (private_key.empty()) {
|
| - QUIC_LOG(WARNING) << "Server config contains key exchange method without "
|
| - "corresponding private key: "
|
| - << tag;
|
| + LOG(WARNING) << "Server config contains key exchange method without "
|
| + "corresponding private key: "
|
| + << tag;
|
| return nullptr;
|
| }
|
|
|
| @@ -1778,30 +1770,29 @@
|
| case kC255:
|
| ka.reset(Curve25519KeyExchange::New(private_key));
|
| if (!ka.get()) {
|
| - QUIC_LOG(WARNING) << "Server config contained an invalid curve25519"
|
| - " private key.";
|
| + LOG(WARNING) << "Server config contained an invalid curve25519"
|
| + " private key.";
|
| return nullptr;
|
| }
|
| break;
|
| case kP256:
|
| ka.reset(P256KeyExchange::New(private_key));
|
| if (!ka.get()) {
|
| - QUIC_LOG(WARNING) << "Server config contained an invalid P-256"
|
| - " private key.";
|
| + LOG(WARNING) << "Server config contained an invalid P-256"
|
| + " private key.";
|
| return nullptr;
|
| }
|
| break;
|
| default:
|
| - QUIC_LOG(WARNING)
|
| - << "Server config message contains unknown key exchange "
|
| - "method: "
|
| - << tag;
|
| + LOG(WARNING) << "Server config message contains unknown key exchange "
|
| + "method: "
|
| + << tag;
|
| return nullptr;
|
| }
|
|
|
| for (const auto& key_exchange : config->key_exchanges) {
|
| if (key_exchange->tag() == tag) {
|
| - QUIC_LOG(WARNING) << "Duplicate key exchange in config: " << tag;
|
| + LOG(WARNING) << "Duplicate key exchange in config: " << tag;
|
| return nullptr;
|
| }
|
| }
|
| @@ -1811,7 +1802,7 @@
|
|
|
| uint64_t expiry_seconds;
|
| if (msg->GetUint64(kEXPY, &expiry_seconds) != QUIC_NO_ERROR) {
|
| - QUIC_LOG(WARNING) << "Server config message is missing EXPY";
|
| + LOG(WARNING) << "Server config message is missing EXPY";
|
| return nullptr;
|
| }
|
| config->expiry_time = QuicWallTime::FromUNIXSeconds(expiry_seconds);
|
|
|