diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2018-02-28 08:04:25 +0100 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2018-03-01 06:44:57 +0000 |
commit | e70e560cab016f5170dc0d00726e80ff0de1b11a (patch) | |
tree | 567cc25bfaf73fdcca73d47310793375d6e3bf39 | |
parent | c332f6e1f9f90df90cd62c4108f95a85515f34a4 (diff) |
QUIC: Add heuristic for avoid conflict with GQUIC
and UDP port 443 is not (yet) official port for QUIC...
Bug: 13881
Change-Id: I637241bd327adc6c5cccbcd68524d2ef3811e8e8
Reviewed-on: https://code.wireshark.org/review/26166
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r-- | epan/dissectors/packet-quic.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/epan/dissectors/packet-quic.c b/epan/dissectors/packet-quic.c index 1125e26f7d..a693fd4a91 100644 --- a/epan/dissectors/packet-quic.c +++ b/epan/dissectors/packet-quic.c @@ -112,6 +112,8 @@ typedef struct quic_info_data { tls13_cipher *server_cleartext_cipher; } quic_info_data_t; +#define QUIC_DRAFT 0xff0000 + const value_string quic_version_vals[] = { { 0x00000000, "Version Negotiation" }, { 0xff000004, "draft-04" }, @@ -1072,6 +1074,43 @@ dissect_quic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, return offset; } +static gboolean dissect_quic_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) +{ + + conversation_t *conversation = NULL; + int offset = 0; + guint8 flags; + guint32 version; + + /* Verify packet size (Flag (1 byte) + Connection ID (8 bytes) + Version (4 bytes)) */ + if (tvb_captured_length(tvb) < 13) + { + return FALSE; + } + + flags = tvb_get_guint8(tvb, offset); + /* Check if long Packet is set */ + if((flags & 0x80) == 0) { + return FALSE; + } + offset += 1; + + /* Connection ID */ + offset += 8; + + /* Check if version start with 0xFF0000... (QUIC draft release)*/ + version = tvb_get_ntoh24(tvb, offset); + if ( version == QUIC_DRAFT ) { + conversation = find_or_create_conversation(pinfo); + conversation_set_dissector(conversation, quic_handle); + dissect_quic(tvb, pinfo, tree, data); + return TRUE; + } + + return FALSE; +} + + void proto_register_quic(void) @@ -1421,7 +1460,8 @@ void proto_reg_handoff_quic(void) { ssl_handle = find_dissector("ssl"); - dissector_add_uint_with_preference("udp.port", 443, quic_handle); + dissector_add_uint_with_preference("udp.port", 0, quic_handle); + heur_dissector_add("udp", dissect_quic_heur, "QUIC", "quic", proto_quic, HEURISTIC_ENABLE); } /* |