From 8f4072b481f56688ed6a971b46849de624c3a6c7 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 13 May 2018 13:50:21 +0200 Subject: QUIC: fix initial_max_streams_* decoding and rename it These are 16-bit fields, not 32-bit. Fixes a malformed packet exception. While at it, rename fields to match draft-ietf-quic-tls-11-6-g4b762033, these fields were inconssitently named in draft-11. Bug: 13881 Change-Id: I797d2b4a24a4f4a9b340db736de0000acd52e639 Reviewed-on: https://code.wireshark.org/review/27491 Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-ssl-utils.c | 16 ++++++++-------- epan/dissectors/packet-ssl-utils.h | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index 0b94a9afae..5bdb8c7e80 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -1424,13 +1424,13 @@ static const ssl_alpn_protocol_t ssl_alpn_protocols[] = { const value_string quic_transport_parameter_id[] = { { SSL_HND_QUIC_TP_INITIAL_MAX_STREAM_DATA, "initial_max_stream_data" }, { SSL_HND_QUIC_TP_INITIAL_MAX_DATA, "initial_max_data" }, - { SSL_HND_QUIC_TP_INITIAL_MAX_STREAMS_BIDI, "initial_max_streams_bidi" }, + { SSL_HND_QUIC_TP_INITIAL_MAX_BIDI_STREAMS, "initial_max_bidi_streams" }, { SSL_HND_QUIC_TP_IDLE_TIMEOUT, "idle_timeout" }, { SSL_HND_QUIC_TP_OMIT_CONNECTION_ID, "omit_connection_id" }, // removed in draft -11 { SSL_HND_QUIC_TP_MAX_PACKET_SIZE, "max_packet_size" }, { SSL_HND_QUIC_TP_STATELESS_RESET_TOKEN, "stateless_reset_token" }, { SSL_HND_QUIC_TP_ACK_DELAY_EXPONENT, "ack_delay_exponent" }, - { SSL_HND_QUIC_TP_INITIAL_MAX_STREAMS_UNI, "initial_max_streams_uni" }, + { SSL_HND_QUIC_TP_INITIAL_MAX_UNI_STREAMS, "initial_max_uni_streams" }, { 0, NULL } }; @@ -6636,10 +6636,10 @@ ssl_dissect_hnd_hello_ext_quic_transport_parameters(ssl_common_dissect_t *hf, tv proto_item_append_text(parameter_tree, " %u", tvb_get_ntohl(tvb, offset)); offset += 4; break; - case SSL_HND_QUIC_TP_INITIAL_MAX_STREAMS_BIDI: - proto_tree_add_item(parameter_tree, hf->hf.hs_ext_quictp_parameter_initial_max_streams_bidi, + case SSL_HND_QUIC_TP_INITIAL_MAX_BIDI_STREAMS: + proto_tree_add_item(parameter_tree, hf->hf.hs_ext_quictp_parameter_initial_max_bidi_streams, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(parameter_tree, " %u", tvb_get_ntohl(tvb, offset)); + proto_item_append_text(parameter_tree, " %u", tvb_get_ntohs(tvb, offset)); offset += 2; break; case SSL_HND_QUIC_TP_IDLE_TIMEOUT: @@ -6669,10 +6669,10 @@ ssl_dissect_hnd_hello_ext_quic_transport_parameters(ssl_common_dissect_t *hf, tv /*TODO display multiplier (x8) and expert info about invaluid value (> 20) ? */ offset += 1; break; - case SSL_HND_QUIC_TP_INITIAL_MAX_STREAMS_UNI: - proto_tree_add_item(parameter_tree, hf->hf.hs_ext_quictp_parameter_initial_max_streams_uni, + case SSL_HND_QUIC_TP_INITIAL_MAX_UNI_STREAMS: + proto_tree_add_item(parameter_tree, hf->hf.hs_ext_quictp_parameter_initial_max_uni_streams, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_item_append_text(parameter_tree, " %u", tvb_get_ntohl(tvb, offset)); + proto_item_append_text(parameter_tree, " %u", tvb_get_ntohs(tvb, offset)); offset += 2; break; default: diff --git a/epan/dissectors/packet-ssl-utils.h b/epan/dissectors/packet-ssl-utils.h index 7e23269e97..24daf2749b 100644 --- a/epan/dissectors/packet-ssl-utils.h +++ b/epan/dissectors/packet-ssl-utils.h @@ -198,13 +198,13 @@ typedef enum { #define SSL_HND_QUIC_TP_INITIAL_MAX_STREAM_DATA 0 #define SSL_HND_QUIC_TP_INITIAL_MAX_DATA 1 -#define SSL_HND_QUIC_TP_INITIAL_MAX_STREAMS_BIDI 2 +#define SSL_HND_QUIC_TP_INITIAL_MAX_BIDI_STREAMS 2 #define SSL_HND_QUIC_TP_IDLE_TIMEOUT 3 #define SSL_HND_QUIC_TP_OMIT_CONNECTION_ID 4 /* removed in draft -11 */ #define SSL_HND_QUIC_TP_MAX_PACKET_SIZE 5 #define SSL_HND_QUIC_TP_STATELESS_RESET_TOKEN 6 #define SSL_HND_QUIC_TP_ACK_DELAY_EXPONENT 7 -#define SSL_HND_QUIC_TP_INITIAL_MAX_STREAMS_UNI 8 +#define SSL_HND_QUIC_TP_INITIAL_MAX_UNI_STREAMS 8 /* * Lookup tables @@ -894,12 +894,12 @@ typedef struct ssl_common_dissect { gint hs_ext_quictp_parameter_value; gint hs_ext_quictp_parameter_initial_max_stream_data; gint hs_ext_quictp_parameter_initial_max_data; - gint hs_ext_quictp_parameter_initial_max_streams_bidi; + gint hs_ext_quictp_parameter_initial_max_bidi_streams; gint hs_ext_quictp_parameter_idle_timeout; gint hs_ext_quictp_parameter_max_packet_size; gint hs_ext_quictp_parameter_stateless_reset_token; gint hs_ext_quictp_parameter_ack_delay_exponent; - gint hs_ext_quictp_parameter_initial_max_streams_uni; + gint hs_ext_quictp_parameter_initial_max_uni_streams; /* do not forget to update SSL_COMMON_LIST_T and SSL_COMMON_HF_LIST! */ } hf; @@ -1894,8 +1894,8 @@ ssl_common_dissect_t name = { \ FT_UINT32, BASE_DEC, NULL, 0x00, \ "Contains the initial value for the maximum amount of data that can be sent on the connection", HFILL } \ }, \ - { & name .hf.hs_ext_quictp_parameter_initial_max_streams_bidi, \ - { "initial_max_streams_bidi", prefix ".quic.parameter.initial_max_streams_bidi", \ + { & name .hf.hs_ext_quictp_parameter_initial_max_bidi_streams, \ + { "initial_max_bidi_streams", prefix ".quic.parameter.initial_max_bidi_streams", \ FT_UINT16, BASE_DEC, NULL, 0x00, \ "Initial maximum number of application-owned bidirectional streams", HFILL } \ }, \ @@ -1919,8 +1919,8 @@ ssl_common_dissect_t name = { \ FT_UINT8, BASE_DEC, NULL, 0x00, \ "Indicating an exponent used to decode the ACK Delay field in the ACK frame,", HFILL } \ }, \ - { & name .hf.hs_ext_quictp_parameter_initial_max_streams_uni, \ - { "initial_max_streams_uni", prefix ".quic.parameter.initial_max_streams_uni", \ + { & name .hf.hs_ext_quictp_parameter_initial_max_uni_streams, \ + { "initial_max_uni_streams", prefix ".quic.parameter.initial_max_uni_streams", \ FT_UINT16, BASE_DEC, NULL, 0x00, \ "Initial maximum number of application-owned unidirectional streams", HFILL } \ } -- cgit v1.2.3