From ed8da33902a76695ad6c1b3b3c877aa654de0685 Mon Sep 17 00:00:00 2001 From: ismaelrti Date: Wed, 21 Nov 2018 15:35:33 +0100 Subject: [PATCH] RTPS: Extra fields dissected in RTI DDS field PID_TYPE_CONSISTENCY. In RTI Connext DDS 5.3.3 and later PID_TYPE_CONSISTENCY has six new fields: Ignore Sequence Bounds, Ignore String Bounds, Ignore Member Names, Prevent Type Widening, Force Type Validation, Ignore Enum Literal Names. Change-Id: I456097a3baf733351dcb86f2cba0a3f03d2fc100 Reviewed-on: https://code.wireshark.org/review/30753 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-rtps.c | 84 +++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index fb528e22cc..c79da0daed 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -284,6 +284,12 @@ static int hf_rtps_virtual_heartbeat_num_writers = -1; static int hf_rtps_param_extended_parameter = -1; static int hf_rtps_param_extended_pid_length = -1; static int hf_rtps_param_type_consistency_kind = -1; +static int hf_rtps_param_ignore_sequence_bounds = -1; +static int hf_rtps_param_ignore_string_bounds = -1; +static int hf_rtps_param_ignore_member_names = -1; +static int hf_rtps_param_prevent_type_widening = -1; +static int hf_rtps_param_force_type_validation = -1; +static int hf_rtps_param_ignore_enum_literal_names = -1; static int hf_rtps_parameter_data = -1; static int hf_rtps_param_product_version_major = -1; static int hf_rtps_param_product_version_minor = -1; @@ -571,6 +577,7 @@ static expert_field ei_rtps_locator_port = EI_INIT; static expert_field ei_rtps_more_samples_available = EI_INIT; static expert_field ei_rtps_parameter_not_decoded = EI_INIT; static expert_field ei_rtps_sm_octets_to_next_header_not_zero = EI_INIT; +static expert_field pid_type_csonsistency_invalid_size = EI_INIT; /***************************************************************************/ /* Preferences */ @@ -4567,15 +4574,55 @@ static gboolean dissect_parameter_sequence_rti_dds(proto_tree *rtps_parameter_tr break; } - /* 0...2...........7...............15.............23...............31 + /* Product Version Version 5.3.1 and earlier + * 0...2...........7...............15.............23...............31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | PID_TYPE_CONSISTENCY_KIND | length | * +---------------+---------------+---------------+---------------+ - * | unsigned short value | = = u n u s e d = = = = = = | + * | unsigned short value Kind | = = u n u s e d = = = = = = | * +---------------+---------------+---------------+---------------+ + * + * Product Version 5.3.3 and later + * 0...2...........7...............15.............23...............31 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | PID_TYPE_CONSISTENCY_KIND | length | + * +---------------+---------------+---------------+---------------+ + * | unsigned short value Kind | Boolean ISeqB | Boolean IStrB | + * +---------------+---------------+---------------+---------------+ + * | Boolean IMemN | Boolean PTypW | Boolean FtypV | Boolean IEnLN | + * +---------------+---------------+---------------+---------------+ + * ISeqB = Ignore Sequence Names + * IStrB = Ignore String names + * IMemN = Ignore Member Names + * PTypW = Prevent Type Widening + * FtypV = Force Type Validation + * IEnLN = Ignore Enum Literal Names */ case PID_TYPE_CONSISTENCY: { + if (param_length !=4 && param_length !=8) { + expert_add_info_format(pinfo, rtps_parameter_tree, + &pid_type_csonsistency_invalid_size, + "PID_TYPE_CONSISTENCY invalid size. It has a size of %d bytes. Expected %d or %d bytes.", + param_length, 4, 8); + break; + } proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_type_consistency_kind, tvb, offset, 2, encoding); + /* Parameter size can be used as a discriminator between product versions. */ + if (param_length == 8) { + offset += 2; + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_ignore_sequence_bounds, + tvb, offset, 1, encoding); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_ignore_string_bounds, + tvb, offset + 1, 1, encoding); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_ignore_member_names, + tvb, offset + 2, 1, encoding); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_prevent_type_widening, + tvb, offset + 3, 1, encoding); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_force_type_validation, + tvb, offset + 4, 1, encoding); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_ignore_enum_literal_names, + tvb, offset + 5, 1, encoding); + } break; } @@ -11428,6 +11475,36 @@ void proto_register_rtps(void) { FT_UINT16, BASE_HEX, VALS(type_consistency_kind_vals), 0, NULL, HFILL } }, + { &hf_rtps_param_ignore_sequence_bounds, { + "Ignore Sequence Bounds", "rtps.param.ignore_sequence_bounds", + FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL } + }, + + { &hf_rtps_param_ignore_string_bounds, { + "Ignore String Bounds", "rtps.param.ignore_string_bounds", + FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL } + }, + + { &hf_rtps_param_ignore_member_names, { + "Ignore Member Names", "rtps.param.ignore_member_names", + FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL } + }, + + { &hf_rtps_param_prevent_type_widening, { + "Prevent Type Widening", "rtps.param.prevent_type_widening", + FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL } + }, + + { &hf_rtps_param_force_type_validation, { + "Force Type Validation", "rtps.param.force_type_validation", + FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL } + }, + + { &hf_rtps_param_ignore_enum_literal_names, { + "Ignore Enum Literal Names", "rtps.param.ignore_enum_literal_names", + FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL } + }, + { &hf_rtps_param_acknowledgment_kind, { "Acknowledgment Kind", "rtps.param.acknowledgment_kind", FT_UINT32, BASE_HEX, VALS(acknowledgement_kind_vals), 0, NULL, HFILL } @@ -12446,7 +12523,8 @@ void proto_register_rtps(void) { { &ei_rtps_sm_octets_to_next_header_not_zero, { "rtps.sm.octetsToNextHeader.not_zero", PI_PROTOCOL, PI_WARN, "Should be ZERO", EXPFILL }}, { &ei_rtps_extra_bytes, { "rtps.extra_bytes", PI_MALFORMED, PI_ERROR, "Don't know how to decode those extra bytes: %d", EXPFILL }}, { &ei_rtps_missing_bytes, { "rtps.missing_bytes", PI_MALFORMED, PI_ERROR, "Not enough bytes to decode", EXPFILL }}, - { &ei_rtps_more_samples_available, { "rtps.more_samples_available", PI_PROTOCOL, PI_NOTE, "More samples available. Configure this limit from preferences dialog", EXPFILL }} + { &ei_rtps_more_samples_available, { "rtps.more_samples_available", PI_PROTOCOL, PI_NOTE, "More samples available. Configure this limit from preferences dialog", EXPFILL }}, + { &pid_type_csonsistency_invalid_size, { "rtps.pid_type_consistency_invalid_size", PI_MALFORMED, PI_ERROR, "PID_TYPE_CONSISTENCY invalid size. Has a size of %d bytes. Expected %d or %d bytes.", EXPFILL }} }; module_t *rtps_module;