GQUIC: add decoding of QLVE tag

Latest GQUIC versions encapsulate their first flight in Q043 packets.


(cherry picked from commit bfb889910a)
This commit is contained in:
Nardi Ivan 2020-12-19 18:33:00 +00:00 committed by AndersBroman
parent 2fa8940607
commit f209b56885
1 changed files with 22 additions and 0 deletions

View File

@ -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);
}