Make QuicConnection to do reverse path validation based on IETF version instead of bool validate_client_addresses_.

PiperOrigin-RevId: 538238187
diff --git a/quiche/quic/core/http/end_to_end_test.cc b/quiche/quic/core/http/end_to_end_test.cc
index c08ed47..f4974a2 100644
--- a/quiche/quic/core/http/end_to_end_test.cc
+++ b/quiche/quic/core/http/end_to_end_test.cc
@@ -2873,8 +2873,7 @@
   // Send a request using the new socket.
   SendSynchronousBarRequestAndCheckResponse();
 
-  if (!version_.HasIetfQuicFrames() ||
-      !client_->client()->session()->connection()->validate_client_address()) {
+  if (!version_.HasIetfQuicFrames()) {
     return;
   }
   QuicConnection* client_connection = GetClientConnection();
@@ -3149,7 +3148,6 @@
 TEST_P(EndToEndTest, ConnectionMigrationNewTokenForNewIp) {
   ASSERT_TRUE(Initialize());
   if (!version_.HasIetfQuicFrames() ||
-      !client_->client()->session()->connection()->validate_client_address() ||
       GetQuicFlag(quic_enforce_strict_amplification_factor)) {
     return;
   }
@@ -3476,8 +3474,7 @@
   EXPECT_EQ(old_address.host(), new_address.host());
   EXPECT_NE(old_address.port(), new_address.port());
 
-  if (!version_.HasIetfQuicFrames() ||
-      !GetClientConnection()->validate_client_address()) {
+  if (!version_.HasIetfQuicFrames()) {
     return;
   }
 
@@ -5314,8 +5311,7 @@
 
 TEST_P(EndToEndTest, ClientValidateNewNetwork) {
   ASSERT_TRUE(Initialize());
-  if (!version_.HasIetfQuicFrames() ||
-      !GetClientConnection()->validate_client_address()) {
+  if (!version_.HasIetfQuicFrames()) {
     return;
   }
   client_.reset(EndToEndTest::CreateQuicClient(nullptr));
@@ -5539,7 +5535,7 @@
   // Client should have received a PATH_CHALLENGE.
   QuicConnection* client_connection = GetClientConnection();
   ASSERT_TRUE(client_connection);
-  EXPECT_EQ(client_connection->validate_client_address() ? 1u : 0,
+  EXPECT_EQ(1u,
             client_connection->GetStats().num_connectivity_probing_received);
 
   server_thread_->Pause();
diff --git a/quiche/quic/core/quic_connection.cc b/quiche/quic/core/quic_connection.cc
index f78f11a..fc5e097 100644
--- a/quiche/quic/core/quic_connection.cc
+++ b/quiche/quic/core/quic_connection.cc
@@ -641,14 +641,13 @@
   if (config.HasClientRequestedIndependentOption(kINVC, perspective_)) {
     send_connection_close_for_invalid_version_ = true;
   }
-  validate_client_addresses_ = framer_.version().HasIetfQuicFrames();
   // Having connection_migration_use_new_cid_ depends on the same set of flags
   // and connection option on both client and server sides has the advantage of:
   // 1) Less chance of skew in using new connection ID or not between client
   //    and server in unit tests with random flag combinations.
   // 2) Client side's rollout can be protected by the same connection option.
   connection_migration_use_new_cid_ =
-      validate_client_addresses_ &&
+      framer_.version().HasIetfQuicFrames() &&
       GetQuicReloadableFlag(quic_connection_migration_use_new_cid_v2);
 
   if (connection_migration_use_new_cid_ &&
@@ -1681,21 +1680,6 @@
     // Only respond to the 1st PATH_CHALLENGE in the packet.
     return true;
   }
-  if (!validate_client_addresses_) {
-    return OnPathChallengeFrameInternal(frame);
-  }
-  {
-    // TODO(danzh) inline OnPathChallengeFrameInternal() once
-    // validate_client_addresses_ is deprecated.
-    if (!OnPathChallengeFrameInternal(frame)) {
-      return false;
-    }
-  }
-  return connected_;
-}
-
-bool QuicConnection::OnPathChallengeFrameInternal(
-    const QuicPathChallengeFrame& frame) {
   should_proactively_validate_peer_address_on_path_challenge_ = false;
   // UpdatePacketContent() may start reverse path validation.
   if (!UpdatePacketContent(PATH_CHALLENGE_FRAME)) {
@@ -1706,8 +1690,8 @@
   }
   // On the server side, send response to the source address of the current
   // incoming packet according to RFC9000.
-  // On the client side, send response to the default peer address which should
-  // be on an existing path with a pre-assigned a destination CID.
+  // On the client side, send response to the default peer address which
+  // should be on an existing path with a pre-assigned a destination CID.
   const QuicSocketAddress effective_peer_address_to_respond =
       perspective_ == Perspective::IS_CLIENT
           ? effective_peer_address()
@@ -1720,37 +1704,40 @@
   FindOnPathConnectionIds(last_received_packet_info_.destination_address,
                           effective_peer_address_to_respond, &client_cid,
                           &server_cid);
-  QuicPacketCreator::ScopedPeerAddressContext context(
-      &packet_creator_, direct_peer_address_to_respond, client_cid, server_cid,
-      connection_migration_use_new_cid_);
-  if (should_proactively_validate_peer_address_on_path_challenge_) {
-    // Conditions to proactively validate peer address:
-    // The perspective is server
-    // The PATH_CHALLENGE is received on an unvalidated alternative path.
-    // The connection isn't validating migrated peer address, which is of
-    // higher prority.
-    QUIC_DVLOG(1) << "Proactively validate the effective peer address "
-                  << effective_peer_address_to_respond;
-    QUIC_CODE_COUNT_N(quic_kick_off_client_address_validation, 2, 6);
-    ValidatePath(std::make_unique<ReversePathValidationContext>(
-                     default_path_.self_address, direct_peer_address_to_respond,
-                     effective_peer_address_to_respond, this),
-                 std::make_unique<ReversePathValidationResultDelegate>(
-                     this, peer_address()),
-                 PathValidationReason::kReversePathValidation);
-  }
-  has_path_challenge_in_current_packet_ = true;
-  MaybeUpdateAckTimeout();
-  // Queue or send PATH_RESPONSE.
-  if (!SendPathResponse(frame.data_buffer, direct_peer_address_to_respond,
-                        effective_peer_address_to_respond)) {
-    QUIC_CODE_COUNT(quic_failed_to_send_path_response);
-  }
-  // TODO(b/150095588): change the stats to
-  // num_valid_path_challenge_received.
-  ++stats_.num_connectivity_probing_received;
+  {
+    QuicPacketCreator::ScopedPeerAddressContext context(
+        &packet_creator_, direct_peer_address_to_respond, client_cid,
+        server_cid, connection_migration_use_new_cid_);
+    if (should_proactively_validate_peer_address_on_path_challenge_) {
+      // Conditions to proactively validate peer address:
+      // The perspective is server
+      // The PATH_CHALLENGE is received on an unvalidated alternative path.
+      // The connection isn't validating migrated peer address, which is of
+      // higher prority.
+      QUIC_DVLOG(1) << "Proactively validate the effective peer address "
+                    << effective_peer_address_to_respond;
+      QUIC_CODE_COUNT_N(quic_kick_off_client_address_validation, 2, 6);
+      ValidatePath(
+          std::make_unique<ReversePathValidationContext>(
+              default_path_.self_address, direct_peer_address_to_respond,
+              effective_peer_address_to_respond, this),
+          std::make_unique<ReversePathValidationResultDelegate>(this,
+                                                                peer_address()),
+          PathValidationReason::kReversePathValidation);
+    }
+    has_path_challenge_in_current_packet_ = true;
+    MaybeUpdateAckTimeout();
+    // Queue or send PATH_RESPONSE.
+    if (!SendPathResponse(frame.data_buffer, direct_peer_address_to_respond,
+                          effective_peer_address_to_respond)) {
+      QUIC_CODE_COUNT(quic_failed_to_send_path_response);
+    }
+    // TODO(b/150095588): change the stats to
+    // num_valid_path_challenge_received.
+    ++stats_.num_connectivity_probing_received;
 
-  // SendPathResponse() might cause connection to be closed.
+    // Flushing packet creator might cause connection to be closed.
+  }
   return connected_;
 }
 
@@ -2710,7 +2697,7 @@
       << sent_packet_manager_.GetLargestObserved()
       << ", highest_packet_sent_before_effective_peer_migration_ = "
       << highest_packet_sent_before_effective_peer_migration_;
-  if (!validate_client_addresses_ &&
+  if (!framer_.version().HasIetfQuicFrames() &&
       active_effective_peer_migration_type_ != NO_CHANGE &&
       sent_packet_manager_.GetLargestObserved().IsInitialized() &&
       (!highest_packet_sent_before_effective_peer_migration_.IsInitialized() ||
@@ -5116,7 +5103,7 @@
       active_effective_peer_migration_type_ != PORT_CHANGE;
   active_effective_peer_migration_type_ = NO_CHANGE;
   ++stats_.num_validated_peer_migration;
-  if (!validate_client_addresses_) {
+  if (!framer_.version().HasIetfQuicFrames()) {
     return;
   }
   if (debug_visitor_ != nullptr) {
@@ -5142,7 +5129,7 @@
   // TODO(fayang): Currently, all peer address change type are allowed. Need to
   // add a method ShouldAllowPeerAddressChange(PeerAddressChangeType type) to
   // determine whether |type| is allowed.
-  if (!validate_client_addresses_) {
+  if (!framer_.version().HasIetfQuicFrames()) {
     if (type == NO_CHANGE) {
       QUIC_BUG(quic_bug_10511_35)
           << "EffectivePeerMigration started without address change.";
@@ -5362,7 +5349,7 @@
   visitor_->OnConnectionMigration(active_effective_peer_migration_type_);
   if (active_effective_peer_migration_type_ != PORT_CHANGE &&
       active_effective_peer_migration_type_ != IPV4_SUBNET_CHANGE &&
-      !validate_client_addresses_) {
+      !framer_.version().HasIetfQuicFrames()) {
     sent_packet_manager_.OnConnectionMigration(/*reset_send_algorithm=*/false);
   }
 }
@@ -5445,19 +5432,7 @@
           << "The peer is probing a new path with effective peer address "
           << current_effective_peer_address << ",  self address "
           << last_received_packet_info_.destination_address;
-      if (!validate_client_addresses_) {
-        QuicConnectionId client_cid;
-        absl::optional<StatelessResetToken> stateless_reset_token;
-        FindMatchingOrNewClientConnectionIdOrToken(
-            default_path_, alternative_path_,
-            last_received_packet_info_.destination_connection_id, &client_cid,
-            &stateless_reset_token);
-        alternative_path_ =
-            PathState(last_received_packet_info_.destination_address,
-                      current_effective_peer_address, client_cid,
-                      last_received_packet_info_.destination_connection_id,
-                      stateless_reset_token);
-      } else if (!default_path_.validated) {
+      if (!default_path_.validated) {
         // Skip reverse path validation because either handshake hasn't
         // completed or the connection is validating the default path. Using
         // PATH_CHALLENGE to validate alternative client address before
@@ -5585,9 +5560,6 @@
       // non-probing frame.
       // TODO(fayang): When multiple packet number spaces is supported, only
       // start peer migration for the application data.
-      if (!validate_client_addresses_) {
-        UpdatePeerAddress(last_received_packet_info_.source_address);
-      }
       StartEffectivePeerMigration(current_effective_peer_migration_type_);
     } else {
       UpdatePeerAddress(last_received_packet_info_.source_address);
@@ -7300,7 +7272,7 @@
 
 std::unique_ptr<SendAlgorithmInterface>
 QuicConnection::OnPeerIpAddressChanged() {
-  QUICHE_DCHECK(validate_client_addresses_);
+  QUICHE_DCHECK(framer_.version().HasIetfQuicFrames());
   std::unique_ptr<SendAlgorithmInterface> old_send_algorithm =
       sent_packet_manager_.OnConnectionMigration(
           /*reset_send_algorithm=*/true);
diff --git a/quiche/quic/core/quic_connection.h b/quiche/quic/core/quic_connection.h
index 0cd4394..e1832ab 100644
--- a/quiche/quic/core/quic_connection.h
+++ b/quiche/quic/core/quic_connection.h
@@ -1260,8 +1260,6 @@
   // session map.
   virtual std::vector<QuicConnectionId> GetActiveServerConnectionIds() const;
 
-  bool validate_client_address() const { return validate_client_addresses_; }
-
   bool connection_migration_use_new_cid() const {
     return connection_migration_use_new_cid_;
   }
@@ -1420,10 +1418,6 @@
     default_path_.bytes_received_before_address_validation += length;
   }
 
-  void set_validate_client_addresses(bool value) {
-    validate_client_addresses_ = value;
-  }
-
   bool defer_send_in_response_to_packets() const {
     return defer_send_in_response_to_packets_;
   }
@@ -1969,11 +1963,6 @@
   // validated.
   bool IsReceivedPeerAddressValidated() const;
 
-  // Called after receiving PATH_CHALLENGE. Update packet content and
-  // alternative path state if the current packet is from a non-default path.
-  // Return true if framer should continue processing the packet.
-  bool OnPathChallengeFrameInternal(const QuicPathChallengeFrame& frame);
-
   // Check the state of the multi-port alternative path and initiate path
   // migration.
   void MaybeMigrateToMultiPortPath();
diff --git a/quiche/quic/core/quic_connection_test.cc b/quiche/quic/core/quic_connection_test.cc
index 8822a9a..fae2512 100644
--- a/quiche/quic/core/quic_connection_test.cc
+++ b/quiche/quic/core/quic_connection_test.cc
@@ -1774,7 +1774,7 @@
   EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt());
   EXPECT_EQ(1u, manager_->GetConsecutivePtoCount());
   EXPECT_EQ(manager_->GetSendAlgorithm(), send_algorithm_);
-  if (connection_.validate_client_address()) {
+  if (version().HasIetfQuicFrames()) {
     EXPECT_EQ(NO_CHANGE, connection_.active_effective_peer_migration_type());
     EXPECT_EQ(1u, connection_.GetStats().num_validated_peer_migration);
     EXPECT_EQ(1u, connection_.num_linkable_client_migration());
@@ -1783,7 +1783,7 @@
 
 TEST_P(QuicConnectionTest, PeerIpAddressChangeAtServer) {
   set_perspective(Perspective::IS_SERVER);
-  if (!connection_.validate_client_address() ||
+  if (!version().SupportsAntiAmplificationLimit() ||
       GetQuicFlag(quic_enforce_strict_amplification_factor)) {
     return;
   }
@@ -2056,7 +2056,7 @@
   EXPECT_EQ(kPeerAddress, connection_.peer_address());
   EXPECT_EQ(kNewEffectivePeerAddress, connection_.effective_peer_address());
   EXPECT_EQ(kPeerAddress, writer_->last_write_peer_address());
-  if (connection_.validate_client_address()) {
+  if (GetParam().version.HasIetfQuicFrames()) {
     EXPECT_EQ(NO_CHANGE, connection_.active_effective_peer_migration_type());
     EXPECT_EQ(1u, connection_.GetStats().num_validated_peer_migration);
     EXPECT_EQ(1u, connection_.num_linkable_client_migration());
@@ -2069,7 +2069,7 @@
   connection_.ReturnEffectivePeerAddressForNextPacket(kNewEffectivePeerAddress);
   EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0);
 
-  if (!connection_.validate_client_address()) {
+  if (!GetParam().version.HasIetfQuicFrames()) {
     // ack_frame is used to complete the migration started by the last packet,
     // we need to make sure a new migration does not start after the previous
     // one is completed.
@@ -2095,7 +2095,7 @@
                                   kFinalPeerAddress, ENCRYPTION_FORWARD_SECURE);
   EXPECT_EQ(kFinalPeerAddress, connection_.peer_address());
   EXPECT_EQ(kNewerEffectivePeerAddress, connection_.effective_peer_address());
-  if (connection_.validate_client_address()) {
+  if (GetParam().version.HasIetfQuicFrames()) {
     EXPECT_EQ(NO_CHANGE, connection_.active_effective_peer_migration_type());
     EXPECT_EQ(send_algorithm_,
               connection_.sent_packet_manager().GetSendAlgorithm());
@@ -2110,7 +2110,7 @@
   connection_.ReturnEffectivePeerAddressForNextPacket(
       kNewestEffectivePeerAddress);
   EXPECT_CALL(visitor_, OnConnectionMigration(IPV6_TO_IPV4_CHANGE)).Times(1);
-  if (!connection_.validate_client_address()) {
+  if (!GetParam().version.HasIetfQuicFrames()) {
     EXPECT_CALL(*send_algorithm_, OnConnectionMigration()).Times(1);
   }
   ProcessFramePacketWithAddresses(MakeCryptoFrame(), kSelfAddress,
@@ -2119,7 +2119,7 @@
   EXPECT_EQ(kNewestEffectivePeerAddress, connection_.effective_peer_address());
   EXPECT_EQ(IPV6_TO_IPV4_CHANGE,
             connection_.active_effective_peer_migration_type());
-  if (connection_.validate_client_address()) {
+  if (GetParam().version.HasIetfQuicFrames()) {
     EXPECT_NE(send_algorithm_,
               connection_.sent_packet_manager().GetSendAlgorithm());
     EXPECT_EQ(kFinalPeerAddress, writer_->last_write_peer_address());
@@ -2586,15 +2586,13 @@
         .Times(1);
   } else {
     EXPECT_CALL(visitor_, OnPacketReceived(_, _, _)).Times(0);
-    if (connection_.validate_client_address()) {
-      EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
-          .Times(AtLeast(1u))
-          .WillOnce(Invoke([&]() {
-            EXPECT_EQ(1u, writer_->path_challenge_frames().size());
-            EXPECT_EQ(1u, writer_->path_response_frames().size());
-            payload = writer_->path_challenge_frames().front().data_buffer;
-          }));
-    }
+    EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
+        .Times(AtLeast(1u))
+        .WillOnce(Invoke([&]() {
+          EXPECT_EQ(1u, writer_->path_challenge_frames().size());
+          EXPECT_EQ(1u, writer_->path_response_frames().size());
+          payload = writer_->path_challenge_frames().front().data_buffer;
+        }));
   }
   // Process a probing packet from a new peer address on server side
   // is effectively receiving a connectivity probing.
@@ -2636,24 +2634,7 @@
     EXPECT_EQ(2 * received->length(),
               QuicConnectionPeer::BytesReceivedOnAlternativePath(&connection_));
 
-    bool success = false;
-    if (!connection_.validate_client_address()) {
-      EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
-          .Times(AtLeast(1u))
-          .WillOnce(Invoke([&]() {
-            EXPECT_EQ(1u, writer_->path_challenge_frames().size());
-            payload = writer_->path_challenge_frames().front().data_buffer;
-          }));
-
-      connection_.ValidatePath(
-          std::make_unique<TestQuicPathValidationContext>(
-              connection_.self_address(), kNewPeerAddress, writer_.get()),
-          std::make_unique<TestValidationResultDelegate>(
-              &connection_, connection_.self_address(), kNewPeerAddress,
-              &success),
-          PathValidationReason::kReasonUnknown);
-    }
-    EXPECT_EQ((connection_.validate_client_address() ? 2 : 3) * bytes_sent,
+    EXPECT_EQ(2 * bytes_sent,
               QuicConnectionPeer::BytesSentOnAlternativePath(&connection_));
     QuicFrames frames;
     frames.push_back(QuicFrame(QuicPathResponseFrame(99, payload)));
@@ -2662,9 +2643,7 @@
                                      ENCRYPTION_FORWARD_SECURE);
     EXPECT_LT(2 * received->length(),
               QuicConnectionPeer::BytesReceivedOnAlternativePath(&connection_));
-    if (connection_.validate_client_address()) {
-      EXPECT_TRUE(QuicConnectionPeer::IsAlternativePathValidated(&connection_));
-    }
+    EXPECT_TRUE(QuicConnectionPeer::IsAlternativePathValidated(&connection_));
     // Receiving another probing packet from a newer address with a different
     // port shouldn't trigger another reverse path validation.
     QuicSocketAddress kNewerPeerAddress(QuicIpAddress::Loopback4(),
@@ -2676,8 +2655,7 @@
         clock_.Now()));
     ProcessReceivedPacket(kSelfAddress, kNewerPeerAddress, *received);
     EXPECT_FALSE(connection_.HasPendingPathValidation());
-    EXPECT_EQ(connection_.validate_client_address(),
-              QuicConnectionPeer::IsAlternativePathValidated(&connection_));
+    EXPECT_TRUE(QuicConnectionPeer::IsAlternativePathValidated(&connection_));
   }
 
   // Process another packet with the old peer address on server side will not
@@ -11630,13 +11608,11 @@
         // This packet isn't sent actually, instead it is buffered in the
         // connection.
         EXPECT_EQ(1u, writer_->packets_write_attempts());
-        if (connection_.validate_client_address()) {
-          EXPECT_EQ(1u, writer_->path_response_frames().size());
-          EXPECT_EQ(0,
-                    memcmp(&path_challenge_payload,
-                           &writer_->path_response_frames().front().data_buffer,
-                           sizeof(path_challenge_payload)));
-        }
+        EXPECT_EQ(1u, writer_->path_response_frames().size());
+        EXPECT_EQ(0,
+                  memcmp(&path_challenge_payload,
+                         &writer_->path_response_frames().front().data_buffer,
+                         sizeof(path_challenge_payload)));
         EXPECT_EQ(1u, writer_->path_challenge_frames().size());
         EXPECT_EQ(1u, writer_->padding_frames().size());
         EXPECT_EQ(kNewPeerAddress, writer_->last_write_peer_address());
@@ -11645,25 +11621,13 @@
         // Only one PATH_CHALLENGE should be sent out.
         EXPECT_EQ(0u, writer_->path_challenge_frames().size());
       }));
-  bool success = false;
-  if (connection_.validate_client_address()) {
-    // Receiving a PATH_CHALLENGE from the new peer address should trigger
-    // address validation.
-    QuicFrames frames;
-    frames.push_back(
-        QuicFrame(QuicPathChallengeFrame(0, path_challenge_payload)));
-    ProcessFramesPacketWithAddresses(frames, kSelfAddress, kNewPeerAddress,
-                                     ENCRYPTION_FORWARD_SECURE);
-  } else {
-    // Manually start to validate the new peer address.
-    connection_.ValidatePath(
-        std::make_unique<TestQuicPathValidationContext>(
-            connection_.self_address(), kNewPeerAddress, writer_.get()),
-        std::make_unique<TestValidationResultDelegate>(
-            &connection_, connection_.self_address(), kNewPeerAddress,
-            &success),
-        PathValidationReason::kReasonUnknown);
-  }
+  // Receiving a PATH_CHALLENGE from the new peer address should trigger address
+  // validation.
+  QuicFrames frames;
+  frames.push_back(
+      QuicFrame(QuicPathChallengeFrame(0, path_challenge_payload)));
+  ProcessFramesPacketWithAddresses(frames, kSelfAddress, kNewPeerAddress,
+                                   ENCRYPTION_FORWARD_SECURE);
   EXPECT_EQ(1u, writer_->packets_write_attempts());
 
   // Try again with the new socket blocked from the beginning. The 2nd
@@ -11877,8 +11841,7 @@
                                           /*port=*/23456);
 
   EXPECT_CALL(visitor_, OnConnectionMigration(IPV6_TO_IPV4_CHANGE));
-  EXPECT_CALL(*send_algorithm_, OnConnectionMigration())
-      .Times(connection_.validate_client_address() ? 0u : 1u);
+  EXPECT_CALL(*send_algorithm_, OnConnectionMigration()).Times(0u);
   EXPECT_CALL(visitor_, OnStreamFrame(_))
       .WillOnce(Invoke([=](const QuicStreamFrame& frame) {
         // Send some data on the stream. The STREAM_FRAME should be built into
@@ -11888,8 +11851,7 @@
         return notifier_.WriteOrBufferData(frame.stream_id, data.length(),
                                            NO_FIN);
       }));
-  EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
-      .Times(connection_.validate_client_address() ? 0u : 1u);
+  EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0u);
   ProcessFramesPacketWithAddresses(frames, kSelfAddress, kNewPeerAddress,
                                    ENCRYPTION_FORWARD_SECURE);
 
@@ -11897,20 +11859,16 @@
   // PATH_RESPONSE_FRAME.
   EXPECT_EQ(1u, writer_->stream_frames().size());
   EXPECT_EQ(1u, writer_->path_response_frames().size());
-  EXPECT_EQ(connection_.validate_client_address() ? 1u : 0u,
-            writer_->path_challenge_frames().size());
+  EXPECT_EQ(1u, writer_->path_challenge_frames().size());
   // The final check is to ensure that the random data in the response
   // matches the random data from the challenge.
   EXPECT_EQ(0, memcmp(path_frame_buffer.data(),
                       &(writer_->path_response_frames().front().data_buffer),
                       sizeof(path_frame_buffer)));
-  EXPECT_EQ(connection_.validate_client_address() ? 1u : 0u,
-            writer_->path_challenge_frames().size());
+  EXPECT_EQ(1u, writer_->path_challenge_frames().size());
   EXPECT_EQ(1u, writer_->padding_frames().size());
   EXPECT_EQ(kNewPeerAddress, writer_->last_write_peer_address());
-  if (connection_.validate_client_address()) {
-    EXPECT_TRUE(connection_.HasPendingPathValidation());
-  }
+  EXPECT_TRUE(connection_.HasPendingPathValidation());
 }
 
 TEST_P(QuicConnectionTest, ReceiveStreamFrameFollowingPathChallenge) {
@@ -11939,16 +11897,14 @@
                   memcmp(path_frame_buffer.data(),
                          &(writer_->path_response_frames().front().data_buffer),
                          sizeof(path_frame_buffer)));
-        EXPECT_EQ(connection_.validate_client_address() ? 1u : 0u,
-                  writer_->path_challenge_frames().size());
+        EXPECT_EQ(1u, writer_->path_challenge_frames().size());
         EXPECT_EQ(1u, writer_->padding_frames().size());
         EXPECT_EQ(kNewPeerAddress, writer_->last_write_peer_address());
         received_packet_size =
             QuicConnectionPeer::BytesReceivedOnAlternativePath(&connection_);
       }));
   EXPECT_CALL(visitor_, OnConnectionMigration(IPV6_TO_IPV4_CHANGE));
-  EXPECT_CALL(*send_algorithm_, OnConnectionMigration())
-      .Times(connection_.validate_client_address() ? 0u : 1u);
+  EXPECT_CALL(*send_algorithm_, OnConnectionMigration()).Times(0u);
   EXPECT_CALL(visitor_, OnStreamFrame(_))
       .WillOnce(Invoke([=](const QuicStreamFrame& frame) {
         // Send some data on the stream. The STREAM_FRAME should be built into a
@@ -11961,9 +11917,6 @@
 
   ProcessFramesPacketWithAddresses(frames, kSelfAddress, kNewPeerAddress,
                                    ENCRYPTION_FORWARD_SECURE);
-  if (!connection_.validate_client_address()) {
-    return;
-  }
   EXPECT_TRUE(connection_.HasPendingPathValidation());
   EXPECT_EQ(0u,
             QuicConnectionPeer::BytesReceivedOnAlternativePath(&connection_));
@@ -14224,7 +14177,7 @@
 TEST_P(QuicConnectionTest,
        ProbedOnAnotherPathAfterPeerIpAddressChangeAtServer) {
   PathProbeTestInit(Perspective::IS_SERVER);
-  if (!connection_.validate_client_address()) {
+  if (!version().HasIetfQuicFrames()) {
     return;
   }
 
@@ -14987,7 +14940,7 @@
 // Regression test for b/182571515
 TEST_P(QuicConnectionTest, LostDataThenGetAcknowledged) {
   set_perspective(Perspective::IS_SERVER);
-  if (!connection_.validate_client_address() ||
+  if (!version().SupportsAntiAmplificationLimit() ||
       GetQuicFlag(quic_enforce_strict_amplification_factor)) {
     return;
   }
@@ -15398,7 +15351,7 @@
 
 // Regression test for b/201643321.
 TEST_P(QuicConnectionTest, FailedToRetransmitShlo) {
-  if (!version().HasIetfQuicFrames() ||
+  if (!version().SupportsAntiAmplificationLimit() ||
       GetQuicFlag(quic_enforce_strict_amplification_factor)) {
     return;
   }