Merge "Update the QUIC packet format." am: 1dd1530647
Original change: https://android-review.googlesource.com/c/platform/cts/+/1454515
Change-Id: I76567c6de2ee21fd2027281e8aface2c943dd50d
diff --git a/tests/cts/net/jni/NativeMultinetworkJni.cpp b/tests/cts/net/jni/NativeMultinetworkJni.cpp
index cd94709..60e31bc 100644
--- a/tests/cts/net/jni/NativeMultinetworkJni.cpp
+++ b/tests/cts/net/jni/NativeMultinetworkJni.cpp
@@ -458,20 +458,16 @@
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;
@@ -496,7 +492,7 @@
i + 1, MAX_RETRIES, rcvd, errnum);
}
}
- if (rcvd < 9) {
+ if (rcvd < 15) {
LOGD("QUIC UDP %s: sent=%zd but rcvd=%zd, errno=%d", kPort, sent, rcvd, errnum);
if (rcvd <= 0) {
LOGD("Does this network block UDP port %s?", kPort);
@@ -505,7 +501,7 @@
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) {
LOGD("sent and received connection IDs do not match");
close(fd);