Attempt "fix" the broken QUIC packet to be slightly less broken
Bug: 139403355
Signed-off-by: Erik Kline <ek@google.com>
Merged-In: I9c938998b5e30f7d3994b410878b2af6a75f9b5a
Test: in I9c938998b5e30f7d3994b410878b2af6a75f9b5a
(cherry picked from commit b5e98a971a73693740a784e8bd355df41df6faa2)
Change-Id: I329c06395d63500ff20c77cee670566d83c3ac8a
diff --git a/tests/cts/net/jni/NativeMultinetworkJni.c b/tests/cts/net/jni/NativeMultinetworkJni.c
index ad56b51..4531f82 100644
--- a/tests/cts/net/jni/NativeMultinetworkJni.c
+++ b/tests/cts/net/jni/NativeMultinetworkJni.c
@@ -177,13 +177,17 @@
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo));
// For reference see:
- // https://tools.ietf.org/html/draft-tsvwg-quic-protocol-01#section-6.1
- uint8_t quic_packet[] = {
- 0x0c, // public flags: 64bit conn ID, 8bit sequence number
+ // https://tools.ietf.org/html/draft-tsvwg-quic-protocol#section-6.1
+ uint8_t quic_packet[1200] = {
+ 0x0d, // public flags:
+ // - version present (0x01),
+ // - 64bit connection ID (0x0c),
+ // - 1 byte packet number (0x00)
0, 0, 0, 0, 0, 0, 0, 0, // 64bit connection ID
- 0x01, // sequence number
+ 0xaa, 0xda, 0xca, 0xaa, // reserved-space version number
+ 1, // 1 byte packet number
0x00, // private flags
- 0x07, // type: regular frame type "PING"
+ 0x07, // PING frame (cuz why not)
};
arc4random_buf(quic_packet + 1, 8); // random connection ID
@@ -211,7 +215,7 @@
i + 1, MAX_RETRIES, rcvd, errnum);
}
}
- if (rcvd < sent) {
+ if (rcvd < 9) {
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);
@@ -227,8 +231,7 @@
return -EPROTO;
}
- // TODO: log, and compare to the IP address encoded in the
- // response, since this should be a public reset packet.
+ // TODO: Replace this quick 'n' dirty test with proper QUIC-capable code.
close(fd);
return 0;