Add a QUIC_PEER_BUG with more detailed information when self address changes at server.
PiperOrigin-RevId: 428864863
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 2fe7af3..83453ef 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -3009,10 +3009,19 @@
last_received_packet_info_.destination_address.host()
.Normalized()) {
if (!visitor_->AllowSelfAddressChange()) {
- CloseConnection(
- QUIC_ERROR_MIGRATING_ADDRESS,
- "Self address migration is not supported at the server.",
- ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
+ const std::string error_details = absl::StrCat(
+ "Self address migration is not supported at the server, current "
+ "address: ",
+ default_path_.self_address.ToString(),
+ ", received packet address: ",
+ last_received_packet_info_.destination_address.ToString(),
+ ", size: ", last_size_,
+ ", packet number: ", header.packet_number.ToString(),
+ ", encryption level: ",
+ EncryptionLevelToString(last_decrypted_packet_level_));
+ QUIC_PEER_BUG(Server self address change) << error_details;
+ CloseConnection(QUIC_ERROR_MIGRATING_ADDRESS, error_details,
+ ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
return false;
}
}
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index fba066c..8727d83 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -1576,8 +1576,10 @@
EXPECT_CALL(visitor_, BeforeConnectionCloseSent());
}
EXPECT_CALL(visitor_, OnConnectionClosed(_, _));
- ProcessFramePacketWithAddresses(MakeCryptoFrame(), self_address, kPeerAddress,
- ENCRYPTION_INITIAL);
+ EXPECT_QUIC_PEER_BUG(
+ ProcessFramePacketWithAddresses(MakeCryptoFrame(), self_address,
+ kPeerAddress, ENCRYPTION_INITIAL),
+ "Self address migration is not supported at the server");
EXPECT_FALSE(connection_.connected());
TestConnectionCloseQuicErrorCode(QUIC_ERROR_MIGRATING_ADDRESS);
}