aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-09-17 00:50:08 +0200
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2018-09-17 09:08:53 +0000
commit3e1292a10d93efa8185c9e16c94172dd22bace8d (patch)
treed0b1c2759a1e4c4e9f00cc7d38c290ec8b5f8b7e /epan
parent210549f6d8262fdf764882356e11c08919b57d0d (diff)
QUIC: implement new Retry Packet (draft -13)
The Retry Packet is not encrypted at all since draft -13 so instead of complicating dissect_quic_long_header, let's create a separate routine that also prepares for draft -14 support. No pcap available, spec link: https://tools.ietf.org/html/draft-ietf-quic-transport-13#section-4.4.2 Change-Id: I32f03d723213b857a6140d0f1348baf51df4385e Ping-Bug: 13881 Reviewed-on: https://code.wireshark.org/review/29687 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-quic.c67
1 files changed, 64 insertions, 3 deletions
diff --git a/epan/dissectors/packet-quic.c b/epan/dissectors/packet-quic.c
index 3eef02f93a..b35cba88a3 100644
--- a/epan/dissectors/packet-quic.c
+++ b/epan/dissectors/packet-quic.c
@@ -61,6 +61,9 @@ static int hf_quic_short_kp_flag = -1;
static int hf_quic_short_reserved = -1;
static int hf_quic_payload = -1;
static int hf_quic_protected_payload = -1;
+static int hf_quic_odcil_draft13 = -1;
+static int hf_quic_odcid = -1;
+static int hf_quic_retry_token = -1;
static int hf_quic_frame = -1;
static int hf_quic_frame_type = -1;
@@ -1764,6 +1767,43 @@ dissect_quic_long_header_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *q
return offset;
}
+/* Retry Packet dissection for draft -13 and newer. */
+static int
+dissect_quic_retry_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *quic_tree,
+ quic_datagram *dgram_info _U_, quic_packet_info_t *quic_packet)
+{
+ guint offset = 0;
+ guint32 version;
+ guint32 len_payload_length;
+ guint64 payload_length;
+ quic_cid_t dcid = {.len=0}, scid = {.len=0};
+ guint32 odcil = 0;
+ guint retry_token_len;
+
+ proto_tree_add_item(quic_tree, hf_quic_long_packet_type, tvb, offset, 1, ENC_NA);
+ offset += 1;
+ col_set_str(pinfo->cinfo, COL_INFO, "Retry");
+
+ offset = dissect_quic_long_header_common(tvb, pinfo, quic_tree, offset, quic_packet, &version, &dcid, &scid);
+
+ if (is_quic_draft_max(version, 13)) {
+ proto_tree_add_item_ret_varint(quic_tree, hf_quic_length, tvb, offset, -1, ENC_VARINT_QUIC, &payload_length, &len_payload_length);
+ offset += len_payload_length;
+ // PKN is encrypted, but who cares about draft -13 anyway.
+ proto_tree_add_item(quic_tree, hf_quic_packet_number, tvb, offset, 1, ENC_NA);
+ offset += 1;
+ proto_tree_add_item_ret_uint(quic_tree, hf_quic_odcil_draft13, tvb, offset, 1, ENC_NA, &odcil);
+ }
+ offset += 1;
+ proto_tree_add_item(quic_tree, hf_quic_odcid, tvb, offset, odcil, ENC_NA);
+ offset += odcil;
+ retry_token_len = tvb_reported_length_remaining(tvb, offset);
+ proto_tree_add_item(quic_tree, hf_quic_retry_token, tvb, offset, retry_token_len, ENC_NA);
+ offset += retry_token_len;
+
+ return offset;
+}
+
static int
dissect_quic_long_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *quic_tree,
quic_datagram *dgram_info, quic_packet_info_t *quic_packet)
@@ -2095,12 +2135,17 @@ dissect_quic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
tvbuff_t *next_tvb = quic_get_message_tvb(tvb, offset);
proto_tree_add_item_ret_uint(quic_tree, hf_quic_header_form, next_tvb, 0, 1, ENC_NA, &header_form);
if (header_form) {
- gboolean is_vn = tvb_get_ntohl(next_tvb, 1) == 0;
- if (is_vn) {
+ guint8 long_packet_type = tvb_get_guint8(next_tvb, 0) & 0x7f;
+ guint32 version = tvb_get_ntohl(next_tvb, 1);
+ if (version == 0) {
dissect_quic_version_negotiation(next_tvb, pinfo, quic_tree, quic_packet);
break;
}
- dissect_quic_long_header(next_tvb, pinfo, quic_tree, dgram_info, quic_packet);
+ if (long_packet_type == QUIC_LPT_RETRY && !is_quic_draft_max(version, 12)) {
+ dissect_quic_retry_packet(next_tvb, pinfo, quic_tree, dgram_info, quic_packet);
+ } else {
+ dissect_quic_long_header(next_tvb, pinfo, quic_tree, dgram_info, quic_packet);
+ }
} else {
dissect_quic_short_header(next_tvb, pinfo, quic_tree, dgram_info, quic_packet);
}
@@ -2279,6 +2324,22 @@ proto_register_quic(void)
"1-RTT protected payload", HFILL }
},
+ { &hf_quic_odcil_draft13,
+ { "Original Destination Connection ID Length", "quic.odcil_draft13",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_quic_odcid,
+ { "Original Destination Connection ID", "quic.odcid",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_quic_retry_token,
+ { "Retry Token", "quic.retry_token",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+
{ &hf_quic_frame,
{ "Frame", "quic.frame",
FT_NONE, BASE_NONE, NULL, 0x0,