From bfb889910af094042bd975b32a578b447bcc1e08 Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Sat, 19 Dec 2020 19:33:00 +0100 Subject: [PATCH] GQUIC: add decoding of QLVE tag Latest GQUIC versions encapsulate their first flight in Q043 packets. --- epan/dissectors/packet-gquic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/epan/dissectors/packet-gquic.c b/epan/dissectors/packet-gquic.c index f6728d2524..1c1058659d 100644 --- a/epan/dissectors/packet-gquic.c +++ b/epan/dissectors/packet-gquic.c @@ -32,6 +32,7 @@ void proto_reg_handoff_gquic(void); static dissector_handle_t gquic_handle; static dissector_handle_t tls13_handshake_handle; +static dissector_handle_t quic_handle; static int proto_gquic = -1; static int hf_gquic_header_form = -1; @@ -167,6 +168,7 @@ static int hf_gquic_tag_sttl = -1; static int hf_gquic_tag_smhl = -1; static int hf_gquic_tag_tbkp = -1; static int hf_gquic_tag_mad0 = -1; +static int hf_gquic_tag_qlve = -1; /* Public Reset Tags */ static int hf_gquic_tag_rnon = -1; @@ -427,6 +429,7 @@ static const value_string message_tag_vals[] = { #define TAG_SMHL 0x534D484C #define TAG_TBKP 0x54424B50 #define TAG_MAD0 0x4d414400 +#define TAG_QLVE 0x514C5645 /* Public Reset Tag */ #define TAG_RNON 0x524E4F4E @@ -474,6 +477,7 @@ static const value_string tag_vals[] = { { TAG_SMHL, "Support Max Header List (size)" }, { TAG_TBKP, "Token Binding Key Params" }, { TAG_MAD0, "Max Ack Delay (IETF QUIC)" }, + { TAG_QLVE, "Legacy Version Encapsulation" }, { TAG_RNON, "Public Reset Nonce Proof" }, { TAG_RSEQ, "Rejected Packet Number" }, @@ -1655,6 +1659,18 @@ dissect_gquic_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gquic_tree, gui proto_item_append_text(ti_tag, ": %u", tvb_get_guint32(tvb, tag_offset_start + tag_offset, ENC_LITTLE_ENDIAN)); tag_offset += 4; break; + case TAG_QLVE: + { + proto_tree_add_item(tag_tree, hf_gquic_tag_qlve, tvb, tag_offset_start + tag_offset, tag_len, ENC_NA); + + /* Newest GQUIC versions (usually Q050) encapsulate their first flight in Q043 packets. + * (Q050 is handled by QUIC dissector) */ + tvbuff_t *next_tvb = tvb_new_subset_length(tvb, tag_offset_start + tag_offset, tag_len); + call_dissector_with_data(quic_handle, next_tvb, pinfo, tag_tree, NULL); + + tag_offset += tag_len; + } + break; default: proto_tree_add_item(tag_tree, hf_gquic_tag_unknown, tvb, tag_offset_start + tag_offset, tag_len, ENC_NA); expert_add_info_format(pinfo, ti_tag, &ei_gquic_tag_undecoded, @@ -3143,6 +3159,11 @@ proto_register_gquic(void) FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_gquic_tag_qlve, + { "Legacy Version Encapsulation", "gquic.tag.qlve", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_gquic_tag_unknown, { "Unknown tag", "gquic.tag.unknown", @@ -3209,6 +3230,7 @@ void proto_reg_handoff_gquic(void) { tls13_handshake_handle = find_dissector("tls13-handshake"); + quic_handle = find_dissector("quic"); dissector_add_uint_range_with_preference("udp.port", "", gquic_handle); heur_dissector_add("udp", dissect_gquic_heur, "Google QUIC", "gquic", proto_gquic, HEURISTIC_ENABLE); }