Update the QUIC packet format.
The QUIC packet format has changed again. Update the test to ensure that the GFE can drop support for the old packet format without causing all devices to fail CTS. Packet format changes suggested by dschinazi@. Bug: 170724836 Test: atest --rerun-until-failure 100 CtsNetTestCasesLatestSdk:MultinetworkApiTest#testNativeDatagramTransmission Change-Id: I8625ac9a58c55fc19dfb9fdb5f34a89cee40caaf Merged-In: I8625ac9a58c55fc19dfb9fdb5f34a89cee40caaf (cherry picked from commit c2b9b83bf353a1fe0669e327fa03ddb024e4f21d)
This commit is contained in:
@@ -177,20 +177,16 @@ JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runDatagramCheck(
|
||||
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo));
|
||||
|
||||
// For reference see:
|
||||
// https://tools.ietf.org/html/draft-tsvwg-quic-protocol#section-6.1
|
||||
// https://datatracker.ietf.org/doc/html/draft-ietf-quic-invariants
|
||||
uint8_t quic_packet[1200] = {
|
||||
0x0d, // public flags:
|
||||
// - version present (0x01),
|
||||
// - 64bit connection ID (0x0c),
|
||||
// - 1 byte packet number (0x00)
|
||||
0xc0, // long header
|
||||
0xaa, 0xda, 0xca, 0xca, // reserved-space version number
|
||||
0x08, // destination connection ID length
|
||||
0, 0, 0, 0, 0, 0, 0, 0, // 64bit connection ID
|
||||
0xaa, 0xda, 0xca, 0xaa, // reserved-space version number
|
||||
1, // 1 byte packet number
|
||||
0x00, // private flags
|
||||
0x07, // PING frame (cuz why not)
|
||||
0x00, // source connection ID length
|
||||
};
|
||||
|
||||
arc4random_buf(quic_packet + 1, 8); // random connection ID
|
||||
arc4random_buf(quic_packet + 6, 8); // random connection ID
|
||||
|
||||
uint8_t response[1500];
|
||||
ssize_t sent, rcvd;
|
||||
@@ -215,7 +211,7 @@ JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runDatagramCheck(
|
||||
i + 1, MAX_RETRIES, rcvd, errnum);
|
||||
}
|
||||
}
|
||||
if (rcvd < 9) {
|
||||
if (rcvd < 15) {
|
||||
ALOGD("QUIC UDP %s: sent=%zd but rcvd=%zd, errno=%d", kPort, sent, rcvd, errnum);
|
||||
if (rcvd <= 0) {
|
||||
ALOGD("Does this network block UDP port %s?", kPort);
|
||||
@@ -224,7 +220,7 @@ JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runDatagramCheck(
|
||||
return -EPROTO;
|
||||
}
|
||||
|
||||
int conn_id_cmp = memcmp(quic_packet + 1, response + 1, 8);
|
||||
int conn_id_cmp = memcmp(quic_packet + 6, response + 7, 8);
|
||||
if (conn_id_cmp != 0) {
|
||||
ALOGD("sent and received connection IDs do not match");
|
||||
close(fd);
|
||||
|
||||
Reference in New Issue
Block a user