QUIC: Merge ACK and ACK_ECN frame (draft -15)
authorAlexis La Goutte <alexis.lagoutte@gmail.com>
Sun, 28 Oct 2018 16:07:56 +0000 (17:07 +0100)
committerAnders Broman <a.broman58@gmail.com>
Wed, 31 Oct 2018 09:56:20 +0000 (09:56 +0000)
create a draft14 (and older) frame type

Ping-Bug: 13881
Change-Id: I81cf69976b315d934be1a50a187610b2b71bcc2d
Reviewed-on: https://code.wireshark.org/review/30420
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-quic.c

index b009e1b439fdf48e53b8fb55316f879fa7b3cff9..7acd0e169781d9d30ab05ed91fb70e21d749aac5 100644 (file)
@@ -71,6 +71,7 @@ static int hf_quic_retry_token = -1;
 
 static int hf_quic_frame = -1;
 static int hf_quic_frame_type = -1;
+static int hf_quic_frame_type_draft14 = -1;
 static int hf_quic_frame_type_stream_fin = -1;
 static int hf_quic_frame_type_stream_len = -1;
 static int hf_quic_frame_type_stream_off = -1;
@@ -349,7 +350,8 @@ static const value_string quic_long_packet_type_vals[] = {
 #define FT_STREAM_ID_BLOCKED 0x0a
 #define FT_NEW_CONNECTION_ID 0x0b
 #define FT_STOP_SENDING     0x0c
-#define FT_ACK              0x0d
+#define FT_ACK_OLD          0x0d /* Remove in draft 15, replaced by 0x1a */
+#define FT_RETIRE_CONNECTION_ID 0x0d
 #define FT_PATH_CHALLENGE   0x0e
 #define FT_PATH_RESPONSE    0x0f
 #define FT_STREAM_10        0x10
@@ -362,10 +364,12 @@ static const value_string quic_long_packet_type_vals[] = {
 #define FT_STREAM_17        0x17
 #define FT_CRYPTO           0x18
 #define FT_NEW_TOKEN        0x19 /* Add in draft 13 */
-#define FT_ACK_ECN          0x1a /* Add in draft 14 */
-#define FT_ACK_ECN_OLD      0x20 /* Remove in draft 14 */
+#define FT_ACK              0x1a
+#define FT_ACK_ECN          0x1b
+#define FT_ACK_ECN_OLD      0x1a /* Add in draft 14 */
+#define FT_ACK_ECN_OLD_OLD  0x20 /* Remove in draft 14 */
 
-static const range_string quic_frame_type_vals[] = {
+static const range_string quic_frame_type_draft14_vals[] = {
     { 0x00, 0x00,   "PADDING" },
     { 0x01, 0x01,   "RST_STREAM" },
     { 0x02, 0x02,   "CONNECTION_CLOSE" },
@@ -390,6 +394,31 @@ static const range_string quic_frame_type_vals[] = {
     { 0,    0,        NULL },
 };
 
+static const range_string quic_frame_type_vals[] = {
+    { 0x00, 0x00,   "PADDING" },
+    { 0x01, 0x01,   "RST_STREAM" },
+    { 0x02, 0x02,   "CONNECTION_CLOSE" },
+    { 0x03, 0x03,   "APPLICATION_CLOSE" },
+    { 0x04, 0x04,   "MAX_DATA" },
+    { 0x05, 0x05,   "MAX_STREAM_DATA" },
+    { 0x06, 0x06,   "MAX_STREAM_ID" },
+    { 0x07, 0x07,   "PING" },
+    { 0x08, 0x08,   "BLOCKED" },
+    { 0x09, 0x09,   "STREAM_BLOCKED" },
+    { 0x0a, 0x0a,   "STREAM_ID_BLOCKED" },
+    { 0x0b, 0x0b,   "NEW_CONNECTION_ID" },
+    { 0x0c, 0x0c,   "STOP_SENDING" },
+    { 0x0d, 0x0d,   "RETIRE_CONNECTION_ID" },
+    { 0x0e, 0x0e,   "PATH_CHALLENGE" },
+    { 0x0f, 0x0f,   "PATH_RESPONSE" },
+    { 0x10, 0x17,   "STREAM" },
+    { 0x18, 0x18,   "CRYPTO" },
+    { 0x19, 0x19,   "NEW_TOKEN" },
+    { 0x1a, 0x1a,   "ACK" },
+    { 0x1b, 0x1b,   "ACK_ECN" },
+    { 0,    0,        NULL },
+};
+
 
 /* >= draft-08 */
 #define FTFLAGS_STREAM_FIN 0x01
@@ -897,8 +926,13 @@ dissect_quic_frame_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *quic_tree
     ti_ft = proto_tree_add_item(quic_tree, hf_quic_frame, tvb, offset, 1, ENC_NA);
     ft_tree = proto_item_add_subtree(ti_ft, ett_quic_ft);
 
-    ti_ftflags = proto_tree_add_item_ret_uint(ft_tree, hf_quic_frame_type, tvb, offset, 1, ENC_NA, &frame_type);
-    proto_item_set_text(ti_ft, "%s", rval_to_str(frame_type, quic_frame_type_vals, "Unknown"));
+    if (is_quic_draft_max(quic_info->version, 14)) {
+        ti_ftflags = proto_tree_add_item_ret_uint(ft_tree, hf_quic_frame_type_draft14, tvb, offset, 1, ENC_NA, &frame_type);
+        proto_item_set_text(ti_ft, "%s", rval_to_str(frame_type, quic_frame_type_draft14_vals, "Unknown"));
+    } else {
+        ti_ftflags = proto_tree_add_item_ret_uint(ft_tree, hf_quic_frame_type, tvb, offset, 1, ENC_NA, &frame_type);
+        proto_item_set_text(ti_ft, "%s", rval_to_str(frame_type, quic_frame_type_vals, "Unknown"));
+    }
     offset += 1;
 
     switch(frame_type){
@@ -2483,6 +2517,11 @@ proto_register_quic(void)
             FT_NONE, BASE_NONE, NULL, 0x0,
             NULL, HFILL }
         },
+        { &hf_quic_frame_type_draft14,
+          { "Frame Type", "quic.frame_type.draft14",
+            FT_UINT8, BASE_RANGE_STRING | BASE_HEX, RVALS(quic_frame_type_draft14_vals), 0x0,
+            NULL, HFILL }
+        },
         { &hf_quic_frame_type,
           { "Frame Type", "quic.frame_type",
             FT_UINT8, BASE_RANGE_STRING | BASE_HEX, RVALS(quic_frame_type_vals), 0x0,