diff options
author | Michael Mann <mmann78@netscape.net> | 2014-11-17 20:04:30 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-11-20 16:09:09 +0000 |
commit | e77261f6593b8c25635fc32d78f0f0c3c57bb902 (patch) | |
tree | fcd6d1234ff83f86f5977f288a6de82f1da4a19b /epan | |
parent | 9611e751aed1b1358d4f7028572004af11878469 (diff) |
Eliminate proto_tree_add_text from some dissectors.
Change-Id: Ib160211198ca02f7eacf29d04568628c11f208a5
Reviewed-on: https://code.wireshark.org/review/5407
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-scsi-mmc.c | 108 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi-ssc.c | 204 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi.c | 44 | ||||
-rw-r--r-- | epan/dissectors/packet-sdp.c | 38 | ||||
-rw-r--r-- | epan/dissectors/packet-ses.c | 105 | ||||
-rw-r--r-- | epan/dissectors/packet-smb2.c | 77 | ||||
-rw-r--r-- | epan/dissectors/packet-tacacs.c | 52 | ||||
-rw-r--r-- | epan/dissectors/packet-tcp.c | 71 | ||||
-rw-r--r-- | epan/dissectors/packet-zep.c | 14 |
9 files changed, 420 insertions, 293 deletions
diff --git a/epan/dissectors/packet-scsi-mmc.c b/epan/dissectors/packet-scsi-mmc.c index 3c3f334660..4d82517ae8 100644 --- a/epan/dissectors/packet-scsi-mmc.c +++ b/epan/dissectors/packet-scsi-mmc.c @@ -26,6 +26,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/conversation.h> #include <epan/tap.h> #include "packet-scsi.h" @@ -196,6 +197,16 @@ static int hf_scsi_mmc_disk_flags = -1; static int hf_scsi_mmc_format_flags = -1; static int hf_scsi_mmc_track_flags = -1; static int hf_scsi_mmc_data_flags = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_scsi_mmc_getperformance_data_type = -1; +static int hf_scsi_mmc_setcdspeed_logical_unit_read_speed = -1; +static int hf_scsi_mmc_read_dvd_agid = -1; +static int hf_scsi_mmc_read_dvd_layer_number = -1; +static int hf_scsi_mmc_getperformance_starting_lba = -1; +static int hf_scsi_mmc_getperformance_max_num_descriptors = -1; +static int hf_scsi_mmc_getperformance_type = -1; +static int hf_scsi_mmc_setcdspeed_logical_unit_write_speed = -1; +static int hf_scsi_mmc_read_dvd_address = -1; static gint ett_scsi_mmc_profile = -1; static gint ett_scsi_notifications = -1; @@ -205,6 +216,13 @@ static gint ett_scsi_format_flags = -1; static gint ett_scsi_track_flags = -1; static gint ett_scsi_data_flags = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static expert_field ei_scsi_mmc_unknown_read_dvd_format = EI_INIT; +static expert_field ei_scsi_mmc_unknown_setstreaming_type = EI_INIT; +static expert_field ei_scsi_mmc_unknown_format_class = EI_INIT; +static expert_field ei_scsi_mmc_unknown_read_toc_format = EI_INIT; +static expert_field ei_scsi_mmc_unknown_feature_data = EI_INIT; + static const true_false_string scsi_gesn_path = { "POLLED operation requested", "ASYNCHRONOUS operation requested" @@ -507,8 +525,7 @@ dissect_mmc4_getconfiguration (tvbuff_t *tvb_a, packet_info *pinfo, proto_tree_add_item (tree, hf_scsi_mmc_feature_lun_sn, try_tvb, try_offset, additional_length, ENC_ASCII|ENC_NA); break; default: - proto_tree_add_text (tree, try_tvb, try_offset, additional_length, - "SCSI/MMC Unknown Feature data"); + proto_tree_add_expert(tree, pinfo, &ei_scsi_mmc_unknown_feature_data, try_tvb, try_offset, additional_length); break; } try_offset=old_offset+additional_length; @@ -618,8 +635,7 @@ dissect_mmc4_readtocpmaatip (tvbuff_t *tvb_a, packet_info *pinfo, proto_tree *tr } break; default: - proto_tree_add_text (tree, try_tvb, try_offset, len, - "SCSI/MMC Unknown READ TOC Format:0x%04x",cdata->itlq->flags&0x000f); + proto_tree_add_expert_format(tree, pinfo, &ei_scsi_mmc_unknown_read_toc_format, try_tvb, try_offset, len, "SCSI/MMC Unknown READ TOC Format:0x%04x", cdata->itlq->flags&0x000f); break; } END_TRY_SCSI_CDB_ALLOC_LEN; @@ -727,26 +743,16 @@ dissect_mmc4_readdiscstructure (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata) -{ - guint8 flags; - - if (tree && isreq && iscdb) { - proto_tree_add_text (tree, tvb, offset+1, 4, - "Address: %u", - tvb_get_ntohl (tvb, offset+1)); - proto_tree_add_text (tree, tvb, offset+5, 1, - "Layer Number: %u", - tvb_get_guint8 (tvb, offset+5)); +{ if (tree && isreq && iscdb) { + proto_tree_add_item(tree, hf_scsi_mmc_read_dvd_address, tvb, offset+1, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_mmc_read_dvd_layer_number, tvb, offset+5, 1, ENC_NA); cdata->itlq->flags=tvb_get_guint8 (tvb, offset+6); proto_tree_add_uint (tree, hf_scsi_mmc_read_dvd_format, tvb, offset+6, 1, cdata->itlq->flags); proto_tree_add_item (tree, hf_scsi_alloclen16, tvb, offset+7, 2, ENC_BIG_ENDIAN); - flags = tvb_get_guint8 (tvb, offset+9); - proto_tree_add_text (tree, tvb, offset+9, 1, - "AGID: %u", - flags & 0xc0); + proto_tree_add_item(tree, hf_scsi_mmc_read_dvd_agid, tvb, offset+9, 1, ENC_NA); proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control, ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); @@ -826,10 +832,7 @@ dissect_mmc4_readdiscstructure (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre break; default: - ti = proto_tree_add_text (tree, tvb, 0, 0, - "SCSI/MMC Unknown Read DVD Format:0x%02x", - cdata->itlq->flags); - PROTO_ITEM_SET_GENERATED(ti); + proto_tree_add_expert_format(tree, pinfo, &ei_scsi_mmc_unknown_read_dvd_format, tvb, 0, 0, "SCSI/MMC Unknown Read DVD Format:0x%02x", cdata->itlq->flags); } } } @@ -841,24 +844,12 @@ proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { - guint8 flags; - if (tree && isreq && iscdb) { - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "Data Type: %u", - flags & 0x1f); - proto_tree_add_text (tree, tvb, offset+1, 4, - "Starting LBA: %u", - tvb_get_ntohl (tvb, offset+1)); - proto_tree_add_text (tree, tvb, offset+7, 2, - "Maximum Number of Descriptors: %u", - tvb_get_ntohs (tvb, offset+7)); - - flags = tvb_get_guint8 (tvb, offset+9); - proto_tree_add_text (tree, tvb, offset+9, 1, - "Type: %u", - flags); + proto_tree_add_item(tree, hf_scsi_mmc_getperformance_data_type, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_scsi_mmc_getperformance_starting_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_mmc_getperformance_max_num_descriptors, tvb, offset+7, 2, ENC_BIG_ENDIAN); + + proto_tree_add_item(tree, hf_scsi_mmc_getperformance_type, tvb, offset+9, 1, ENC_NA); proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control, ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); @@ -917,7 +908,6 @@ dissect_mmc4_reportkey (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { guint8 agid, key_format, key_class; - proto_item *ti; if (tree && isreq && iscdb) { proto_tree_add_item (tree, hf_scsi_mmc_lba, tvb, offset+1, @@ -956,10 +946,9 @@ dissect_mmc4_reportkey (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (tree, hf_scsi_mmc_report_key_rpc_scheme, tvb, offset+6, 1, ENC_BIG_ENDIAN); break; default: - ti = proto_tree_add_text (tree, tvb, 0, 0, + proto_tree_add_expert_format(tree, pinfo, &ei_scsi_mmc_unknown_format_class, tvb, 0, 0, "SCSI/MMC Unknown Format:0x%02x/Class:0x%02x combination", cdata->itlq->flags>>8,cdata->itlq->flags&0xff); - PROTO_ITEM_SET_GENERATED(ti); break; } } @@ -1196,12 +1185,8 @@ dissect_mmc4_setcdspeed (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree { if (tree && isreq && iscdb) { proto_tree_add_item (tree, hf_scsi_mmc_setcdspeed_rc, tvb, offset+0, 1, ENC_BIG_ENDIAN); - proto_tree_add_text (tree, tvb, offset+1, 2, - "Logical Unit Read Speed(bytes/sec): %u", - tvb_get_ntohs (tvb, offset+1)); - proto_tree_add_text (tree, tvb, offset+3, 2, - "Logical Unit Write Speed(bytes/sec): %u", - tvb_get_ntohs (tvb, offset+3)); + proto_tree_add_item(tree, hf_scsi_mmc_setcdspeed_logical_unit_read_speed, tvb, offset+1, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_mmc_setcdspeed_logical_unit_write_speed, tvb, offset+3, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control, ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } @@ -1221,7 +1206,6 @@ dissect_mmc4_setstreaming (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr { guint8 type; - proto_item *ti; if (tree && isreq && iscdb) { type=tvb_get_guint8(tvb, offset+7); @@ -1246,9 +1230,8 @@ dissect_mmc4_setstreaming (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr proto_tree_add_item (tree, hf_scsi_mmc_setstreaming_write_time, tvb, offset+24, 4, ENC_BIG_ENDIAN); break; default: - ti = proto_tree_add_text (tree, tvb, 0, 0, + proto_tree_add_expert_format(tree, pinfo, &ei_scsi_mmc_unknown_setstreaming_type, tvb, 0, 0, "SCSI/MMC Unknown SetStreaming Type:0x%02x",cdata->itlq->flags); - PROTO_ITEM_SET_GENERATED(ti); break; } } @@ -2101,6 +2084,16 @@ proto_register_scsi_mmc(void) { &hf_scsi_mmc_data_flags, {"Data Flags", "scsi_mmc.data.flags", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}}, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_scsi_mmc_read_dvd_address, { "Address", "scsi_mmc.read_dvd.address", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_mmc_read_dvd_layer_number, { "Layer Number", "scsi_mmc.read_dvd.layer_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_mmc_read_dvd_agid, { "AGID", "scsi_mmc.read_dvd.agid", FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL }}, + { &hf_scsi_mmc_getperformance_data_type, { "Data Type", "scsi_mmc.getperformance.data_type", FT_UINT8, BASE_DEC, NULL, 0x1f, NULL, HFILL }}, + { &hf_scsi_mmc_getperformance_starting_lba, { "Starting LBA", "scsi_mmc.getperformance.starting_lba", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_mmc_getperformance_max_num_descriptors, { "Maximum Number of Descriptors", "scsi_mmc.getperformance.max_num_descriptors", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_mmc_getperformance_type, { "Type", "scsi_mmc.getperformance.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_mmc_setcdspeed_logical_unit_read_speed, { "Logical Unit Read Speed(bytes/sec)", "scsi_mmc.setcdspeed.logical_unit_read_speed", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_mmc_setcdspeed_logical_unit_write_speed, { "Logical Unit Write Speed(bytes/sec)", "scsi_mmc.setcdspeed.logical_unit_write_speed", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; /* Setup protocol subtree array */ @@ -2114,12 +2107,25 @@ proto_register_scsi_mmc(void) &ett_scsi_data_flags, }; + static ei_register_info ei[] = { + /* Generated from convert_proto_tree_add_text.pl */ + { &ei_scsi_mmc_unknown_feature_data, { "scsi_mmc.unknown_feature_data", PI_PROTOCOL, PI_WARN, "SCSI/MMC Unknown Feature data", EXPFILL }}, + { &ei_scsi_mmc_unknown_read_toc_format, { "scsi_mmc.unknown_read_toc_format", PI_PROTOCOL, PI_WARN, "SCSI/MMC Unknown READ TOC Format", EXPFILL }}, + { &ei_scsi_mmc_unknown_read_dvd_format, { "scsi_mmc.unknown_read_dvd_format", PI_PROTOCOL, PI_WARN, "SCSI/MMC Unknown Read DVD Format", EXPFILL }}, + { &ei_scsi_mmc_unknown_format_class, { "scsi_mmc.unknown_format_class", PI_PROTOCOL, PI_WARN, "SCSI/MMC Unknown Format/Class combination", EXPFILL }}, + { &ei_scsi_mmc_unknown_setstreaming_type, { "scsi_mmc.unknown_setstreaming_type", PI_PROTOCOL, PI_WARN, "SCSI/MMC Unknown SetStreaming Type", EXPFILL }}, + }; + + expert_module_t* expert_scsi_mmc; + /* Register the protocol name and description */ proto_scsi_mmc = proto_register_protocol("SCSI_MMC", "SCSI_MMC", "scsi_mmc"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_scsi_mmc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_scsi_mmc = expert_register_protocol(proto_scsi_mmc); + expert_register_field_array(expert_scsi_mmc, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-scsi-ssc.c b/epan/dissectors/packet-scsi-ssc.c index 10a51672be..eb30e3c730 100644 --- a/epan/dissectors/packet-scsi-ssc.c +++ b/epan/dissectors/packet-scsi-ssc.c @@ -85,6 +85,34 @@ static int hf_scsi_ssc_verify16_immed = -1; static int hf_scsi_ssc_medium_type = -1; static int hf_scsi_ssc_media = -1; static int hf_scsi_ssc_capacity_prop_value = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_scsi_ssc_readposition_block_number = -1; +static int hf_scsi_ssc_readposition_file_number = -1; +static int hf_scsi_ssc_readposition_parameter_len = -1; +static int hf_scsi_ssc_readblocklimits_max_block_length_limit = -1; +static int hf_scsi_ssc_readposition_set_number = -1; +static int hf_scsi_ssc_readblocklimits_granularity = -1; +static int hf_scsi_ssc_readposition_flags = -1; +static int hf_scsi_ssc_readposition_bop = -1; +static int hf_scsi_ssc_readposition_eop = -1; +static int hf_scsi_ssc_readposition_mpu = -1; +static int hf_scsi_ssc_readposition_bcu = -1; +static int hf_scsi_ssc_readposition_bycu = -1; +static int hf_scsi_ssc_readposition_bpu = -1; +static int hf_scsi_ssc_readposition_perr = -1; + + +static int hf_scsi_ssc_readposition_additional_length = -1; +static int hf_scsi_ssc_readposition_num_blocks_buffer = -1; +static int hf_scsi_ssc_readposition_last_block_location = -1; +static int hf_scsi_ssc_erase6_immed = -1; +static int hf_scsi_ssc_erase6_long = -1; +static int hf_scsi_ssc_readblocklimits_min_block_length_limit = -1; +static int hf_scsi_ssc_readposition_service_action = -1; +static int hf_scsi_ssc_readposition_num_bytes_buffer = -1; +static int hf_scsi_ssc_readposition_first_block_location = -1; +static int hf_scsi_ssc_space16_parameter_len = -1; +static int hf_scsi_ssc_readposition_partition_number = -1; static gint ett_scsi_erase = -1; static gint ett_scsi_formatmedium = -1; @@ -93,6 +121,7 @@ static gint ett_scsi_loadunload = -1; static gint ett_scsi_locate = -1; static gint ett_scsi_bam = -1; static gint ett_scsi_read6 = -1; +static gint ett_scsi_ssc_readposition_flags = -1; static void @@ -467,13 +496,13 @@ dissect_ssc_readblocklimits (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * } else if (!iscdb) { granularity = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, "Granularity: %u (%u %s)", - granularity, 1 << granularity, + proto_tree_add_uint_format_value(tree, hf_scsi_ssc_readblocklimits_granularity, tvb, offset, 1, + 1 << granularity, "%u %s", 1 << granularity, plurality(1 << granularity, "byte", "bytes")); - proto_tree_add_text (tree, tvb, offset+1, 3, "Maximum Block Length Limit: %u bytes", - tvb_get_ntoh24 (tvb, offset+1)); - proto_tree_add_text (tree, tvb, offset+4, 2, "Minimum Block Length Limit: %u bytes", - tvb_get_ntohs (tvb, offset+4)); + proto_tree_add_uint_format_value(tree, hf_scsi_ssc_readblocklimits_max_block_length_limit, tvb, offset+1, 3, + tvb_get_ntoh24 (tvb, offset+1), "%u bytes", tvb_get_ntoh24 (tvb, offset+1)); + proto_tree_add_uint_format_value(tree, hf_scsi_ssc_readblocklimits_min_block_length_limit, tvb, offset+4, 2, + tvb_get_ntohs (tvb, offset+4), "%u bytes", tvb_get_ntohs (tvb, offset+4)); } } @@ -586,17 +615,12 @@ dissect_ssc_erase6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_) { - guint8 flags; - if (isreq && iscdb) { if (!tree) return; - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "IMMED: %u, LONG: %u", - (flags & 0x02) >> 1, - flags & 0x01); + proto_tree_add_item(tree, hf_scsi_ssc_erase6_immed, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_scsi_ssc_erase6_long, tvb, offset, 1, ENC_NA); proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); @@ -657,9 +681,7 @@ dissect_ssc_space16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if (isreq && iscdb) { proto_tree_add_item (tree, hf_scsi_ssc_space6_code, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item (tree, hf_scsi_ssc_space16_count, tvb, offset+3, 8, ENC_BIG_ENDIAN); - proto_tree_add_text (tree, tvb, offset+11, 2, - "Parameter Len: %u", - tvb_get_ntohs (tvb, offset+11)); + proto_tree_add_item(tree, hf_scsi_ssc_space16_parameter_len, tvb, offset+11, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control, ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } @@ -729,18 +751,12 @@ dissect_ssc_readposition (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre if (isreq && iscdb) { service_action = tvb_get_guint8 (tvb, offset) & 0x1F; - proto_tree_add_text (tree, tvb, offset, 1, - "Service Action: %s", - val_to_str (service_action, - service_action_vals, - "Unknown (0x%02x)")); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_service_action, tvb, offset, 1, ENC_NA); /* Remember the service action so we can decode the reply */ if (cdata != NULL) { cdata->itlq->flags = service_action; } - proto_tree_add_text (tree, tvb, offset+6, 2, - "Parameter Len: %u", - tvb_get_ntohs (tvb, offset+6)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_parameter_len, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } @@ -752,12 +768,20 @@ dissect_ssc_readposition (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre switch (service_action) { case SHORT_FORM_BLOCK_ID: case SHORT_FORM_VENDOR_SPECIFIC: + { + static const int * block_id_flags[] = { + &hf_scsi_ssc_readposition_bop, + &hf_scsi_ssc_readposition_eop, + &hf_scsi_ssc_readposition_bcu, + &hf_scsi_ssc_readposition_bycu, + &hf_scsi_ssc_readposition_bpu, + &hf_scsi_ssc_readposition_perr, + NULL + }; + flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "BOP: %u, EOP: %u, BCU: %u, BYCU: %u, BPU: %u, PERR: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & BCU) >> 5, (flags & BYCU) >> 4, - (flags & BPU) >> 2, (flags & 0x02) >> 1); + proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_readposition_flags, + ett_scsi_ssc_readposition_flags, block_id_flags, ENC_NA); offset += 1; proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -766,14 +790,10 @@ dissect_ssc_readposition (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre offset += 2; /* reserved */ if (!(flags & BPU)) { - proto_tree_add_text (tree, tvb, offset, 4, - "First Block Location: %u", - tvb_get_ntohl (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_first_block_location, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_text (tree, tvb, offset, 4, - "Last Block Location: %u", - tvb_get_ntohl (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_last_block_location, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } else offset += 8; @@ -781,93 +801,91 @@ dissect_ssc_readposition (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre offset += 1; /* reserved */ if (!(flags & BCU)) { - proto_tree_add_text (tree, tvb, offset, 3, - "Number of Blocks in Buffer: %u", - tvb_get_ntoh24 (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_num_blocks_buffer, tvb, offset, 3, ENC_BIG_ENDIAN); } offset += 3; if (!(flags & BYCU)) { - proto_tree_add_text (tree, tvb, offset, 4, - "Number of Bytes in Buffer: %u", - tvb_get_ntohl (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_num_bytes_buffer, tvb, offset, 4, ENC_BIG_ENDIAN); } /*offset += 4;*/ + } break; case LONG_FORM: + { + static const int * long_form_flags[] = { + &hf_scsi_ssc_readposition_bop, + &hf_scsi_ssc_readposition_eop, + &hf_scsi_ssc_readposition_mpu, + &hf_scsi_ssc_readposition_bcu, + NULL + }; + flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "BOP: %u, EOP: %u, MPU: %u, BPU: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & MPU) >> 3, (flags & BPU) >> 2); + proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_readposition_flags, + ett_scsi_ssc_readposition_flags, long_form_flags, ENC_NA); offset += 1; offset += 3; /* reserved */ if (!(flags & BPU)) { - proto_tree_add_text (tree, tvb, offset, 4, - "Partition Number: %u", - tvb_get_ntohl (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_partition_number, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_text (tree, tvb, offset, 8, - "Block Number: %" G_GINT64_MODIFIER "u", - tvb_get_ntoh64 (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_block_number, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; } else offset += 12; if (!(flags & MPU)) { - proto_tree_add_text (tree, tvb, offset, 8, - "File Number: %" G_GINT64_MODIFIER "u", - tvb_get_ntoh64 (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_file_number, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; - proto_tree_add_text (tree, tvb, offset, 8, - "Set Number: %" G_GINT64_MODIFIER "u", - tvb_get_ntoh64 (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_set_number, tvb, offset, 8, ENC_BIG_ENDIAN); /*offset += 8;*/ - } else + } else { /*offset += 16;*/ + } + } break; case EXTENDED_FORM: + { + static const int * extended_form_flags[] = { + &hf_scsi_ssc_readposition_bop, + &hf_scsi_ssc_readposition_eop, + &hf_scsi_ssc_readposition_bcu, + &hf_scsi_ssc_readposition_bycu, + &hf_scsi_ssc_readposition_mpu, + &hf_scsi_ssc_readposition_bpu, + &hf_scsi_ssc_readposition_perr, + NULL + }; + flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "BOP: %u, EOP: %u, BCU: %u, BYCU: %u, MPU: %u, BPU: %u, PERR: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & BCU) >> 5, (flags & BYCU) >> 4, - (flags & MPU) >> 3, (flags & BPU) >> 2, - (flags & 0x02) >> 1); + proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_readposition_flags, + ett_scsi_ssc_readposition_flags, extended_form_flags, ENC_NA); offset += 1; proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_text (tree, tvb, offset, 2, - "Additional Length: %u", - tvb_get_ntohs (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_additional_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; offset += 1; /* reserved */ if (!(flags & BCU)) { - proto_tree_add_text (tree, tvb, offset, 3, - "Number of Blocks in Buffer: %u", - tvb_get_ntoh24 (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_num_blocks_buffer, tvb, offset, 3, ENC_BIG_ENDIAN); } offset += 3; if (!(flags & BPU)) { - proto_tree_add_text (tree, tvb, offset, 8, - "First Block Location: %" G_GINT64_MODIFIER "u", - tvb_get_ntoh64 (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_first_block_location, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; - proto_tree_add_text (tree, tvb, offset, 8, - "Last Block Location: %" G_GINT64_MODIFIER "u", - tvb_get_ntoh64 (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_last_block_location, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; } else offset += 16; @@ -875,11 +893,10 @@ dissect_ssc_readposition (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre offset += 1; /* reserved */ if (!(flags & BYCU)) { - proto_tree_add_text (tree, tvb, offset, 8, - "Number of Bytes in Buffer: %" G_GINT64_MODIFIER "u", - tvb_get_ntoh64 (tvb, offset)); + proto_tree_add_item(tree, hf_scsi_ssc_readposition_num_bytes_buffer, tvb, offset, 8, ENC_BIG_ENDIAN); } /*offset += 8;*/ + } break; default: @@ -1332,6 +1349,32 @@ proto_register_scsi_ssc(void) { &hf_scsi_ssc_capacity_prop_value, {"Capacity Proportion Value", "scsi_ssc.cpv", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_scsi_ssc_readblocklimits_granularity, { "Granularity", "scsi_ssc.readblocklimits.granularity", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readblocklimits_max_block_length_limit, { "Maximum Block Length Limit", "scsi_ssc.readblocklimits.max_block_length_limit", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readblocklimits_min_block_length_limit, { "Minimum Block Length Limit", "scsi_ssc.readblocklimits.min_block_length_limit", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_erase6_immed, { "IMMED", "scsi_ssc.erase6.immed", FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }}, + { &hf_scsi_ssc_erase6_long, { "LONG", "scsi_ssc.erase6.long", FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }}, + { &hf_scsi_ssc_space16_parameter_len, { "Parameter Len", "scsi_ssc.space16.parameter_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_service_action, { "Service Action", "scsi_ssc.readposition.service_action", FT_UINT8, BASE_DEC, VALS(service_action_vals), 0x1F, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_parameter_len, { "Parameter Len", "scsi_ssc.readposition.parameter_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_flags, { "Flags", "scsi_ssc.readposition.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_bop, { "BOP", "scsi_ssc.readposition.bop", FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_eop, { "EOP", "scsi_ssc.readposition.eop", FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_mpu, { "EOP", "scsi_ssc.readposition.mpu", FT_UINT8, BASE_DEC, NULL, MPU, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_bcu, { "BCU", "scsi_ssc.readposition.bcu", FT_UINT8, BASE_DEC, NULL, BCU, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_bycu, { "BYCU", "scsi_ssc.readposition.bycu", FT_UINT8, BASE_DEC, NULL, BYCU, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_bpu, { "BPU", "scsi_ssc.readposition.bpu", FT_UINT8, BASE_DEC, NULL, BPU, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_perr, { "PERR", "scsi_ssc.readposition.perr", FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_first_block_location, { "First Block Location", "scsi_ssc.readposition.first_block_location", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_last_block_location, { "Last Block Location", "scsi_ssc.readposition.last_block_location", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_num_blocks_buffer, { "Number of Blocks in Buffer", "scsi_ssc.readposition.num_blocks_buffer", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_num_bytes_buffer, { "Number of Bytes in Buffer", "scsi_ssc.readposition.num_bytes_buffer", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_partition_number, { "Partition Number", "scsi_ssc.readposition.partition_number", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_block_number, { "Block Number", "scsi_ssc.readposition.block_number", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_file_number, { "File Number", "scsi_ssc.readposition.file_number", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_set_number, { "Set Number", "scsi_ssc.readposition.set_number", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readposition_additional_length, { "Additional Length", "scsi_ssc.readposition.additional_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; @@ -1343,7 +1386,8 @@ proto_register_scsi_ssc(void) &ett_scsi_loadunload, &ett_scsi_locate, &ett_scsi_bam, - &ett_scsi_read6 + &ett_scsi_read6, + &ett_scsi_ssc_readposition_flags }; diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index 461c53b21a..e5b18f39a4 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -714,6 +714,10 @@ static int hf_scsi_recv_copy_data_seg_gran = -1; static int hf_scsi_recv_copy_inline_data_gran = -1; static int hf_scsi_recv_copy_held_data_gran = -1; static int hf_scsi_recv_copy_implemented_desc_list_len = -1; +static int hf_scsi_segment_descriptor_length = -1; +static int hf_scsi_designator = -1; +static int hf_scsi_wwn = -1; +static int hf_scsi_inline_data = -1; static int hf_scsi_reserved_8 = -1; static int hf_scsi_reserved_16 = -1; static int hf_scsi_reserved_24 = -1; @@ -752,12 +756,14 @@ static gint ett_scsi_xcopy_dev_params = -1; static gint ett_scsi_xcopy_segs = -1; static gint ett_scsi_xcopy_seg = -1; static gint ett_scsi_xcopy_seg_param = -1; +static gint ett_scsi_cscd_desc = -1; /* Generated from convert_proto_tree_add_text.pl */ static expert_field ei_scsi_unknown_scsi_exchange = EI_INIT; static expert_field ei_scsi_product_data_goes_past_end_of_page = EI_INIT; static expert_field ei_scsi_unknown_page = EI_INIT; static expert_field ei_scsi_no_dissection_for_service_action = EI_INIT; +static expert_field ei_scsi_unknown_serv_action = EI_INIT; static int scsi_tap = -1; @@ -2745,7 +2751,7 @@ dissect_scsi_evpd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item(evpd_tree, hf_scsi_inq_evpd_devid_identifier_str, tvb, offset, idlen, ENC_NA|ENC_ASCII); } } else if (codeset == CODESET_BINARY && identifier_type == DEVID_TYPE_WWN) { - proto_tree_add_text(evpd_tree, tvb, offset, plen, "WWN: %s", tvb_fcwwn_to_str(tvb, offset)); + proto_tree_add_string(evpd_tree, hf_scsi_wwn, tvb, offset, plen, tvb_fcwwn_to_str(tvb, offset)); } else { /* * XXX - decode this based on the identifier type, @@ -3313,7 +3319,8 @@ dissect_spc_extcopy(tvbuff_t *tvb, packet_info *pinfo _U_, guint8 cscd_desc_type, dev_type, des_len, code_set, des_type, seg_type; guint16 cscd_desc_list_len, seg_desc_len; guint32 /*param_list_len,*/ seg_desc_list_len, inline_data_len, i; - proto_tree *cscds_tree = NULL, *dev_tree = NULL, *cscd_tree = NULL, *segs_tree = NULL, *seg_tree = NULL, *seg_param_tree = NULL; + proto_tree *cscds_tree = NULL, *dev_tree = NULL, *cscd_tree = NULL, *segs_tree = NULL, + *seg_tree = NULL, *seg_param_tree = NULL, *cscd_desc_tree; if (isreq && iscdb) { proto_tree_add_item(tree, hf_scsi_spc_xcopy_service, tvb, offset, 1, ENC_NA); @@ -3377,27 +3384,27 @@ dissect_spc_extcopy(tvbuff_t *tvb, packet_info *pinfo _U_, offset += 1; proto_tree_add_item(cscd_tree, hf_scsi_spc_xcopy_rel_init_port_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - proto_tree_add_text(cscd_tree, tvb, offset, 24, "CSCD descriptor parameters"); - proto_tree_add_item(cscd_tree, hf_scsi_spc_xcopy_cscd_desc_code_set, tvb, offset, 1, ENC_NA); + cscd_desc_tree = proto_tree_add_subtree(cscd_tree, tvb, offset, 24, ett_scsi_cscd_desc, NULL, "CSCD descriptor parameters"); + proto_tree_add_item(cscd_desc_tree, hf_scsi_spc_xcopy_cscd_desc_code_set, tvb, offset, 1, ENC_NA); code_set = tvb_get_guint8(tvb, offset) & 0x0F; offset += 1; - proto_tree_add_item(cscd_tree, hf_scsi_spc_xcopy_cscd_desc_assoc, tvb, offset, 1, ENC_NA); - proto_tree_add_item(cscd_tree, hf_scsi_spc_xcopy_cscd_desc_des_type, tvb, offset, 1, ENC_NA); + proto_tree_add_item(cscd_desc_tree, hf_scsi_spc_xcopy_cscd_desc_assoc, tvb, offset, 1, ENC_NA); + proto_tree_add_item(cscd_desc_tree, hf_scsi_spc_xcopy_cscd_desc_des_type, tvb, offset, 1, ENC_NA); des_type = tvb_get_guint8(tvb, offset) & 0x0F; offset += 1; - proto_tree_add_item(cscd_tree, hf_scsi_reserved_8, tvb, offset, 1, ENC_NA); + proto_tree_add_item(cscd_desc_tree, hf_scsi_reserved_8, tvb, offset, 1, ENC_NA); offset += 1; - proto_tree_add_item(cscd_tree, hf_scsi_spc_xcopy_cscd_desc_des_len, tvb, offset, 1, ENC_NA); + proto_tree_add_item(cscd_desc_tree, hf_scsi_spc_xcopy_cscd_desc_des_len, tvb, offset, 1, ENC_NA); des_len = tvb_get_guint8(tvb, offset); offset += 1; - proto_tree_add_text(cscd_tree, tvb, offset, 20, "Designator (20 bytes, zero padded, used length %u)", des_len); + proto_tree_add_bytes_format(cscd_desc_tree, hf_scsi_designator, tvb, offset, 20, NULL, "Designator (20 bytes, zero padded, used length %u)", des_len); if (code_set == CODESET_BINARY && des_type == DEVID_TYPE_WWN) { /* des_type 3 = WWN */ - proto_tree_add_text(cscd_tree, tvb, offset, des_len, "WWN: %s", tvb_fcwwn_to_str(tvb, offset)); + proto_tree_add_string(cscd_desc_tree, hf_scsi_wwn, tvb, offset, des_len, tvb_fcwwn_to_str(tvb, offset)); } offset += 20; dev_tree = proto_tree_add_subtree(cscd_tree, tvb, offset, 4, ett_scsi_xcopy_dev_params, NULL, "Device type specific parameters"); if (dev_type == BLOCK_DEV_0 || dev_type == BLOCK_DEV_4 || dev_type == BLOCK_DEV_5 || dev_type == BLOCK_DEV_7 || dev_type == BLOCK_DEV_E) { - proto_tree_add_text(dev_tree, tvb, offset, 1, "Reserved|PAD|Reserved"); + proto_tree_add_item(dev_tree, hf_scsi_reserved_8, tvb, offset, 1, ENC_NA); offset += 1; /*TODO: dissect this byte */ proto_tree_add_item(dev_tree, hf_scsi_spc_xcopy_disk_block_len, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 3; @@ -3426,7 +3433,7 @@ dissect_spc_extcopy(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree_add_item(seg_tree, hf_scsi_spc_xcopy_seg_desc_dc, tvb, offset, 1, ENC_NA); proto_tree_add_item(seg_tree, hf_scsi_spc_xcopy_seg_desc_cat, tvb, offset, 1, ENC_NA); offset += 1; - proto_tree_add_text(seg_tree, tvb, offset, 2, "Segment descriptor length (bytes): %u", seg_desc_len); + proto_tree_add_item(seg_tree, hf_scsi_segment_descriptor_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(seg_tree, hf_scsi_spc_xcopy_seg_des_src_desc_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -3450,7 +3457,7 @@ dissect_spc_extcopy(tvbuff_t *tvb, packet_info *pinfo _U_, } } if (inline_data_len > 0) { - proto_tree_add_text(tree, tvb, offset, inline_data_len, "Inline data (%u bytes)", inline_data_len); + proto_tree_add_item(tree, hf_scsi_inline_data, tvb, offset, inline_data_len, ENC_NA); /*offset += inline_data_len;*/ } } else if (serv_action == XCOPY_LID4) { @@ -3543,7 +3550,7 @@ void dissect_spc_recvcopy(tvbuff_t *tvb _U_, packet_info *pinfo _U_, imp_desc_list_len--; } } else { - proto_tree_add_text(tree, tvb, offset, 0, "Unknown serv_action %u", serv_action); + proto_tree_add_expert_format(tree, pinfo, &ei_scsi_unknown_serv_action, tvb, offset, 0, "Unknown serv_action %u", serv_action); } } } @@ -7021,8 +7028,7 @@ proto_register_scsi(void) { &hf_scsi_inq_evpd_devid_code_set, { "Code Set", "scsi.inquiry.evpd.devid.code_set", FT_UINT8, BASE_HEX, VALS(scsi_devid_codeset_val), 0x0F, NULL, HFILL }}, { &hf_scsi_inq_evpd_devid_association, { "Association", "scsi.inquiry.evpd.devid.association", FT_UINT8, BASE_HEX, VALS(scsi_devid_assoc_val), 0x30, NULL, HFILL }}, { &hf_scsi_inq_evpd_devid_identifier_type, { "Identifier Type", "scsi.inquiry.evpd.devid.identifier_type", FT_UINT8, BASE_HEX, VALS(scsi_devid_idtype_val), 0x0F, NULL, HFILL }}, - { &hf_scsi_inq_evpd_identifier_number, { "Identifier Number", "scsi.inquiry.evpd.identifier_number", FT_UINT8, BASE_DEC, NULL, -0x0, NULL, HFILL }}, + { &hf_scsi_inq_evpd_identifier_number, { "Identifier Number", "scsi.inquiry.evpd.identifier_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_inq_evpd_devid_identifier_length, { "Identifier Length", "scsi.inquiry.evpd.devid.identifier_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_inq_evpd_devid_identifier_str, { "Identifier", "scsi.inquiry.evpd.devid.identifier_str", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_inq_evpd_devid_identifier_bytes, { "Identifier", "scsi.inquiry.evpd.devid.identifier_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, @@ -7353,6 +7359,10 @@ proto_register_scsi(void) { &hf_scsi_recv_copy_inline_data_gran, { "Inline data granularity", "scsi.recv_copy.inline_data_gran", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_recv_copy_held_data_gran, { "Held data granularity", "scsi.recv_copy.held_data_gran", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_recv_copy_implemented_desc_list_len, { "Implemented description list length", "scsi.recv_copy.implemented_desc_list_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_wwn, { "WWN", "scsi.wwn", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_designator, { "Designator", "scsi.designator", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_segment_descriptor_length, { "Segment descriptor length (bytes)", "scsi.segment_descriptor_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_inline_data, { "Inline data", "scsi.inline_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_reserved_8, { "Reserved (1 byte)", "scsi.reserved", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_reserved_16, { "Reserved (2 bytes)", "scsi.reserved2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_reserved_24, { "Reserved (3 bytes)", "scsi.reserved3", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -7395,6 +7405,7 @@ proto_register_scsi(void) &ett_scsi_xcopy_seg, &ett_scsi_xcopy_seg_param, &ett_xcopy_param_byte, + &ett_scsi_cscd_desc, }; static ei_register_info ei[] = { @@ -7402,6 +7413,7 @@ proto_register_scsi(void) { &ei_scsi_unknown_page, { "scsi.unknown_page", PI_UNDECODED, PI_WARN, "Unknown Page", EXPFILL }}, { &ei_scsi_no_dissection_for_service_action, { "scsi.no_dissection_for_service_action", PI_UNDECODED, PI_WARN, "No dissection for this service action yet", EXPFILL }}, { &ei_scsi_unknown_scsi_exchange, { "scsi.unknown_scsi_exchange", PI_PROTOCOL, PI_WARN, "Unknown SCSI exchange, can not decode SCSI data", EXPFILL }}, + { &ei_scsi_unknown_serv_action, { "scsi.unknown_serv_action", PI_PROTOCOL, PI_WARN, "Unknown serv_action", EXPFILL }}, }; module_t *scsi_module; diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index a5096a8d2c..440e4d6776 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -173,6 +173,12 @@ static int hf_sdp_crypto_lifetime = -1; static int hf_sdp_crypto_mki = -1; static int hf_sdp_crypto_mki_length = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_sdp_nal_unit_2_string = -1; +static int hf_sdp_key_and_salt = -1; +static int hf_sdp_nal_unit_1_string = -1; +static int hf_sdp_data = -1; + /* trees */ static int ett_sdp = -1; static int ett_sdp_owner = -1; @@ -193,6 +199,7 @@ static expert_field ei_sdp_invalid_key_param = EI_INIT; static expert_field ei_sdp_invalid_line_equal = EI_INIT; static expert_field ei_sdp_invalid_line_fields = EI_INIT; static expert_field ei_sdp_invalid_line_space = EI_INIT; +static expert_field ei_sdp_invalid_conversion = EI_INIT; #define SDP_RTP_PROTO 0x00000001 #define SDP_SRTP_PROTO 0x00000002 @@ -1109,7 +1116,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset end_offset = offset + tokenlen; #if 0 - proto_tree_add_text(tree, tvb, offset, tokenlen, "Debug; Analysed string: '%s'", + proto_tree_add_debug(tree, tvb, offset, tokenlen, "Debug; Analysed string: '%s'", tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tokenlen, ENC_ASCII)); #endif @@ -1126,7 +1133,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset tokenlen = next_offset - offset; field_name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tokenlen, ENC_UTF_8|ENC_NA); #if 0 - proto_tree_add_text(tree, tvb, offset, tokenlen, "Debug; MIMEtype '%s'Parameter name: '%s'", mime_type, field_name); */ + proto_tree_add_debug(tree, tvb, offset, tokenlen, "Debug; MIMEtype '%s'Parameter name: '%s'", mime_type, field_name); */ #endif offset = next_offset; @@ -1193,7 +1200,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset format_specific_parameter = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tokenlen, ENC_UTF_8|ENC_NA); data_tvb = ascii_bytes_to_tvb(tvb, pinfo, tokenlen, format_specific_parameter); if (!data_tvb) { - proto_tree_add_text(tree, tvb, offset, tokenlen, "Could not convert '%s' to 3 bytes", format_specific_parameter); + proto_tree_add_expert_format(tree, pinfo, &ei_sdp_invalid_conversion, tvb, offset, tokenlen, "Could not convert '%s' to 3 bytes", format_specific_parameter); return; } length = tvb_length(data_tvb); @@ -1202,7 +1209,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset dissect_h264_profile(data_tvb, pinfo, tree); } } else { - item = proto_tree_add_text(tree, tvb, offset, tokenlen, "Incorrectly coded, must be three bytes"); + item = proto_tree_add_expert_format(tree, pinfo, &ei_sdp_invalid_conversion, tvb, offset, tokenlen, "Incorrectly coded, must be three bytes"); PROTO_ITEM_SET_GENERATED(item); } } else if (strcmp(field_name, "packetization-mode") == 0) { @@ -1236,9 +1243,8 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset } data_p = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tokenlen, ENC_UTF_8|ENC_NA); - proto_tree_add_text(tree, tvb, offset, tokenlen, "NAL unit 1 string: %s", data_p); + proto_tree_add_string(tree, hf_sdp_nal_unit_1_string, tvb, offset, tokenlen, data_p); - /* proto_tree_add_text(tree, tvb, offset, tokenlen, "String %s", data_p); */ data_tvb = base64_to_tvb(tvb, data_p); add_new_data_source(pinfo, data_tvb, "h264 prop-parameter-sets"); @@ -1255,7 +1261,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset offset = comma_offset +1; tokenlen = end_offset - offset; data_p = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tokenlen, ENC_UTF_8|ENC_NA); - proto_tree_add_text(tree, tvb, offset, tokenlen, "NAL unit 2 string: %s", data_p); + proto_tree_add_string(tree, hf_sdp_nal_unit_2_string, tvb, offset, tokenlen, data_p); data_tvb = base64_to_tvb(tvb, data_p); add_new_data_source(pinfo, data_tvb, "h264 prop-parameter-sets 2"); dissect_h264_nal_unit(data_tvb, pinfo, tree); @@ -1662,13 +1668,13 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto key_salt_tvb = base64_to_tvb(tvb, data_p); add_new_data_source(pinfo, key_salt_tvb, "Key_Salt_tvb"); if (master_key_length != 0) { - proto_tree_add_text(parameter_tree, tvb, offset, tokenlen, "Key and Salt"); + proto_tree_add_item(parameter_tree, hf_sdp_key_and_salt, tvb, offset, tokenlen, ENC_NA); proto_tree_add_item(parameter_tree, hf_sdp_crypto_master_key, key_salt_tvb, 0, master_key_length, ENC_NA); proto_tree_add_item(parameter_tree, hf_sdp_crypto_master_salt, key_salt_tvb, master_key_length, master_salt_length, ENC_NA); } else { - proto_tree_add_text(parameter_tree, key_salt_tvb, 0, -1, "Key and Salt"); + proto_tree_add_item(parameter_tree, hf_sdp_key_and_salt, key_salt_tvb, 0, -1, ENC_NA); } /* ["|" lifetime] ["|" mki] are optional */ @@ -2609,7 +2615,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) datalen = tvb_length_remaining(tvb, offset); if (datalen > 0) { - proto_tree_add_text(sdp_tree, tvb, offset, datalen, "Data (%d bytes)", datalen); + proto_tree_add_item(sdp_tree, hf_sdp_data, tvb, offset, datalen, ENC_NA); } /* Report this packet to the tap */ tap_queue_packet(sdp_tap, pinfo, sdp_pi); @@ -2969,6 +2975,11 @@ proto_register_sdp(void) FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_sdp_nal_unit_1_string, { "NAL unit 1 string", "sdp.nal_unit_1_string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_sdp_nal_unit_2_string, { "NAL unit 2 string", "sdp.nal_unit_2_string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_sdp_key_and_salt, { "Key and Salt", "sdp.key_and_salt", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_sdp_data, { "Data", "sdp.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_sdp, @@ -3015,6 +3026,13 @@ proto_register_sdp(void) "Invalid SDP whitespace (extra space character)", EXPFILL } + }, + { &ei_sdp_invalid_conversion, + { "sdp.invalid_conversion", + PI_PROTOCOL, PI_WARN, + "Invalid conversion", + EXPFILL + } } }; diff --git a/epan/dissectors/packet-ses.c b/epan/dissectors/packet-ses.c index e7720b1b95..6111634120 100644 --- a/epan/dissectors/packet-ses.c +++ b/epan/dissectors/packet-ses.c @@ -148,6 +148,8 @@ static const value_string token_setting_vals[] = { { 0, NULL } }; +static const true_false_string tfs_released_kept = { "Released", "Kept" }; + static int hf_release_token_setting = -1; static int hf_major_activity_token_setting = -1; static int hf_synchronize_minor_token_setting = -1; @@ -177,10 +179,23 @@ static int hf_large_initial_serial_number = -1; /* large second initial serial number */ static int hf_large_second_initial_serial_number = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_ses_reason_code = -1; +static int hf_ses_transport_implementation_restriction = -1; +static int hf_ses_transport_no_reason = -1; +static int hf_ses_parameter_group_inside_parameter_group = -1; +static int hf_ses_user_data = -1; +static int hf_ses_parameter_type = -1; +static int hf_ses_transport_protocol_error = -1; +static int hf_ses_transport_user_abort = -1; +static int hf_ses_parameter_length = -1; +static int hf_ses_transport_connection = -1; + /* clses header fields */ static int proto_clses = -1; static expert_field ei_ses_bad_length = EI_INIT; +static expert_field ei_ses_bad_parameter_length = EI_INIT; #define PROTO_STRING_CLSES "ISO 9548-1 OSI Connectionless Session Protocol" @@ -336,8 +351,7 @@ call_pres_dissector(tvbuff_t *tvb, int offset, guint16 param_len, /* No - display as data */ if (tree) { - proto_tree_add_text(param_tree, tvb, offset, param_len, - "User data"); + proto_tree_add_item(param_tree, hf_ses_user_data, tvb, offset, param_len, ENC_NA); } } else @@ -466,21 +480,11 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 flags8; flags8 = tvb_get_guint8(tvb, offset); - if(flags8 & transport_connection_is_released ) - { - proto_tree_add_text(param_tree, tvb, offset, 1, - "transport connection is released"); - } - else - { - proto_tree_add_text(param_tree, tvb, offset, 1, - "transport connection is kept"); - } + proto_tree_add_item(param_tree, hf_ses_transport_connection, tvb, offset, 1, ENC_NA); + proto_tree_add_item(param_tree, hf_ses_transport_user_abort, tvb, offset, 1, ENC_NA); if(flags8 & user_abort ) { - proto_tree_add_text(param_tree, tvb, offset, 1, - "user abort"); session->abort_type = SESSION_USER_ABORT; } else @@ -488,23 +492,10 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree, session->abort_type = SESSION_PROVIDER_ABORT; } - if(flags8 & protocol_error ) - { - proto_tree_add_text(param_tree, tvb, offset, 1, - "protocol error"); - } - if(flags8 & no_reason ) - { - proto_tree_add_text(param_tree, tvb, offset, 1, - "no reason"); - } - - if(flags8 & implementation_restriction ) - { - proto_tree_add_text(param_tree, tvb, offset, 1, - "implementation restriction"); - } + proto_tree_add_item(param_tree, hf_ses_transport_protocol_error, tvb, offset, 1, ENC_NA); + proto_tree_add_item(param_tree, hf_ses_transport_no_reason, tvb, offset, 1, ENC_NA); + proto_tree_add_item(param_tree, hf_ses_transport_implementation_restriction, tvb, offset, 1, ENC_NA); } break; @@ -750,15 +741,8 @@ PICS. */ "Length is %u, should be >= 1", param_len); break; } - if (tree) - { - guint8 reason_code; - reason_code = tvb_get_guint8(tvb, offset); - proto_tree_add_text(param_tree, tvb, offset, 1, - "Reason Code: %s", - val_to_str_ext(reason_code, &reason_vals_ext, "Unknown (%u)")); - } + proto_tree_add_item(param_tree, hf_ses_reason_code, tvb, offset, 1, ENC_NA); offset++; param_len--; if (param_len != 0) @@ -860,28 +844,23 @@ dissect_parameter_group(tvbuff_t *tvb, int offset, proto_tree *tree, ett_ses_param, &ti, val_to_str_ext(param_type, ¶m_vals_ext, "Unknown parameter type (0x%02x)")); param_str = val_to_str_ext_const(param_type, ¶m_vals_ext, "Unknown"); - proto_tree_add_text(param_tree, tvb, offset, 1, - "Parameter type: %s", param_str); + proto_tree_add_item(param_tree, hf_ses_parameter_type, tvb, offset, 1, ENC_NA); offset++; pg_len--; param_len = get_item_len(tvb, offset, &len_len); if (len_len > pg_len) { proto_item_set_len(ti, pg_len + 1); - proto_tree_add_text(param_tree, tvb, offset, pg_len, - "Parameter length doesn't fit in parameter"); + proto_tree_add_expert_format(param_tree, pinfo, &ei_ses_bad_parameter_length, tvb, offset, pg_len, "Parameter length doesn't fit in parameter"); return has_user_information; } pg_len -= len_len; if (param_len > pg_len) { proto_item_set_len(ti, pg_len + 1 + len_len); - proto_tree_add_text(param_tree, tvb, offset, pg_len, - "Parameter length: %u, should be <= %u", - param_len, pg_len); + proto_tree_add_expert_format(param_tree, pinfo, &ei_ses_bad_parameter_length, tvb, offset, pg_len, "Parameter length: %u, should be <= %u", param_len, pg_len); return has_user_information; } proto_item_set_len(ti, 1 + len_len + param_len); - param_len_item = proto_tree_add_text(param_tree, tvb, offset, len_len, - "Parameter length: %u", param_len); + param_len_item = proto_tree_add_uint(param_tree, hf_ses_parameter_length, tvb, offset, len_len, param_len); offset += len_len; if (param_str != NULL) @@ -894,9 +873,7 @@ dissect_parameter_group(tvbuff_t *tvb, int offset, proto_tree *tree, case Connect_Accept_Item: case Connection_Identifier: case Linking_Information: - proto_tree_add_text(param_tree, tvb, offset, - param_len, - "Parameter group inside parameter group"); + proto_tree_add_item(param_tree, hf_ses_parameter_group_inside_parameter_group, tvb, offset, param_len, ENC_NA); break; default: @@ -937,28 +914,23 @@ dissect_parameters(tvbuff_t *tvb, int offset, guint16 len, proto_tree *tree, val_to_str_ext(param_type, ¶m_vals_ext, "Unknown parameter type (0x%02x)")); param_str = val_to_str_ext_const(param_type, ¶m_vals_ext, "Unknown"); - proto_tree_add_text(param_tree, tvb, offset, 1, - "Parameter type: %s", param_str); + proto_tree_add_item(param_tree, hf_ses_parameter_type, tvb, offset, 1, ENC_NA); offset++; len--; param_len = get_item_len(tvb, offset, &len_len); if (len_len > len) { proto_item_set_len(ti, len + 1 ); - proto_tree_add_text(param_tree, tvb, offset, len, - "Parameter length doesn't fit in parameter"); + proto_tree_add_expert_format(param_tree, pinfo, &ei_ses_bad_parameter_length, tvb, offset, len, "Parameter length doesn't fit in parameter"); return has_user_information; } len -= len_len; if (param_len > len) { proto_item_set_len(ti, len + 1 + len_len); - proto_tree_add_text(param_tree, tvb, offset, len, - "Parameter length: %u, should be <= %u", - param_len, len); + proto_tree_add_expert_format(param_tree, pinfo, &ei_ses_bad_parameter_length, tvb, offset, len, "Parameter length: %u, should be <= %u", param_len, len); return has_user_information; } proto_item_set_len(ti, 1 + len_len + param_len); - param_len_item = proto_tree_add_text(param_tree, tvb, offset, len_len, - "Parameter length: %u", param_len); + param_len_item = proto_tree_add_uint(param_tree, hf_ses_parameter_length, tvb, offset, len_len, param_len); offset += len_len; if (param_str != NULL) @@ -1953,7 +1925,19 @@ proto_register_ses(void) NULL, 0x00, "This SES packet is reassembled in this frame", HFILL } }, { &hf_ses_reassembled_length, { "Reassembled SES length", "ses.reassembled.length", FT_UINT32, BASE_DEC, - NULL, 0x00, "The total length of the reassembled payload", HFILL } } + NULL, 0x00, "The total length of the reassembled payload", HFILL } }, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_ses_user_data, { "User data", "ses.user_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ses_transport_connection, { "Transport connection", "ses.transport_flags.connection", FT_BOOLEAN, 8, TFS(&tfs_released_kept), transport_connection_is_released, NULL, HFILL }}, + { &hf_ses_transport_user_abort, { "User abort", "ses.transport_flags.user_abort", FT_BOOLEAN, 8, TFS(&tfs_yes_no), user_abort, NULL, HFILL }}, + { &hf_ses_transport_protocol_error, { "Protocol error", "ses.transport_flags.protocol_error", FT_BOOLEAN, 8, TFS(&tfs_yes_no), protocol_error, NULL, HFILL }}, + { &hf_ses_transport_no_reason, { "No reason", "ses.transport_flags.no_reason", FT_BOOLEAN, 8, TFS(&tfs_yes_no), no_reason, NULL, HFILL }}, + { &hf_ses_transport_implementation_restriction, { "Implementation restriction", "ses.transport_flags.implementation_restriction", FT_BOOLEAN, 8, TFS(&tfs_yes_no), implementation_restriction, NULL, HFILL }}, + { &hf_ses_reason_code, { "Reason Code", "ses.reason_code", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &reason_vals_ext, 0x0, NULL, HFILL }}, + { &hf_ses_parameter_type, { "Parameter type", "ses.parameter_type", FT_UINT8, BASE_DEC|BASE_EXT_STRING, ¶m_vals_ext, 0x0, NULL, HFILL }}, + { &hf_ses_parameter_length, { "Parameter length", "ses.parameter_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ses_parameter_group_inside_parameter_group, { "Parameter group inside parameter group", "ses.parameter_group_inside_parameter_group", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = @@ -1971,6 +1955,7 @@ proto_register_ses(void) static ei_register_info ei[] = { { &ei_ses_bad_length, { "ses.bad_length", PI_MALFORMED, PI_ERROR, "Bad length", EXPFILL }}, + { &ei_ses_bad_parameter_length, { "ses.bad_parameter_length", PI_MALFORMED, PI_ERROR, "Bad parameter length", EXPFILL }}, }; module_t *ses_module; diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c index ebb16d60c9..44f170a52b 100644 --- a/epan/dissectors/packet-smb2.c +++ b/epan/dissectors/packet-smb2.c @@ -31,6 +31,7 @@ #include "config.h" #include <epan/packet.h> +#include <epan/expert.h> #include <epan/conversation.h> #include <epan/tap.h> #include <epan/wmem/wmem.h> @@ -346,6 +347,9 @@ static int hf_smb2_transform_reserved = -1; static int hf_smb2_encryption_aes128_ccm = -1; static int hf_smb2_transform_enc_alg = -1; static int hf_smb2_transform_encrypted_data = -1; +static int hf_smb2_server_component_smb2 = -1; +static int hf_smb2_server_component_smb2_transform = -1; +static int hf_smb2_truncated = -1; static gint ett_smb2 = -1; static gint ett_smb2_olb = -1; @@ -423,6 +427,9 @@ static gint ett_smb2_lock_flags = -1; static gint ett_smb2_transform_enc_alg = -1; static gint ett_smb2_buffercode = -1; +static expert_field ei_smb2_invalid_length = EI_INIT; +static expert_field ei_smb2_bad_response = EI_INIT; + static int smb2_tap = -1; static int smb2_eo_tap = -1; @@ -934,7 +941,7 @@ dissect_smb2_olb_string(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *t tvb_ensure_bytes_exist(tvb, off, len); if (((off+len)<off) || ((off+len)>(off+tvb_reported_length_remaining(tvb, off)))) { - proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), + proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, "Invalid offset/length. Malformed packet"); col_append_str(pinfo->cinfo, COL_INFO, " [Malformed packet]"); @@ -1009,7 +1016,7 @@ dissect_smb2_olb_buffer(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *t tvb_ensure_bytes_exist(tvb, off, len); if (((off+len)<off) || ((off+len)>(off+tvb_reported_length_remaining(tvb, off)))) { - proto_tree_add_text(parent_tree, tvb, offset, tvb_length_remaining(tvb, offset), + proto_tree_add_expert_format(parent_tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, "Invalid offset/length. Malformed packet"); col_append_str(pinfo->cinfo, COL_INFO, " [Malformed packet]"); @@ -3007,7 +3014,7 @@ static void dissect_smb2_file_directory_info(tvbuff_t *tvb, packet_info *pinfo _ offset = old_offset+next_offset; if (offset < old_offset) { - proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), + proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, "Invalid offset/length. Malformed packet"); return; } @@ -3094,7 +3101,7 @@ static void dissect_smb2_full_directory_info(tvbuff_t *tvb, packet_info *pinfo _ offset = old_offset+next_offset; if (offset < old_offset) { - proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), + proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, "Invalid offset/length. Malformed packet"); return; } @@ -3202,7 +3209,7 @@ static void dissect_smb2_both_directory_info(tvbuff_t *tvb, packet_info *pinfo _ offset = old_offset+next_offset; if (offset < old_offset) { - proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), + proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, "Invalid offset/length. Malformed packet"); return; } @@ -3262,7 +3269,7 @@ static void dissect_smb2_file_name_info(tvbuff_t *tvb, packet_info *pinfo _U_, p offset = old_offset+next_offset; if (offset < old_offset) { - proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), + proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, "Invalid offset/length. Malformed packet"); return; } @@ -3377,7 +3384,7 @@ static void dissect_smb2_id_both_directory_info(tvbuff_t *tvb, packet_info *pinf offset = old_offset+next_offset; if (offset < old_offset) { - proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), + proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, "Invalid offset/length. Malformed packet"); return; } @@ -3822,7 +3829,7 @@ dissect_smb2_infolevel(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* if we get BUFFER_OVERFLOW there will be truncated data */ if (si->status == 0x80000005) { proto_item *item; - item = proto_tree_add_text(tree, tvb, old_offset, 0, "Truncated..."); + item = proto_tree_add_item(tree, hf_smb2_truncated, tvb, old_offset, 0, ENC_NA); PROTO_ITEM_SET_GENERATED(item); } return offset; @@ -5042,10 +5049,10 @@ dissect_smb2_read_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } static void -report_create_context_malformed_buffer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, const char *buffer_desc) +report_create_context_malformed_buffer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const char *buffer_desc) { - proto_tree_add_text(tree, tvb, 0, tvb_length_remaining(tvb, 0), - "%s SHOULD NOT be generated. Malformed packet", buffer_desc); + proto_tree_add_expert_format(tree, pinfo, &ei_smb2_bad_response, tvb, 0, -1, + "%s SHOULD NOT be generated", buffer_desc); } static void dissect_smb2_ExtA_buffer_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) @@ -6908,8 +6915,6 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea proto_tree *tree = NULL; proto_item *header_item = NULL; proto_tree *header_tree = NULL; - proto_item *flags_item = NULL; - proto_tree *flags_tree = NULL; int offset = 0; int chain_offset = 0; const char *label = smb_header_label; @@ -6978,7 +6983,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea if (!smb2_transform_header) { /* SMB2 marker */ - proto_tree_add_text(header_tree, tvb, offset, 4, "Server Component: SMB2"); + proto_tree_add_item(header_tree, hf_smb2_server_component_smb2, tvb, offset, 4, ENC_NA); offset += 4; /* we need the flags before we know how to parse the credits field */ @@ -7020,16 +7025,18 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea /* flags */ if (header_tree) { - flags_item = proto_tree_add_uint_format(header_tree, hf_smb2_flags, tvb, offset, 4, si->flags, - "Flags: 0x%08x", si->flags); - flags_tree = proto_item_add_subtree(flags_item, ett_smb2_flags); - - proto_tree_add_boolean(flags_tree, hf_smb2_flags_response, tvb, offset, 4, si->flags); - proto_tree_add_boolean(flags_tree, hf_smb2_flags_async_cmd, tvb, offset, 4, si->flags); - proto_tree_add_boolean(flags_tree, hf_smb2_flags_chained, tvb, offset, 4, si->flags); - proto_tree_add_boolean(flags_tree, hf_smb2_flags_signature, tvb, offset, 4, si->flags); - proto_tree_add_boolean(flags_tree, hf_smb2_flags_dfs_op, tvb, offset, 4, si->flags); - proto_tree_add_boolean(flags_tree, hf_smb2_flags_replay_operation, tvb, offset, 4, si->flags); + static const int * flags[] = { + &hf_smb2_flags_response, + &hf_smb2_flags_async_cmd, + &hf_smb2_flags_chained, + &hf_smb2_flags_signature, + &hf_smb2_flags_dfs_op, + &hf_smb2_flags_replay_operation, + NULL + }; + + proto_tree_add_bitmask(header_tree, tvb, offset, hf_smb2_flags, + ett_smb2_flags, flags, ENC_LITTLE_ENDIAN); } offset += 4; @@ -7169,7 +7176,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea tvbuff_t *plain_tvb = NULL; /* SMB2_TRANSFORM marker */ - proto_tree_add_text(header_tree, tvb, offset, 4, "Server Component: SMB2_TRANSFORM"); + proto_tree_add_item(header_tree, hf_smb2_server_component_smb2_transform, tvb, offset, 4, ENC_NA); offset += 4; offset = dissect_smb2_transform_header(pinfo, header_tree, tvb, offset, sti, @@ -8345,6 +8352,17 @@ proto_register_smb2(void) { "Data", "smb2.header.transform.enc_data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, + { &hf_smb2_server_component_smb2, + { "Server Component: SMB2", "smb2.server_component_smb2", FT_NONE, BASE_NONE, + NULL, 0, NULL, HFILL }}, + + { &hf_smb2_server_component_smb2_transform, + { "Server Component: SMB2_TRANSFORM", "smb2.server_component_smb2_transform", FT_NONE, BASE_NONE, + NULL, 0, NULL, HFILL }}, + + { &hf_smb2_truncated, + { "Truncated...", "smb2.truncated", FT_NONE, BASE_NONE, + NULL, 0, NULL, HFILL }}, }; static gint *ett[] = { @@ -8425,10 +8443,19 @@ proto_register_smb2(void) &ett_smb2_buffercode, }; + static ei_register_info ei[] = { + { &ei_smb2_invalid_length, { "smb2.invalid_length", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }}, + { &ei_smb2_bad_response, { "smb2.bad_response", PI_MALFORMED, PI_ERROR, "Bad response", EXPFILL }}, + }; + + expert_module_t* expert_smb2; + proto_smb2 = proto_register_protocol("SMB2 (Server Message Block Protocol version 2)", "SMB2", "smb2"); proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_smb2, hf, array_length(hf)); + expert_smb2 = expert_register_protocol(proto_smb2); + expert_register_field_array(expert_smb2, ei, array_length(ei)); smb2_module = prefs_register_protocol(proto_smb2, NULL); prefs_register_bool_preference(smb2_module, "eosmb2_take_name_as_fid", diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index 86910a1b76..4e913bb7ab 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -73,8 +73,6 @@ static int hf_tacacs_password = -1; static gint ett_tacacs = -1; -static expert_field ei_tacplus_packet_len_invalid = EI_INIT; - static gboolean tacplus_preference_desegment = TRUE; static const char *tacplus_opt_key; @@ -351,6 +349,14 @@ static int hf_tacplus_body_acct_server_msg_len = -1; static int hf_tacplus_body_acct_server_msg = -1; static int hf_tacplus_body_acct_data_len = -1; static int hf_tacplus_body_acct_data = -1; +static int hf_tacplus_data = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_tacplus_ascii_length = -1; +static int hf_tacplus_arap_data_length = -1; +static int hf_tacplus_mschap_data_length = -1; +static int hf_tacplus_chap_data_length = -1; +static int hf_tacplus_password_length = -1; +static int hf_tacplus_data_length = -1; static gint ett_tacplus = -1; static gint ett_tacplus_body = -1; @@ -358,6 +364,9 @@ static gint ett_tacplus_body_chap = -1; static gint ett_tacplus_flags = -1; static gint ett_tacplus_acct_flags = -1; +static expert_field ei_tacplus_packet_len_invalid = EI_INIT; +static expert_field ei_tacplus_bogus_data = EI_INIT; + typedef struct _tacplus_key_entry { address *s; /* Server address */ address *c; /* client address */ @@ -465,20 +474,20 @@ dissect_tacplus_body_authen_req_login( tvbuff_t* tvb, proto_tree *tree, int var_ switch ( tvb_get_guint8(tvb, AUTHEN_S_AUTHEN_TYPE_OFF ) ) { /* authen_type */ case TAC_PLUS_AUTHEN_TYPE_ASCII: - proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "Data: %d (not used)", val ); + proto_tree_add_item(tree, hf_tacplus_ascii_length, tvb, AUTHEN_S_DATA_LEN_OFF, 1, ENC_NA); if( val ) - proto_tree_add_text( tree, tvb, var_off, val, "Data" ); + proto_tree_add_item( tree, hf_tacplus_data, tvb, var_off, val, ENC_NA); break; case TAC_PLUS_AUTHEN_TYPE_PAP: - proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "Password Length %d", val ); + proto_tree_add_item(tree, hf_tacplus_password_length, tvb, AUTHEN_S_DATA_LEN_OFF, 1, ENC_NA); if( val ) { proto_tree_add_item(tree, hf_tacplus_auth_password, tvb, var_off, val, ENC_ASCII|ENC_NA); } break; case TAC_PLUS_AUTHEN_TYPE_CHAP: - proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "CHAP Data Length %d", val ); + proto_tree_add_item(tree, hf_tacplus_chap_data_length, tvb, AUTHEN_S_DATA_LEN_OFF, 1, ENC_NA); if( val ) { proto_tree *pt; guint8 chal_len=val-(1+16); /* Response field alwayes 16 octets */ @@ -491,7 +500,7 @@ dissect_tacplus_body_authen_req_login( tvbuff_t* tvb, proto_tree *tree, int var_ } break; case TAC_PLUS_AUTHEN_TYPE_MSCHAP: - proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "MSCHAP Data Length %d", val ); + proto_tree_add_item(tree, hf_tacplus_mschap_data_length, tvb, AUTHEN_S_DATA_LEN_OFF, 1, ENC_NA); if( val ) { proto_tree *pt; guint8 chal_len=val-(1+49); /* Response field alwayes 49 octets */ @@ -504,7 +513,7 @@ dissect_tacplus_body_authen_req_login( tvbuff_t* tvb, proto_tree *tree, int var_ } break; case TAC_PLUS_AUTHEN_TYPE_ARAP: - proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "ARAP Data Length %d", val ); + proto_tree_add_item(tree, hf_tacplus_arap_data_length, tvb, AUTHEN_S_DATA_LEN_OFF, 1, ENC_NA); if( val ) { proto_tree *pt; pt = proto_tree_add_subtree(tree, tvb, var_off, val, ett_tacplus_body_chap, NULL, "ARAP Data" ); @@ -517,9 +526,9 @@ dissect_tacplus_body_authen_req_login( tvbuff_t* tvb, proto_tree *tree, int var_ break; default: /* Should not be reached */ - proto_tree_add_text( tree, tvb, AUTHEN_S_DATA_LEN_OFF, 1, "Data: %d", val ); + proto_tree_add_item(tree, hf_tacplus_data_length, tvb, AUTHEN_S_DATA_LEN_OFF, 1, ENC_NA); if( val ){ - proto_tree_add_text( tree, tvb, var_off, val, "Data" ); + proto_tree_add_item( tree, hf_tacplus_data, tvb, var_off, val, ENC_NA); } } } @@ -566,7 +575,7 @@ dissect_tacplus_body_authen_req_cont( tvbuff_t *tvb, proto_tree *tree ) val=tvb_get_ntohs( tvb, AUTHEN_C_DATA_LEN_OFF ); proto_tree_add_uint(tree, hf_tacplus_body_authen_req_cont_data_length, tvb, AUTHEN_C_DATA_LEN_OFF, 2, val); if( val ){ - proto_tree_add_text( tree, tvb, var_off, val, "Data" ); + proto_tree_add_item( tree, hf_tacplus_data, tvb, var_off, val, ENC_NA ); } } @@ -597,7 +606,7 @@ dissect_tacplus_body_authen_rep( tvbuff_t *tvb, proto_tree *tree ) val=tvb_get_ntohs(tvb, AUTHEN_R_DATA_LEN_OFF ); proto_tree_add_uint(tree, hf_tacplus_body_authen_rep_server_data_len, tvb, AUTHEN_R_DATA_LEN_OFF, 2, val); if( val ){ - proto_tree_add_text(tree, tvb, var_off, val, "Data" ); + proto_tree_add_item(tree, hf_tacplus_data, tvb, var_off, val, ENC_NA ); } } @@ -703,7 +712,7 @@ dissect_tacplus_body_acct_rep( tvbuff_t* tvb, proto_tree *tree ) static void -dissect_tacplus_body(tvbuff_t * hdr_tvb, tvbuff_t * tvb, proto_tree * tree ) +dissect_tacplus_body(tvbuff_t * hdr_tvb, packet_info *pinfo, tvbuff_t * tvb, proto_tree * tree ) { int type = tvb_get_guint8( hdr_tvb, H_TYPE_OFF ); int seq_no = tvb_get_guint8( hdr_tvb, H_SEQ_NO_OFF ); @@ -732,7 +741,7 @@ dissect_tacplus_body(tvbuff_t * hdr_tvb, tvbuff_t * tvb, proto_tree * tree ) dissect_tacplus_body_acct_rep( tvb, tree ); break; default: - proto_tree_add_text( tree, tvb, 0, tvb_length( tvb ), "Bogus.."); + proto_tree_add_expert( tree, pinfo, &ei_tacplus_bogus_data, tvb, 0, -1); break; } } @@ -968,7 +977,7 @@ dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) body_tree = proto_tree_add_subtree_format(tacplus_tree, new_tvb, 0, len, ett_tacplus_body, NULL, "Decrypted %s", request?"Request":"Reply" ); } - dissect_tacplus_body( tvb, new_tvb, body_tree); + dissect_tacplus_body( tvb, pinfo, new_tvb, body_tree); } } } @@ -1223,6 +1232,18 @@ proto_register_tacplus(void) { "Data", "tacplus.body_acct.data", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_tacplus_data, + { "Data", "tacplus.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_tacplus_ascii_length, { "ASCII Data Length", "tacplus.ascii_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_tacplus_password_length, { "Password Length", "tacplus.password_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_tacplus_chap_data_length, { "CHAP Data Length", "tacplus.chap_data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_tacplus_mschap_data_length, { "MSCHAP Data Length", "tacplus.mschap_data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_tacplus_arap_data_length, { "ARAP Data Length", "tacplus.arap_data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_tacplus_data_length, { "Data", "tacplus.data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_tacplus, @@ -1234,6 +1255,7 @@ proto_register_tacplus(void) static ei_register_info ei[] = { { &ei_tacplus_packet_len_invalid, { "tacplus.packet_len.invalid", PI_PROTOCOL, PI_WARN, "Invalid length", EXPFILL }}, + { &ei_tacplus_bogus_data, { "tacplus.bogus_data", PI_PROTOCOL, PI_WARN, "Bogus data", EXPFILL }}, }; module_t *tacplus_module; diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index c6225f1ca2..7f89b96143 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -267,6 +267,10 @@ static int hf_tcp_proc_dst_pid = -1; static int hf_tcp_proc_dst_uname = -1; static int hf_tcp_proc_dst_cmd = -1; static int hf_tcp_segment_data = -1; +static int hf_tcp_reset_cause = -1; +static int hf_tcp_fin_retransmission = -1; +static int hf_tcp_option_rvbd_probe_reserved = -1; +static int hf_tcp_option_scps_binding_data = -1; static gint ett_tcp = -1; static gint ett_tcp_flags = -1; @@ -325,6 +329,7 @@ static expert_field ei_tcp_connection_rst = EI_INIT; static expert_field ei_tcp_checksum_ffff = EI_INIT; static expert_field ei_tcp_checksum_bad = EI_INIT; static expert_field ei_tcp_urgent_pointer_non_zero = EI_INIT; +static expert_field ei_tcp_suboption_malformed = EI_INIT; /* Some protocols such as encrypted DCE/RPCoverHTTP have dependencies * from one PDU to the next PDU and require that they are called in sequence. @@ -2617,8 +2622,7 @@ dissect_tcpopt_sack(const ip_tcp_opt *optp, tvbuff_t *tvb, while (optlen > 0) { if (optlen < 4) { - proto_tree_add_text(field_tree, tvb, offset, optlen, - "(suboption would go past end of option)"); + proto_tree_add_expert(field_tree, pinfo, &ei_tcp_suboption_malformed, tvb, offset, optlen); break; } leftedge = tvb_get_ntohl(tvb, offset)-base_ack; @@ -2629,8 +2633,7 @@ dissect_tcpopt_sack(const ip_tcp_opt *optp, tvbuff_t *tvb, optlen -= 4; if (optlen < 4) { - proto_tree_add_text(field_tree, tvb, offset, optlen, - "(suboption would go past end of option)"); + proto_tree_add_expert(field_tree, pinfo, &ei_tcp_suboption_malformed, tvb, offset, optlen); break; } /* XXX - check whether it goes past end of packet */ @@ -3195,10 +3198,7 @@ dissect_tcpopt_scps(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, /* Step past the binding space and length octets */ local_offset += 2; - proto_tree_add_text(field_tree, tvb, offset + local_offset, - extended_cap_length, - "Binding Space Data (%u bytes)", - extended_cap_length); + proto_tree_add_item(field_tree, hf_tcp_option_scps_binding_data, tvb, offset + local_offset, extended_cap_length, ENC_NA); tcp_info_append_uint(pinfo, "EXCAP", binding_space); @@ -3268,7 +3268,7 @@ verify_scps(packet_info *pinfo, proto_item *tf_syn, struct tcp_analysis *tcpd) * Transport Protocol (SCPS-TP)" Section 3.5 for definition of the SNACK option */ static void -dissect_tcpopt_snack(const ip_tcp_opt *optp, tvbuff_t *tvb, +dissect_tcpopt_snack(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree, void *data _U_) { @@ -3299,16 +3299,11 @@ dissect_tcpopt_snack(const ip_tcp_opt *optp, tvbuff_t *tvb, offset, optlen, TRUE); PROTO_ITEM_SET_HIDDEN(hidden_item); - hidden_item = proto_tree_add_uint(opt_tree, hf_tcp_option_snack_offset, + proto_tree_add_uint(opt_tree, hf_tcp_option_snack_offset, tvb, offset, optlen, relative_hole_offset); - PROTO_ITEM_SET_HIDDEN(hidden_item); - hidden_item = proto_tree_add_uint(opt_tree, hf_tcp_option_snack_size, + proto_tree_add_uint(opt_tree, hf_tcp_option_snack_size, tvb, offset, optlen, relative_hole_size); - PROTO_ITEM_SET_HIDDEN(hidden_item); - proto_tree_add_text(opt_tree, tvb, offset, optlen, - "%s: Offset %u, Size %u", optp->name, - relative_hole_offset, relative_hole_size); ack = tvb_get_ntohl(tvb, 8); @@ -3338,14 +3333,12 @@ dissect_tcpopt_snack(const ip_tcp_opt *optp, tvbuff_t *tvb, hidden_item = proto_tree_add_uint(opt_tree, hf_tcp_option_snack_re, tvb, offset, optlen, hole_end); PROTO_ITEM_SET_HIDDEN(hidden_item); - proto_tree_add_text(opt_tree, tvb, offset, optlen, - "\tMissing Sequence %u - %u %s", - hole_start, hole_end, modifier); + + proto_tree_add_expert_format(opt_tree, pinfo, &ei_tcp_option_snack_sequence, tvb, offset, optlen, + "SNACK Sequence %u - %u %s", hole_start, hole_end, modifier); tcp_info_append_uint(pinfo, "SNLE", hole_start); tcp_info_append_uint(pinfo, "SNRE", hole_end); - - expert_add_info_format(pinfo, NULL, &ei_tcp_option_snack_sequence, "SNACK Sequence %u - %u %s", hole_start, hole_end, modifier); } } @@ -3479,8 +3472,7 @@ dissect_tcpopt_rvbd_probe(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int offset, if (type == PROBE_INTERNAL) return; - proto_tree_add_text(field_tree, tvb, offset + PROBE_V1_RESERVED_OFFSET, - 1, "Reserved"); + proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_reserved, tvb, offset + PROBE_V1_RESERVED_OFFSET, 1, ENC_NA); ip = tvb_get_ipv4(tvb, offset + PROBE_V1_PROBER_OFFSET); proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_prober, tvb, @@ -4396,12 +4388,9 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!pinfo->fragmented && !pinfo->flags.in_error_pkt) { if (reported_len < tcph->th_hlen) { - proto_item *pi; - pi = proto_tree_add_text(tcp_tree, tvb, offset, 0, + proto_tree_add_expert_format(tcp_tree, pinfo, &ei_tcp_short_segment, tvb, offset, 0, "Short segment. Segment/fragment does not contain a full TCP header" " (might be NMAP or someone else deliberately sending unusual packets)"); - PROTO_ITEM_SET_GENERATED(pi); - expert_add_info(pinfo, pi, &ei_tcp_short_segment); tcph->th_have_seglen = FALSE; } else { /* Compute the length of data in this segment. */ @@ -4943,8 +4932,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * the final FIN transmitted via a different path). * XXX - we need to flag retransmissions a bit better. */ - proto_tree_add_text(tcp_tree, tvb, 0, 0, "Retransmission of FIN from frame %u", - tcpd->fwd->fin); + proto_tree_add_uint(tcp_tree, hf_tcp_fin_retransmission, tvb, 0, 0, tcpd->fwd->fin); } } @@ -4997,9 +4985,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * * so for segments with RST we just display the data as text. */ - proto_tree_add_text(tcp_tree, tvb, offset, captured_length_remaining, - "Reset cause: %s", - tvb_format_text(tvb, offset, captured_length_remaining)); + proto_tree_add_item(tcp_tree, hf_tcp_reset_cause, tvb, offset, captured_length_remaining, ENC_NA|ENC_ASCII); } else { dissect_tcp_payload(tvb, pinfo, offset, tcph->th_seq, nxtseq, tcph->th_sport, tcph->th_dport, tree, tcp_tree, tcpd, &tcpinfo); @@ -5735,7 +5721,23 @@ proto_register_tcp(void) { &hf_tcp_segment_data, { "TCP segment data", "tcp.segment_data", FT_BYTES, BASE_NONE, NULL, 0x0, - "A data segment used in reassembly of a lower-level protocol", HFILL}} + "A data segment used in reassembly of a lower-level protocol", HFILL}}, + + { &hf_tcp_option_scps_binding_data, + { "Binding Space Data", "tcp.options.scps.binding.data", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_tcp_option_rvbd_probe_reserved, + { "Reserved", "tcp.options.rvbd.probe.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_tcp_fin_retransmission, + { "Retransmission of FIN from frame", "tcp.fin_retransmission", FT_FRAMENUM, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_tcp_reset_cause, + { "Reset cause", "tcp.reset_cause", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { @@ -5820,7 +5822,8 @@ proto_register_tcp(void) { &ei_tcp_connection_rst, { "tcp.connection.rst", PI_SEQUENCE, PI_WARN, "Connection reset (RST)", EXPFILL }}, { &ei_tcp_checksum_ffff, { "tcp.checksum.ffff", PI_CHECKSUM, PI_WARN, "TCP Checksum 0xffff instead of 0x0000 (see RFC 1624)", EXPFILL }}, { &ei_tcp_checksum_bad, { "tcp.checksum_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, - { &ei_tcp_urgent_pointer_non_zero, { "tcp.urgent_pointer.non_zero", PI_PROTOCOL, PI_NOTE, "The urgent pointer field is nonzero while the URG flag is not set", EXPFILL }} + { &ei_tcp_urgent_pointer_non_zero, { "tcp.urgent_pointer.non_zero", PI_PROTOCOL, PI_NOTE, "The urgent pointer field is nonzero while the URG flag is not set", EXPFILL }}, + { &ei_tcp_suboption_malformed, { "tcp.suboption_malformed", PI_MALFORMED, PI_ERROR, "suboption would go past end of option", EXPFILL }}, }; static build_valid_func tcp_da_src_values[1] = {tcp_src_value}; diff --git a/epan/dissectors/packet-zep.c b/epan/dissectors/packet-zep.c index bf6b036223..d13685bde9 100644 --- a/epan/dissectors/packet-zep.c +++ b/epan/dissectors/packet-zep.c @@ -68,6 +68,8 @@ static int hf_zep_lqi = -1; static int hf_zep_timestamp = -1; static int hf_zep_seqno = -1; static int hf_zep_ieee_length = -1; +static int hf_zep_protocol_id = -1; +static int hf_zep_reserved_field = -1; /* Initialize protocol subtrees. */ static gint ett_zep = -1; @@ -186,7 +188,7 @@ static void dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) zep_tree = proto_item_add_subtree(proto_root, ett_zep); /* Display the information in the subtree */ - proto_tree_add_text(zep_tree, tvb, 0, 2, "Protocol ID String: EX"); + proto_tree_add_item(zep_tree, hf_zep_protocol_id, tvb, 0, 2, ENC_NA|ENC_ASCII); if (zep_data.version==1) { proto_tree_add_uint(zep_tree, hf_zep_version, tvb, 2, 1, zep_data.version); proto_tree_add_uint(zep_tree, hf_zep_channel_id, tvb, 3, 1, zep_data.channel_id); @@ -195,7 +197,7 @@ static void dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(!(zep_data.lqi_mode)){ proto_tree_add_uint(zep_tree, hf_zep_lqi, tvb, 7, 1, zep_data.lqi); } - proto_tree_add_text(zep_tree, tvb, 7+((zep_data.lqi_mode)?0:1), 7+((zep_data.lqi_mode)?1:0), "Reserved Fields"); + proto_tree_add_item(zep_tree, hf_zep_reserved_field, tvb, 7+((zep_data.lqi_mode)?0:1), 7+((zep_data.lqi_mode)?1:0), ENC_NA); } else { proto_tree_add_uint(zep_tree, hf_zep_version, tvb, 2, 1, zep_data.version); @@ -291,6 +293,14 @@ void proto_register_zep(void) { &hf_zep_ieee_length, { "Length", "zep.length", FT_UINT8, BASE_DEC, NULL, 0x0, "The length (in bytes) of the encapsulated IEEE 802.15.4 MAC frame.", HFILL }}, + + { &hf_zep_protocol_id, + { "Protocol ID String", "zep.seqno", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_zep_reserved_field, + { "Reserved Fields", "zep.reserved_field", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { |