Batch of filterable expert infos.

svn path=/trunk/; revision=51518
This commit is contained in:
Michael Mann 2013-08-25 21:01:11 +00:00
parent d8e8f48636
commit e5e4d357e3
10 changed files with 362 additions and 261 deletions

View File

@ -424,6 +424,9 @@ static int hf_omron_cyclic_57 = -1;
static int hf_omron_cyclic_56 = -1;
static int hf_omron_node_error_count = -1;
static expert_field ei_omron_command_code = EI_INIT;
static expert_field ei_omron_bad_length = EI_INIT;
static expert_field ei_oomron_command_memory_area_code = EI_INIT;
/* Defines */
@ -1189,7 +1192,7 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
if (cmd_str_idx == -1) {
/* Unknown command-code */
expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Command-Code");
expert_add_info(pinfo, ti, &ei_omron_command_code);
return tvb_length(tvb);
}
@ -1208,7 +1211,7 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
/* command data length > 0 is NG; response data lengths are > 0 */
if (is_command) {
if (reported_length_remaining != 0) {
expert_add_info_format(pinfo, omron_tree, PI_MALFORMED, PI_WARN, "Unexpected Length (Should be 0)");
expert_add_info_format_text(pinfo, omron_tree, &ei_omron_bad_length, "Unexpected Length (Should be 0)");
}
return tvb_length(tvb);
}
@ -1218,13 +1221,13 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
/* command data length should be 0 */
if (is_command) {
if(reported_length_remaining != 0) {
expert_add_info_format(pinfo, omron_tree, PI_MALFORMED, PI_WARN, "Unexpected Length (Should be 0)");
expert_add_info_format_text(pinfo, omron_tree, &ei_omron_bad_length, "Unexpected Length (Should be 0)");
}
}
/* There's no response */
if (is_response)
{
expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Response Command-Code");
expert_add_info_format_text(pinfo, ti, &ei_omron_command_code, "Unknown Response Command-Code");
}
return tvb_length(tvb);
break;
@ -1246,7 +1249,7 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
/* There's no response */
if (is_response)
{
expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Response Command-Code");
expert_add_info_format_text(pinfo, ti, &ei_omron_command_code, "Unknown Response Command-Code");
return tvb_length(tvb);
}
break;
@ -1476,8 +1479,7 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
reported_length_remaining = reported_length_remaining - 1;
if(memory_code_len == 0) {
expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN,
"Unknown Memory-Area-Code (%u)", memory_area_code);
expert_add_info_format_text(pinfo, ti, &ei_oomron_command_memory_area_code, "Unknown Memory-Area-Code (%u)", memory_area_code);
return tvb_length(tvb); /* Bail out .... */
}
proto_tree_add_item(command_tree, hf_omron_data, tvb, offset, memory_code_len, ENC_NA);
@ -3233,7 +3235,7 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
} /* switch(command_code) */
if ((guint)offset != tvb_reported_length(tvb)) {
expert_add_info_format(pinfo, omron_tree, PI_MALFORMED, PI_WARN, "Unexpected Length");
expert_add_info(pinfo, omron_tree, &ei_omron_bad_length);
}
} /* if(tree) */
@ -3952,6 +3954,14 @@ proto_register_omron_fins(void)
&ett_omron_data_link_status_tree,
};
static ei_register_info ei[] = {
{ &ei_omron_command_code, { "omron.command.unknown", PI_UNDECODED, PI_WARN, "Unknown Command-Code", EXPFILL }},
{ &ei_oomron_command_memory_area_code, { "omron.memory.area.read.unknown", PI_UNDECODED, PI_WARN, "Unknown Memory-Area-Code (%u)", EXPFILL }},
{ &ei_omron_bad_length, { "omron.bad_length", PI_MALFORMED, PI_WARN, "Unexpected Length", EXPFILL }},
};
expert_module_t* expert_omron_fins;
/* Register the protocol name and description */
proto_omron_fins = proto_register_protocol (
"OMRON FINS Protocol", /* name */
@ -3962,6 +3972,8 @@ proto_register_omron_fins(void)
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_omron_fins, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_omron_fins = expert_register_protocol(proto_omron_fins);
expert_register_field_array(expert_omron_fins, ei, array_length(ei));
#if 0
/*Register preferences module (See Section 2.6 for more on preferences) */

View File

@ -272,6 +272,12 @@ static int hf_openwire_cached_enabled = -1;
static gint ett_openwire = -1;
static gint ett_openwire_type = -1;
static expert_field ei_openwire_tight_encoding_not_supported = EI_INIT;
static expert_field ei_openwire_encoding_not_supported = EI_INIT;
static expert_field ei_openwire_type_not_supported = EI_INIT;
static expert_field ei_openwire_command_not_supported = EI_INIT;
static expert_field ei_openwire_body_type_not_supported = EI_INIT;
static dissector_handle_t openwire_tcp_handle;
static gboolean openwire_desegment = TRUE;
@ -281,8 +287,6 @@ static gboolean openwire_verbose_type = FALSE;
#define OPENWIRE_MAGIC_PART_1 0x41637469 /* "Acti" */
#define OPENWIRE_MAGIC_PART_2 0x76654D51 /* "veMQ" */
#define OPENWIRE_BOOLEAN_FALSE 0x00
#define OPENWIRE_BOOLEAN_TRUE 0x01
#define OPENWIRE_WIREFORMAT_INFO 1
#define OPENWIRE_BROKER_INFO 2
@ -549,10 +553,9 @@ validate_boolean(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, int of
/* Sanity check of boolean : must be 0x00 or 0x01 */
guint8 booleanByte;
booleanByte = tvb_get_guint8(tvb, offset);
if (booleanByte != OPENWIRE_BOOLEAN_FALSE && booleanByte != OPENWIRE_BOOLEAN_TRUE)
if (booleanByte != FALSE && booleanByte != TRUE)
{
expert_add_info_format(pinfo, boolean_item, PI_MALFORMED, PI_ERROR,
"OpenWire encoding not supported by Wireshark or dissector bug");
expert_add_info(pinfo, boolean_item, &ei_openwire_encoding_not_supported);
THROW(ReportedBoundsError);
}
}
@ -612,7 +615,7 @@ detect_protocol_options(tvbuff_t *tvb, packet_info *pinfo, int offset, int iComm
}
else
{
if (present == OPENWIRE_BOOLEAN_TRUE && type == OPENWIRE_TYPE_NULL)
if (present == TRUE && type == OPENWIRE_TYPE_NULL)
{
/* If a cached object is not-null, it should be the "NULL" object.
This can be misdetected with "loose" encoding if the capture is started after 256 cached objects on the connection,
@ -684,7 +687,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
guint8 inlined = 0;
gint cachedID = 0;
proto_item * cached_item = NULL;
inlined = tvb_get_guint8(tvb, offset + 0) == OPENWIRE_BOOLEAN_TRUE ? TRUE : FALSE;
inlined = tvb_get_guint8(tvb, offset + 0) == TRUE ? TRUE : FALSE;
cachedID = tvb_get_ntohs(tvb, offset + 1);
ep_strbuf_append_printf(cache_strbuf, " (CachedID: %d)", cachedID);
if (openwire_verbose_type)
@ -711,7 +714,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
}
if (nullable == TRUE && (type == OPENWIRE_TYPE_NESTED || type == OPENWIRE_TYPE_CACHED || type == OPENWIRE_COMMAND_INNER) && tvb_length_remaining(tvb, offset) >= 1)
{
nullable = tvb_get_guint8(tvb, offset + 0) == OPENWIRE_BOOLEAN_FALSE ? TRUE : FALSE;
nullable = tvb_get_guint8(tvb, offset + 0) == FALSE ? TRUE : FALSE;
if (openwire_verbose_type)
{
boolean_item = proto_tree_add_item(tree, hf_openwire_type_notnull, tvb, offset, 1, ENC_BIG_ENDIAN);
@ -746,7 +749,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
}
if (nullable == TRUE && tvb_length_remaining(tvb, offset) >= 1)
{
nullable = tvb_get_guint8(tvb, offset + 0) == OPENWIRE_BOOLEAN_FALSE ? TRUE : FALSE;
nullable = tvb_get_guint8(tvb, offset + 0) == FALSE ? TRUE : FALSE;
if (openwire_verbose_type)
{
boolean_item = proto_tree_add_item(tree, hf_openwire_type_notnull, tvb, offset, 1, ENC_BIG_ENDIAN);
@ -875,7 +878,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
{
next_tvb = tvb_new_subset(tvb, offset + 4, iArrayLength, iArrayLength);
add_new_data_source(pinfo, next_tvb, "Body");
expert_add_info_format(pinfo, array_item, PI_UNDECODED, PI_NOTE, "OpenWire body type not supported by Wireshark");
expert_add_info(pinfo, array_item, &ei_openwire_body_type_not_supported);
}
}
else if (field == hf_openwire_message_properties)
@ -1078,7 +1081,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
}
else if (tvb_length_remaining(tvb, offset) > 0)
{
expert_add_info_format(pinfo, object_tree, PI_UNDECODED, PI_NOTE, "OpenWire type not supported by Wireshark : %d", type);
expert_add_info_format_text(pinfo, object_tree, &ei_openwire_type_not_supported, "OpenWire type not supported by Wireshark : %d", type);
offset += tvb_length_remaining(tvb, offset);
}
proto_item_set_len(ti, offset - startOffset);
@ -1299,7 +1302,7 @@ dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
}
else if (tvb_length_remaining(tvb, offset) > 0)
{
expert_add_info_format(pinfo, tree, PI_UNDECODED, PI_NOTE, "OpenWire command not supported by Wireshark: %d", iCommand);
expert_add_info_format_text(pinfo, tree, &ei_openwire_command_not_supported, "OpenWire command not supported by Wireshark: %d", iCommand);
}
}
}
@ -1339,8 +1342,7 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (iCommand != OPENWIRE_WIREFORMAT_INFO && retrieve_tight(pinfo) == TRUE)
{
proto_tree_add_item(openwireroot_tree, hf_openwire_command, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
expert_add_info_format(pinfo, openwireroot_tree, PI_UNDECODED, PI_NOTE,
"OpenWire tight encoding not supported by Wireshark, use wireFormat.tightEncodingEnabled=false");
expert_add_info(pinfo, openwireroot_tree, &ei_openwire_tight_encoding_not_supported);
return;
}
@ -1354,7 +1356,7 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += dissect_openwire_command(tvb, pinfo, openwireroot_tree, offset, iCommand);
if (tvb_length_remaining(tvb, offset) > 0)
{
expert_add_info_format(pinfo, tree, PI_UNDECODED, PI_NOTE, "OpenWire command fields unknown to Wireshark: %d", iCommand);
expert_add_info_format_text(pinfo, tree, &ei_openwire_command_not_supported, "OpenWire command fields unknown to Wireshark: %d", iCommand);
}
}
}
@ -1978,11 +1980,22 @@ proto_register_openwire(void)
&ett_openwire_type
};
static ei_register_info ei[] = {
{ &ei_openwire_encoding_not_supported, { "openwire.encoding_not_supported", PI_PROTOCOL, PI_WARN, "OpenWire encoding not supported by Wireshark or dissector bug", EXPFILL }},
{ &ei_openwire_body_type_not_supported, { "openwire.body_type_not_supported", PI_UNDECODED, PI_NOTE, "OpenWire body type not supported by Wireshark", EXPFILL }},
{ &ei_openwire_type_not_supported, { "openwire.type.not_supported", PI_UNDECODED, PI_NOTE, "OpenWire type not supported by Wireshark", EXPFILL }},
{ &ei_openwire_command_not_supported, { "openwire.command.not_supported", PI_UNDECODED, PI_NOTE, "OpenWire command not supported by Wireshark", EXPFILL }},
{ &ei_openwire_tight_encoding_not_supported, { "openwire.tight_encoding_not_supported", PI_UNDECODED, PI_NOTE, "OpenWire tight encoding not supported by Wireshark", EXPFILL }},
};
module_t *openwire_module;
expert_module_t* expert_openwire;
proto_openwire = proto_register_protocol("OpenWire", "OpenWire", "openwire");
proto_register_field_array(proto_openwire, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_openwire = expert_register_protocol(proto_openwire);
expert_register_field_array(expert_openwire, ei, array_length(ei));
openwire_module = prefs_register_protocol(proto_openwire, NULL);
prefs_register_bool_preference(openwire_module, "desegment",

View File

@ -117,6 +117,9 @@ static int proto_pppoes = -1;
static gint ett_pppoes = -1;
static gint ett_pppoes_tags = -1;
static expert_field ei_pppoe_payload_length = EI_INIT;
static expert_field ei_pppoe_tag_length = EI_INIT;
/* PPPoE parent fields */
static int proto_pppoe = -1;
@ -305,8 +308,9 @@ static const value_string datarate_scale_vals[] = {
#define CASE_VSPEC_DSLF_TAG_UINT(tag_name, relation, length, hf_var) case tag_name: \
if (!(poe_tag_length relation length)) { \
expert_add_info_format(pinfo, pppoe_tree, PI_MALFORMED, PI_WARN, "%s: Wrong length: %u (expected %s %d)", \
val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length, #relation, length); \
expert_add_info_format_text(pinfo, pppoe_tree, &ei_pppoe_tag_length, \
"%s: Wrong length: %u (expected %s %d)", \
val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length, #relation, length); \
} else { \
proto_tree_add_item(pppoe_tree, hf_var, tvb, \
tagstart+2, poe_tag_length, ENC_BIG_ENDIAN); \
@ -315,8 +319,9 @@ static const value_string datarate_scale_vals[] = {
#define CASE_VSPEC_DSLF_TAG_STRING(tag_name, relation, length, hf_var) case tag_name: \
if (!(poe_tag_length relation length)) { \
expert_add_info_format(pinfo, pppoe_tree, PI_MALFORMED, PI_WARN, "%s: Wrong length: %u (expected %s %d)", \
val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length, #relation, length); \
expert_add_info_format_text(pinfo, pppoe_tree, &ei_pppoe_tag_length, \
"%s: Wrong length: %u (expected %s %d)", \
val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length, #relation, length); \
} else { \
proto_tree_add_item(pppoe_tree, hf_var, tvb, \
tagstart+2, poe_tag_length, ENC_ASCII|ENC_NA); \
@ -395,9 +400,7 @@ dissect_pppoe_subtags_dslf(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, pr
ti = proto_tree_add_item(pppoe_tree, hf_pppoed_tag_vspec_access_loop_encapsulation, tvb,
tagstart+2, 3, ENC_NA);
if (poe_tag_length != 3) {
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN,
"%s: Wrong length: %u (expected 3)",
val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length);
expert_add_info_format_text(pinfo, ti, &ei_pppoe_tag_length, "%s: Wrong length: %u (expected 3)", val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length);
}
encaps_tree = proto_item_add_subtree(ti, ett_pppoed_tag_vspec_dslf_access_loop_encaps);
proto_tree_add_item(encaps_tree, hf_pppoed_tag_vspec_access_loop_encap_data_link,
@ -602,9 +605,7 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr
proto_registrar_get_name(hf_pppoed_tag_seq_num),
poe_tag_length);
}
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN,
"Sequence Number tag: Wrong length: %u (expected 2)",
poe_tag_length);
expert_add_info_format_text(pinfo, item, &ei_pppoe_tag_length, "Sequence Number tag: Wrong length: %u (expected 2)", poe_tag_length);
}
break;
case PPPOE_TAG_CRED_SCALE:
@ -621,9 +622,7 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr
proto_registrar_get_name(hf_pppoed_tag_cred_scale),
poe_tag_length);
}
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN,
"Credit Scale Factor tag: Wrong length: %u (expected 2)",
poe_tag_length);
expert_add_info_format_text(pinfo, item, &ei_pppoe_tag_length, "Credit Scale Factor tag: Wrong length: %u (expected 2)", poe_tag_length);
}
break;
case PPPOE_TAG_RELAY_ID:
@ -1170,9 +1169,7 @@ static void dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
((reported_payload_length + 4) != actual_payload_length)) {
proto_item_append_text(ti, " [incorrect, should be %u]",
actual_payload_length);
expert_add_info_format(pinfo, ti, PI_MALFORMED,
PI_WARN, "Possible bad payload length %u != %u",
reported_payload_length, actual_payload_length);
expert_add_info_format_text(pinfo, ti, &ei_pppoe_payload_length, "Possible bad payload length %u != %u", reported_payload_length, actual_payload_length);
}
}
@ -1279,11 +1276,20 @@ void proto_register_pppoe(void)
&ett_pppoe
};
static ei_register_info ei[] = {
{ &ei_pppoe_tag_length, { "pppoed.tag_length.invalid", PI_MALFORMED, PI_WARN, "Wrong length", EXPFILL }},
{ &ei_pppoe_payload_length, { "pppoe.payload_length.bad", PI_MALFORMED, PI_WARN, "Possible bad payload length", EXPFILL }},
};
expert_module_t* expert_pppoe;
/* Register protocol */
proto_pppoe = proto_register_protocol("PPP-over-Ethernet", "PPPoE", "pppoe");
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_pppoe, hf, array_length(hf));
expert_pppoe = expert_register_protocol(proto_pppoe);
expert_register_field_array(expert_pppoe, ei, array_length(ei));
}

View File

@ -158,6 +158,11 @@ static int ett_rohc_dynamic_rtp = -1;
static int ett_rohc_compressed_list = -1;
static int ett_rohc_packet = -1;
static expert_field ei_rohc_profile_spec_octet = EI_INIT;
static expert_field ei_rohc_rohc_opt_clock = EI_INIT;
static expert_field ei_rohc_opt_jitter = EI_INIT;
static expert_field ei_rohc_feedback_type_2_is_not_applicable_for_uncompressed_profile = EI_INIT;
static dissector_handle_t rohc_handle;
static dissector_handle_t ip_handle;
@ -881,7 +886,7 @@ dissect_rohc_feedback_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
case ROHC_PROFILE_UNCOMPRESSED: /* 0 */
ti = proto_tree_add_item(tree, hf_rohc_profile_spec_octet, tvb, offset, 1, ENC_BIG_ENDIAN);
if (oct) {
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Invalid profile-specific octet value (0x%02X)", oct);
expert_add_info_format_text(pinfo, ti, &ei_rohc_profile_spec_octet, "Invalid profile-specific octet value (0x%02X)", oct);
}
break;
case ROHC_PROFILE_RTP: /* 1 */
@ -907,8 +912,7 @@ dissect_rohc_feedback_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
proto_item_append_text(p_rohc_info->last_created_item, " (type 2)");
switch(rohc_cid_context->profile){
case ROHC_PROFILE_UNCOMPRESSED: /* 0 */
expert_add_info_format(pinfo, p_rohc_info->last_created_item, PI_MALFORMED, PI_ERROR,
"Feedback type 2 is not applicable for uncompressed profile");
expert_add_info(pinfo, p_rohc_info->last_created_item, &ei_rohc_feedback_type_2_is_not_applicable_for_uncompressed_profile);
break;
case ROHC_PROFILE_RTP: /* 1 */
case ROHC_PROFILE_UDP: /* 2 */
@ -963,8 +967,7 @@ dissect_rohc_feedback_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
oct = tvb_get_guint8(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, "Clock=%u ", oct);
} else {
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"CLOCK option should not be used for UDP");
expert_add_info(pinfo, ti, &ei_rohc_rohc_opt_clock);
}
break;
case 6:
@ -974,8 +977,7 @@ dissect_rohc_feedback_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
oct = tvb_get_guint8(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, "Jitter=%u ", oct);
}else {
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"JITTER option should not be used for UDP");
expert_add_info(pinfo, ti, &ei_rohc_opt_jitter);
}
break;
case 7:
@ -2947,6 +2949,15 @@ proto_register_rohc(void)
&ett_rohc_packet
};
static ei_register_info ei[] = {
{ &ei_rohc_profile_spec_octet, { "rohc.profile_spec_octet.bad", PI_PROTOCOL, PI_WARN, "Invalid profile-specific octet value", EXPFILL }},
{ &ei_rohc_feedback_type_2_is_not_applicable_for_uncompressed_profile, { "rohc.feedback.type_2_is_not_applicable_for_uncompressed_profile", PI_PROTOCOL, PI_WARN, "Feedback type 2 is not applicable for uncompressed profile", EXPFILL }},
{ &ei_rohc_rohc_opt_clock, { "rohc.opt.clock.udp", PI_MALFORMED, PI_ERROR, "CLOCK option should not be used for UDP", EXPFILL }},
{ &ei_rohc_opt_jitter, { "rohc.opt.jitter.udp", PI_MALFORMED, PI_ERROR, "JITTER option should not be used for UDP", EXPFILL }},
};
expert_module_t* expert_rohc;
/* Register the protocol name and description */
proto_rohc = proto_register_protocol("RObust Header Compression (ROHC)", "ROHC", "rohc");
@ -2957,6 +2968,8 @@ proto_register_rohc(void)
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_rohc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_rohc = expert_register_protocol(proto_rohc);
expert_register_field_array(expert_rohc, ei, array_length(ei));
}
void

View File

@ -68,6 +68,12 @@ static int hf_new_protocol = -1;
static gint ett_rtcdc = -1;
static gint ett_flags = -1;
static expert_field ei_rtcdc_new_reliability_non_zero = EI_INIT;
static expert_field ei_rtcdc_message_type_unknown = EI_INIT;
static expert_field ei_rtcdc_inconsistent_label_and_parameter_length = EI_INIT;
static expert_field ei_rtcdc_message_too_long = EI_INIT;
static expert_field ei_rtcdc_new_channel_type = EI_INIT;
#define DATA_CHANNEL_OPEN_REQUEST 0x00
#define DATA_CHANNEL_OPEN_RESPONSE 0x01
#define DATA_CHANNEL_ACK 0x02
@ -138,7 +144,7 @@ static void
dissect_open_response_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *rtcdc_tree, proto_item *rtcdc_item)
{
if (tvb_length(tvb) > DATA_CHANNEL_RESPONSE_LENGTH) {
expert_add_info_format(pinfo, rtcdc_item, PI_MALFORMED, PI_ERROR, "Message too long");
expert_add_info(pinfo, rtcdc_item, &ei_rtcdc_message_too_long);
}
if (rtcdc_tree) {
proto_tree_add_item(rtcdc_tree, hf_error, tvb, ERROR_OFFSET, ERROR_LENGTH, ENC_BIG_ENDIAN);
@ -154,7 +160,7 @@ static void
dissect_open_ack_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *rtcdc_tree _U_, proto_item *rtcdc_item)
{
if (tvb_length(tvb) > DATA_CHANNEL_ACK_LENGTH) {
expert_add_info_format(pinfo, rtcdc_item, PI_MALFORMED, PI_ERROR, "Message too long");
expert_add_info(pinfo, rtcdc_item, &ei_rtcdc_message_too_long);
}
return;
}
@ -209,20 +215,20 @@ dissect_new_open_request_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
proto_tree_add_item(rtcdc_tree, hf_new_channel_type, tvb, NEW_CHANNEL_TYPE_OFFSET, NEW_CHANNEL_TYPE_LENGTH, ENC_BIG_ENDIAN);
channel_type = tvb_get_guint8(tvb, NEW_CHANNEL_TYPE_OFFSET);
if ((channel_type & 0x7f) > 0x02) {
expert_add_info_format(pinfo, rtcdc_item, PI_MALFORMED, PI_ERROR, "Unknown channel type");
expert_add_info(pinfo, rtcdc_item, &ei_rtcdc_new_channel_type);
}
proto_tree_add_item(rtcdc_tree, hf_new_priority, tvb, NEW_PRIORITY_OFFSET, NEW_PRIORITY_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(rtcdc_tree, hf_new_reliability, tvb, NEW_RELIABILITY_OFFSET, NEW_RELIABILITY_LENGTH, ENC_BIG_ENDIAN);
reliability = tvb_get_ntohl(tvb, NEW_RELIABILITY_OFFSET);
if ((reliability > 0) && ((channel_type & 0x80) == 0)) {
expert_add_info_format(pinfo, rtcdc_item, PI_MALFORMED, PI_ERROR, "Reliability parameter non zero for reliable channel");
expert_add_info(pinfo, rtcdc_item, &ei_rtcdc_new_reliability_non_zero);
}
proto_tree_add_item(rtcdc_tree, hf_new_label_length, tvb, NEW_LABEL_LENGTH_OFFSET, NEW_LABEL_LENGTH_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(rtcdc_tree, hf_new_protocol_length, tvb, NEW_PROTOCOL_LENGTH_OFFSET, NEW_PROTOCOL_LENGTH_LENGTH, ENC_BIG_ENDIAN);
label_length = tvb_get_ntohs(tvb, NEW_LABEL_LENGTH_OFFSET);
protocol_length = tvb_get_ntohs(tvb, NEW_PROTOCOL_LENGTH_OFFSET);
if (NEW_OPEN_REQUEST_HEADER_LENGTH + (guint)label_length + (guint)protocol_length != tvb_length(tvb)) {
expert_add_info_format(pinfo, rtcdc_item, PI_MALFORMED, PI_ERROR, "Inconsistent label and parameter length");
expert_add_info(pinfo, rtcdc_item, &ei_rtcdc_inconsistent_label_and_parameter_length);
}
proto_tree_add_item(rtcdc_tree, hf_new_label, tvb, NEW_LABEL_OFFSET, label_length, ENC_BIG_ENDIAN);
proto_tree_add_item(rtcdc_tree, hf_new_protocol, tvb, NEW_LABEL_OFFSET + label_length, protocol_length, ENC_BIG_ENDIAN);
@ -233,7 +239,7 @@ dissect_new_open_request_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
static int
dissect_rtcdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *rtcdc_item;
proto_item *rtcdc_item, *msg_item;
proto_tree *rtcdc_tree;
guint8 message_type;
@ -241,15 +247,11 @@ dissect_rtcdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTCDC");
col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_type, message_type_values, "reserved"));
if (tree) {
rtcdc_item = proto_tree_add_item(tree, proto_rtcdc, tvb, 0, -1, ENC_NA);
rtcdc_tree = proto_item_add_subtree(rtcdc_item, ett_rtcdc);
proto_tree_add_item(rtcdc_tree, hf_message_type, tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, ENC_BIG_ENDIAN);
} else {
rtcdc_item = NULL;
rtcdc_tree = NULL;
}
switch (message_type) {
rtcdc_item = proto_tree_add_item(tree, proto_rtcdc, tvb, 0, -1, ENC_NA);
rtcdc_tree = proto_item_add_subtree(rtcdc_item, ett_rtcdc);
msg_item = proto_tree_add_item(rtcdc_tree, hf_message_type, tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, ENC_BIG_ENDIAN);
switch (message_type) {
case DATA_CHANNEL_OPEN_REQUEST:
dissect_open_request_message(tvb, pinfo, rtcdc_tree, rtcdc_item);
break;
@ -263,7 +265,7 @@ dissect_rtcdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
dissect_new_open_request_message(tvb, pinfo, rtcdc_tree, rtcdc_item);
break;
default:
expert_add_info_format(pinfo, rtcdc_item, PI_MALFORMED, PI_ERROR, "Unknown message type");
expert_add_info(pinfo, msg_item, &ei_rtcdc_message_type_unknown);
break;
}
return tvb_length(tvb);
@ -273,6 +275,7 @@ void
proto_register_rtcdc(void)
{
module_t *rtcdc_module;
expert_module_t* expert_rtcdc;
static hf_register_info hf[] = {
{ &hf_message_type, { "Message type", "rtcdc.message_type", FT_UINT8, BASE_DEC, VALS(message_type_values), 0x0, NULL, HFILL } },
{ &hf_channel_type, { "Channel type", "rtcdc.channel_type", FT_UINT8, BASE_DEC, VALS(channel_type_values), 0x0, NULL, HFILL } },
@ -297,9 +300,19 @@ proto_register_rtcdc(void)
&ett_flags
};
static ei_register_info ei[] = {
{ &ei_rtcdc_message_too_long, { "rtcdc.message_too_long", PI_MALFORMED, PI_ERROR, "Message too long", EXPFILL }},
{ &ei_rtcdc_new_channel_type, { "rtcdc.channel_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown channel type", EXPFILL }},
{ &ei_rtcdc_new_reliability_non_zero, { "rtcdc.reliability_parameter.non_zero", PI_PROTOCOL, PI_WARN, "Reliability parameter non zero for reliable channel", EXPFILL }},
{ &ei_rtcdc_inconsistent_label_and_parameter_length, { "rtcdc.inconsistent_label_and_parameter_length", PI_MALFORMED, PI_ERROR, "Inconsistent label and parameter length", EXPFILL }},
{ &ei_rtcdc_message_type_unknown, { "rtcdc.message_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown message type", EXPFILL }},
};
proto_rtcdc = proto_register_protocol("WebRTC Datachannel Protocol", "RTCDC", "rtcdc");
proto_register_field_array(proto_rtcdc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_rtcdc = expert_register_protocol(proto_rtcdc);
expert_register_field_array(expert_rtcdc, ei, array_length(ei));
rtcdc_module = prefs_register_protocol(proto_rtcdc, proto_reg_handoff_rtcdc);
prefs_register_uint_preference(rtcdc_module, "sctp.ppi", "RTCDC SCTP PPID", "RTCDC SCTP PPID if other than the default", 10, &rtcdc_ppid);
}

View File

@ -498,7 +498,6 @@ static int hf_rtcp_xr_idms_ntp_rcv_ts_lsw = -1;
static int hf_rtcp_xr_idms_rtp_ts = -1;
static int hf_rtcp_xr_idms_ntp_pres_ts = -1;
static int hf_rtcp_length_check = -1;
static int hf_rtcp_bye_reason_not_padded = -1;
static int hf_rtcp_rtpfb_fmt = -1;
static int hf_rtcp_rtpfb_nack_pid = -1;
static int hf_rtcp_rtpfb_nack_blp = -1;
@ -568,9 +567,12 @@ static gint ett_xr_ssrc = -1;
static gint ett_xr_loss_chunk = -1;
static gint ett_poc1_conn_contents = -1;
static gint ett_rtcp_nack_blp = -1;
/* Protocol registration */
void proto_register_rtcp(void);
void proto_reg_handoff_rtcp(void);
static expert_field ei_rtcp_bye_reason_not_padded = EI_INIT;
static expert_field ei_rtcp_xr_block_length_bad = EI_INIT;
static expert_field ei_rtcp_roundtrip_delay = EI_INIT;
static expert_field ei_rtcp_length_check = EI_INIT;
static expert_field ei_rtcp_roundtrip_delay_negative = EI_INIT;
/* Main dissection function */
static void dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo,
@ -1652,13 +1654,7 @@ dissect_rtcp_bye( tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tre
if ((!(tvb_offset_exists(tvb, offset + i))) ||
(tvb_get_guint8(tvb, offset + i) != 0))
{
proto_item *ti;
ti = proto_tree_add_none_format(tree, hf_rtcp_bye_reason_not_padded,
tvb, reason_offset, reason_length,
"Reason string is not NULL padded (see RFC3550, section 6.6)");
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN,
"Reason string is not NULL padded (see RFC3550, section 6.6)");
PROTO_ITEM_SET_GENERATED(ti);
proto_tree_add_expert(tree, pinfo, &ei_rtcp_bye_reason_not_padded, tvb, reason_offset, reason_length);
}
}
@ -1810,27 +1806,23 @@ static gboolean validate_xr_block_length(tvbuff_t *tvb, packet_info *pinfo, int
switch (block_type) {
case RTCP_XR_REF_TIME:
if (block_len != 2)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Invalid block length, should be 2");
expert_add_info_format_text(pinfo, ti, &ei_rtcp_xr_block_length_bad, "Invalid block length, should be 2");
return FALSE;
case RTCP_XR_STATS_SUMRY:
if (block_len != 9)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Invalid block length, should be 9");
expert_add_info_format_text(pinfo, ti, &ei_rtcp_xr_block_length_bad, "Invalid block length, should be 9");
return FALSE;
case RTCP_XR_VOIP_METRCS:
case RTCP_XR_BT_XNQ:
if (block_len != 8)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Invalid block length, should be 8");
expert_add_info_format_text(pinfo, ti, &ei_rtcp_xr_block_length_bad, "Invalid block length, should be 8");
return FALSE;
case RTCP_XR_IDMS:
if (block_len != 7)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Invalid block length, should be 7");
expert_add_info_format_text(pinfo, ti, &ei_rtcp_xr_block_length_bad, "Invalid block length, should be 7");
return FALSE;
default:
@ -2788,17 +2780,11 @@ static void add_roundtrip_delay_info(tvbuff_t *tvb, packet_info *pinfo, proto_tr
/* Add to expert info */
if (delay >= 0)
{
expert_add_info_format(pinfo, item,
PI_SEQUENCE, PI_NOTE,
"RTCP round-trip delay detected (%d ms)",
delay);
expert_add_info_format_text(pinfo, item, &ei_rtcp_roundtrip_delay, "RTCP round-trip delay detected (%d ms)", delay);
}
else
{
expert_add_info_format(pinfo, item,
PI_SEQUENCE, PI_ERROR,
"Negative RTCP round-trip delay detected (%d ms)",
delay);
expert_add_info_format_text(pinfo, item, &ei_rtcp_roundtrip_delay_negative, "Negative RTCP round-trip delay detected (%d ms)", delay);
}
/* Report delay in INFO column */
@ -3119,10 +3105,7 @@ dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
total_packet_length, offset);
PROTO_ITEM_SET_GENERATED(ti);
expert_add_info_format(pinfo, ti,
PI_MALFORMED, PI_WARN,
"Incorrect RTCP packet length information (expected %u bytes, found %d)",
total_packet_length, offset);
expert_add_info_format_text(pinfo, ti, &ei_rtcp_length_check, "Incorrect RTCP packet length information (expected %u bytes, found %d)", total_packet_length, offset);
}
}
@ -4620,18 +4603,6 @@ proto_register_rtcp(void)
NULL, HFILL
}
},
{
&hf_rtcp_bye_reason_not_padded,
{
"BYE reason string not NULL padded",
"rtcp.bye_reason_not_padded",
FT_NONE,
BASE_NONE,
NULL,
0x0,
"RTCP BYE reason string not padded", HFILL
}
},
{
&hf_rtcp_rtpfb_fmt,
{
@ -5111,12 +5082,23 @@ proto_register_rtcp(void)
&ett_rtcp_nack_blp,
};
static ei_register_info ei[] = {
{ &ei_rtcp_bye_reason_not_padded, { "rtcp.bye_reason_not_padded", PI_MALFORMED, PI_WARN, "Reason string is not NULL padded (see RFC3550, section 6.6)", EXPFILL }},
{ &ei_rtcp_xr_block_length_bad, { "rtcp.invalid_block_length", PI_PROTOCOL, PI_WARN, "Invalid block length, should be 2", EXPFILL }},
{ &ei_rtcp_roundtrip_delay, { "rtcp.roundtrip-delay.expert", PI_SEQUENCE, PI_NOTE, "RTCP round-trip delay detected (%d ms)", EXPFILL }},
{ &ei_rtcp_roundtrip_delay_negative, { "rtcp.roundtrip-delay.negative", PI_SEQUENCE, PI_ERROR, "Negative RTCP round-trip delay detected (%d ms)", EXPFILL }},
{ &ei_rtcp_length_check, { "rtcp.length_check.bad", PI_MALFORMED, PI_WARN, "Incorrect RTCP packet length information (expected %u bytes, found %d)", EXPFILL }},
};
module_t *rtcp_module;
expert_module_t* expert_rtcp;
proto_rtcp = proto_register_protocol("Real-time Transport Control Protocol",
"RTCP", "rtcp");
proto_register_field_array(proto_rtcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_rtcp = expert_register_protocol(proto_rtcp);
expert_register_field_array(expert_rtcp, ei, array_length(ei));
register_dissector("rtcp", dissect_rtcp, proto_rtcp);

View File

@ -257,7 +257,16 @@ static gint ett_rtps_sample_info_list = -1;
static gint ett_rtps_sample_info = -1;
static gint ett_rtps_sample_batch_list = -1;
static expert_field rtps_sm_octets_to_next_header_error = EI_INIT;
static expert_field ei_rtps_sm_octets_to_next_header_error = EI_INIT;
static expert_field ei_rtps_port_invalid = EI_INIT;
static expert_field ei_rtps_ip_invalid = EI_INIT;
static expert_field ei_rtps_parameter_value_invalid = EI_INIT;
static expert_field ei_rtps_extra_bytes = EI_INIT;
static expert_field ei_rtps_missing_bytes = EI_INIT;
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;
/***************************************************************************/
/* Preferences */
@ -1052,7 +1061,7 @@ void rtps_util_add_locator_t(proto_tree *tree, packet_info *pinfo, tvbuff_t * tv
proto_tree_add_uint(locator_tree, hf_rtps_locator_kind, tvb, offset, 4, kind);
ti = proto_tree_add_int(locator_tree, hf_rtps_locator_port, tvb, offset+4, 4, port);
if (port == 0)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Invalid Port");
expert_add_info(pinfo, ti, &ei_rtps_locator_port);
if (kind == LOCATOR_KIND_UDPV4) {
proto_tree_add_item(locator_tree, hf_rtps_locator_ipv4, tvb, offset+20, 4, ENC_BIG_ENDIAN);
@ -1116,7 +1125,7 @@ void rtps_util_add_ipv4_address_t(proto_tree *tree, packet_info *pinfo, tvbuff_t
ti = proto_tree_add_ipv4(tree, hf_item, tvb, offset, 4, addr);
if (addr == IPADDRESS_INVALID)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, IPADDRESS_INVALID_STRING);
expert_add_info(pinfo, ti, &ei_rtps_ip_invalid);
}
@ -1147,7 +1156,7 @@ void rtps_util_add_locator_udp_v4(proto_tree *tree, packet_info *pinfo, tvbuff_t
port = NEXT_guint32(tvb, offset+4, little_endian);
ti = proto_tree_add_uint(locator_tree, hf_rtps_locator_udp_v4_port, tvb, offset, 4, port);
if (port == PORT_INVALID)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, PORT_INVALID_STRING);
expert_add_info(pinfo, ti, &ei_rtps_port_invalid);
}
@ -1496,7 +1505,7 @@ void rtps_util_add_port(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb,
ti = proto_tree_add_uint(tree, hf_item, tvb, offset, 4, port);
if (port == PORT_INVALID)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, PORT_INVALID_STRING);
expert_add_info(pinfo, ti, &ei_rtps_port_invalid);
}
@ -2222,7 +2231,7 @@ void rtps_util_add_seq_octets(proto_tree *tree, packet_info *pinfo, tvbuff_t* tv
offset += 4;
if (param_length < 4 + (int)seq_length) {
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "ERROR: Parameter value too small");
expert_add_info_format_text(pinfo, ti, &ei_rtps_parameter_value_invalid, "ERROR: Parameter value too small");
return;
}
@ -2352,7 +2361,7 @@ static int rtps_util_add_fragment_number_set(proto_tree *tree, packet_info *pinf
offset += 12;
} else {
/* size don't match, packet error */
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN, "Illegal size for fragment number set");
expert_add_info_format_text(pinfo, ti, &ei_rtps_parameter_value_invalid, "Illegal size for fragment number set");
return -1;
}
}
@ -2481,8 +2490,7 @@ static void rtps_util_decode_flags_16bit(proto_tree * tree, tvbuff_t *tvb, gint
*/
#define ENSURE_LENGTH(size) \
if (param_length < size) { \
expert_add_info_format(pinfo, param_len_item, PI_PROTOCOL, PI_WARN, \
"ERROR: parameter value too small (must be at least %d octects)", size); \
expert_add_info_format_text(pinfo, param_len_item, &ei_rtps_parameter_value_invalid, "ERROR: parameter value too small (must be at least %d octects)", size); \
break; \
}
@ -3425,7 +3433,7 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
case PID_TYPE2_NAME:
case PID_TYPE2_CHECKSUM:
case PID_RELIABILITY_ENABLED:
expert_add_info_format(pinfo, parameter_item, PI_PROTOCOL, PI_WARN, "[DEPRECATED] - Parameter not decoded");
expert_add_info(pinfo, parameter_item, &ei_rtps_parameter_not_decoded);
case PID_PAD:
if (param_length > 0) {
@ -3902,8 +3910,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, packet_info *pinfo, tvb
for (;;) {
size -= offset - original_offset;
if (size < 4) {
expert_add_info_format(pinfo, (param_len_item == NULL) ? ti : param_len_item,
PI_PROTOCOL, PI_WARN, "ERROR: not enough bytes to read the next parameter");
expert_add_info_format_text(pinfo, (param_len_item == NULL) ? ti : param_len_item, &ei_rtps_parameter_value_invalid, "ERROR: not enough bytes to read the next parameter");
return 0;
}
original_offset = offset;
@ -3942,7 +3949,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, packet_info *pinfo, tvb
/* Make sure we have enough bytes for the param value */
if ((size-4 < param_length) &&
(parameter != PID_SENTINEL)) {
expert_add_info_format(pinfo, param_len_item, PI_PROTOCOL, PI_WARN, "Not enough bytes to read the parameter value");
expert_add_info_format_text(pinfo, param_len_item, &ei_rtps_parameter_value_invalid, "Not enough bytes to read the parameter value");
return 0;
}
@ -4060,7 +4067,7 @@ void dissect_PAD(tvbuff_t *tvb,
2,
little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header != 0) {
expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Should be ZERO");
expert_add_info(pinfo, item, &ei_rtps_sm_octets_to_next_header_not_zero);
}
}
@ -4147,7 +4154,7 @@ static void dissect_DATA_v1(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin
if ((flags & FLAG_DATA_D) != 0) min_len += 4;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -4294,7 +4301,7 @@ static void dissect_DATA_v2(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin
if ((flags & FLAG_DATA_H) != 0) min_len += 12;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -4425,7 +4432,7 @@ static void dissect_DATA_FRAG(tvbuff_t *tvb, packet_info *pinfo, gint offset, gu
if ((flags & FLAG_DATA_FRAG_H) != 0) min_len += 12;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -4592,7 +4599,7 @@ static void dissect_NOKEY_DATA(tvbuff_t *tvb, packet_info *pinfo, gint offset, g
if ((flags & FLAG_NOKEY_DATA_Q) != 0) min_len += 4;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -4683,7 +4690,7 @@ static void dissect_NOKEY_DATA_FRAG(tvbuff_t *tvb, packet_info *pinfo, gint offs
if ((flags & FLAG_NOKEY_DATA_Q) != 0) min_len += 4;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -4789,7 +4796,7 @@ static void dissect_ACKNACK(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin
little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header < 20) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 20)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= 20)");
return;
}
@ -4838,15 +4845,13 @@ static void dissect_ACKNACK(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin
/* In this case there must be something wrong in the bitmap: there
* are some extra bytes that we don't know how to decode
*/
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"Don't know how to decode those extra bytes: %d", octets_to_next_header - offset);
expert_add_info_format_text(pinfo, item, &ei_rtps_extra_bytes, "Don't know how to decode those extra bytes: %d", octets_to_next_header - offset);
} else if (offset > original_offset + octets_to_next_header) {
/* Decoding the bitmap went over the end of this submessage.
* Enter an item in the protocol tree that spans over the entire
* submessage.
*/
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"Not enough bytes to decode");
expert_add_info(pinfo, item, &ei_rtps_missing_bytes);
}
}
@ -4884,7 +4889,7 @@ static void dissect_NACK_FRAG(tvbuff_t *tvb, packet_info *pinfo, gint offset, gu
offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header < 24) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)");
return;
}
@ -4985,11 +4990,11 @@ static void dissect_HEARTBEAT(tvbuff_t *tvb, packet_info *pinfo, gint offset, gu
little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if ((octets_to_next_header < 24) && (version <= 0x0101)) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)");
return;
}
else if (octets_to_next_header < 28) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 28)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= 28)");
return;
}
@ -5061,7 +5066,7 @@ static void dissect_HEARTBEAT_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs
offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header < 36) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 36)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= 36)");
return;
}
@ -5134,7 +5139,7 @@ static void dissect_HEARTBEAT_FRAG(tvbuff_t *tvb, packet_info *pinfo, gint offse
offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header < 24) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)");
return;
}
@ -5250,7 +5255,7 @@ static void dissect_RTPS_DATA(tvbuff_t *tvb, packet_info *pinfo, gint offset, gu
if ((flags & FLAG_RTPS_DATA_K) != 0) min_len += 4;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -5448,7 +5453,7 @@ static void dissect_RTPS_DATA_FRAG(tvbuff_t *tvb,
if ((flags & FLAG_RTPS_DATA_FRAG_Q) != 0) min_len += 4;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -5635,7 +5640,7 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs
if ((flags & FLAG_RTPS_DATA_BATCH_Q) != 0) min_len += 4;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -5741,8 +5746,7 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs
gint offset_begin_sampleinfo = offset;
if (rtps_max_batch_samples_dissected > 0 && (guint)sample_info_count >= rtps_max_batch_samples_dissected) {
expert_add_info_format(pinfo, list_item, PI_PROTOCOL, PI_NOTE,
"more samples available. Configure this limit from preferences dialog");
expert_add_info(pinfo, list_item, &ei_rtps_more_samples_available);
offset = sampleListOffset;
break;
}
@ -5765,8 +5769,7 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs
/* Ensure there are enough bytes to decode */
if (sampleListOffset - offset < min_length) {
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Error: not enough bytes to dissect sample info");
expert_add_info_format_text(pinfo, ti, &ei_rtps_parameter_value_invalid, "Error: not enough bytes to dissect sample info");
return;
}
@ -5833,8 +5836,7 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs
for (count = 0; count < sample_info_count; ++count) {
/* Ensure there are enough bytes in the buffer to dissect the next sample */
if (octets_to_next_header - (offset - old_offset) + 4 < (gint)sample_info_length[count]) {
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Error: not enough bytes to dissect sample");
expert_add_info_format_text(pinfo, ti, &ei_rtps_parameter_value_invalid, "Error: not enough bytes to dissect sample");
return;
}
@ -5904,7 +5906,7 @@ static void dissect_GAP(tvbuff_t *tvb,
offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header < 24) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)");
return;
}
@ -5974,7 +5976,7 @@ void dissect_INFO_TS(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 flag
if ((flags & FLAG_INFO_TS_T) == 0) min_len += 8;
if (octets_to_next_header != min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be == %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be == %u)", min_len);
return;
}
@ -6033,7 +6035,7 @@ void dissect_INFO_SRC(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 fla
offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header != 16) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be == 16)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be == 16)");
return;
}
@ -6119,7 +6121,7 @@ static void dissect_INFO_REPLY_IP4(tvbuff_t *tvb, packet_info *pinfo, gint offse
if ((flags & FLAG_INFO_REPLY_IP4_M) != 0) min_len += 8;
if (octets_to_next_header != min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be == %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be == %u)", min_len);
return;
}
@ -6173,7 +6175,7 @@ static void dissect_INFO_DST(tvbuff_t *tvb, packet_info *pinfo, gint offset, gui
offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header != 8) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be == 8)");
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be == 8)");
return;
}
@ -6236,7 +6238,7 @@ static void dissect_INFO_REPLY(tvbuff_t *tvb,
if ((flags & FLAG_INFO_REPLY_M) != 0) min_len += 4;
if (octets_to_next_header < min_len) {
expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
expert_add_info_format_text(pinfo, octet_item, &ei_rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len);
return;
}
@ -7756,7 +7758,16 @@ void proto_register_rtps(void) {
};
static ei_register_info ei[] = {
{ &rtps_sm_octets_to_next_header_error, { "rtps.sm.octetsToNextHeader.error", PI_PROTOCOL, PI_WARN, "(Error: bad length)", EXPFILL }},
{ &ei_rtps_sm_octets_to_next_header_error, { "rtps.sm.octetsToNextHeader.error", PI_PROTOCOL, PI_WARN, "(Error: bad length)", EXPFILL }},
{ &ei_rtps_locator_port, { "rtps.locator.port.invalid", PI_PROTOCOL, PI_WARN, "Invalid Port", EXPFILL }},
{ &ei_rtps_ip_invalid, { "rtps.ip_invalid", PI_PROTOCOL, PI_WARN, "IPADDRESS_INVALID_STRING", EXPFILL }},
{ &ei_rtps_port_invalid, { "rtps.port_invalid", PI_PROTOCOL, PI_WARN, "PORT_INVALID_STRING", EXPFILL }},
{ &ei_rtps_parameter_value_invalid, { "rtps.parameter_value_too_small", PI_PROTOCOL, PI_WARN, "ERROR: Parameter value too small", EXPFILL }},
{ &ei_rtps_parameter_not_decoded, { "rtps.parameter_not_decoded", PI_PROTOCOL, PI_WARN, "[DEPRECATED] - Parameter not decoded", EXPFILL }},
{ &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 }},
};
module_t *rtps_module;

View File

@ -240,7 +240,6 @@ static dissector_table_t sctp_port_dissector_table;
static dissector_table_t sctp_ppi_dissector_table;
static heur_dissector_list_t sctp_heur_subdissector_list;
static int sctp_tap = -1;
static module_t *sctp_module;
/* Initialize the subtree pointers */
static gint ett_sctp = -1;
@ -275,6 +274,21 @@ static gint ett_sctp_acked = -1;
static gint ett_sctp_tsn_retransmission = -1;
static gint ett_sctp_tsn_retransmitted_count = -1;
static gint ett_sctp_tsn_retransmitted = -1;
static expert_field ei_sctp_sack_chunk_adv_rec_window_credit = EI_INIT;
static expert_field ei_sctp_nr_sack_chunk_number_tsns_gap_acked_100 = EI_INIT;
static expert_field ei_sctp_parameter_length = EI_INIT;
static expert_field ei_sctp_bad_sctp_checksum = EI_INIT;
static expert_field ei_sctp_tsn_retransmitted_more_than_twice = EI_INIT;
static expert_field ei_sctp_parameter_padding = EI_INIT;
static expert_field ei_sctp_retransmitted_after_ack = EI_INIT;
static expert_field ei_sctp_nr_sack_chunk_number_tsns_nr_gap_acked_100 = EI_INIT;
static expert_field ei_sctp_sack_chunk_gap_block_out_of_order = EI_INIT;
static expert_field ei_sctp_chunk_length_bad = EI_INIT;
static expert_field ei_sctp_tsn_retransmitted = EI_INIT;
static expert_field ei_sctp_sack_chunk_gap_block_malformed = EI_INIT;
static expert_field ei_sctp_sack_chunk_number_tsns_gap_acked_100 = EI_INIT;
static dissector_handle_t data_handle;
#define SCTP_DATA_CHUNK_ID 0
@ -642,7 +656,7 @@ tsn_tree(sctp_tsn_t *t, proto_item *tsn_item, packet_info *pinfo,
pi = proto_tree_add_uint(tsn_tree_pt, hf_sctp_retransmission, tvb, 0, 0, t->first_transmit.framenum);
pt = proto_item_add_subtree(pi, ett_sctp_tsn_retransmission);
PROTO_ITEM_SET_GENERATED(pi);
expert_add_info_format(pinfo, pi, PI_SEQUENCE, PI_NOTE, "Retransmitted TSN");
expert_add_info(pinfo, pi, &ei_sctp_tsn_retransmitted);
nstime_delta( &rto, &pinfo->fd->abs_ts, &(t->first_transmit.ts) );
pi = proto_tree_add_time(pt, hf_sctp_rto, tvb, 0, 0, &rto);
@ -656,8 +670,7 @@ tsn_tree(sctp_tsn_t *t, proto_item *tsn_item, packet_info *pinfo,
"This TSN was acked (in frame %u) prior to this retransmission (reneged ack?)",
t->ack.framenum);
PROTO_ITEM_SET_GENERATED(pi);
expert_add_info_format(pinfo, pi, PI_SEQUENCE, PI_WARN,
"This TSN was acked prior to this retransmission (reneged ack?).");
expert_add_info(pinfo, pi, &ei_sctp_retransmitted_after_ack);
}
} else if (t->retransmit) {
retransmit_t **r;
@ -679,8 +692,7 @@ tsn_tree(sctp_tsn_t *t, proto_item *tsn_item, packet_info *pinfo,
PROTO_ITEM_SET_GENERATED(pi);
if (t->retransmit_count > 2)
expert_add_info_format(pinfo, pi, PI_SEQUENCE, PI_WARN,
"This TSN was retransmitted more than 2 times.");
expert_add_info(pinfo, pi, &ei_sctp_tsn_retransmitted_more_than_twice);
pt = proto_item_add_subtree(pi, ett_sctp_tsn_retransmitted_count);
@ -1474,14 +1486,11 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo,
parameter_tree = proto_item_add_subtree(parameter_item, ett_sctp_chunk_parameter);
if (final_parameter) {
if (padding_length > 0) {
expert_add_info_format(pinfo, parameter_item, PI_MALFORMED, PI_NOTE,
"The padding of this final parameter should be the padding of the chunk.");
expert_add_info(pinfo, parameter_item, &ei_sctp_parameter_padding);
}
} else {
if (reported_length % 4) {
expert_add_info_format(pinfo, parameter_item, PI_MALFORMED, PI_ERROR,
"Parameter length is not padded to a multiple of 4 bytes (length=%d)",
reported_length);
expert_add_info_format_text(pinfo, parameter_item, &ei_sctp_parameter_length, "Parameter length is not padded to a multiple of 4 bytes (length=%d)", reported_length);
}
}
@ -3046,7 +3055,7 @@ dissect_sack_chunk(packet_info *pinfo, tvbuff_t *chunk_tvb, proto_tree *chunk_tr
a_rwnd = tvb_get_ntohl(chunk_tvb, SACK_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET);
if (a_rwnd == 0)
expert_add_info_format(pinfo, a_rwnd_item, PI_SEQUENCE, PI_NOTE, "Zero Advertised Receiver Window Credit");
expert_add_info(pinfo, a_rwnd_item, &ei_sctp_sack_chunk_adv_rec_window_credit);
/* handle the gap acknowledgement blocks */
@ -3089,10 +3098,10 @@ dissect_sack_chunk(packet_info *pinfo, tvbuff_t *chunk_tvb, proto_tree *chunk_tr
/* Check validity */
if (start > end) {
expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_ERROR, "Malformed gap block.");
expert_add_info(pinfo, pi, &ei_sctp_sack_chunk_gap_block_malformed);
}
if (last_end > start) {
expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_WARN, "Gap blocks not in strict order.");
expert_add_info(pinfo, pi, &ei_sctp_sack_chunk_gap_block_out_of_order);
}
last_end = end;
}
@ -3107,7 +3116,7 @@ dissect_sack_chunk(packet_info *pinfo, tvbuff_t *chunk_tvb, proto_tree *chunk_tr
* number: it could be tuned.
*/
if (tsns_gap_acked > 100)
expert_add_info_format(pinfo, pi, PI_SEQUENCE, PI_WARN, "More than 100 TSNs were gap-acknowledged in this SACK.");
expert_add_info(pinfo, pi, &ei_sctp_sack_chunk_number_tsns_gap_acked_100);
}
@ -3224,10 +3233,10 @@ dissect_nr_sack_chunk(packet_info *pinfo, tvbuff_t *chunk_tvb, proto_tree *chunk
/* Check validity */
if (start > end) {
expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_ERROR, "Malformed gap block.");
expert_add_info(pinfo, pi, &ei_sctp_sack_chunk_gap_block_malformed);
}
if (last_end > start) {
expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_WARN, "Gap blocks not in strict order.");
expert_add_info(pinfo, pi, &ei_sctp_sack_chunk_gap_block_out_of_order);
}
last_end = end;
}
@ -3242,7 +3251,7 @@ dissect_nr_sack_chunk(packet_info *pinfo, tvbuff_t *chunk_tvb, proto_tree *chunk
* number: it could be tuned.
*/
if (tsns_gap_acked > 100)
expert_add_info_format(pinfo, pi, PI_SEQUENCE, PI_WARN, "More than 100 TSNs were gap-acknowledged in this NR-SACK.");
expert_add_info(pinfo, pi, &ei_sctp_nr_sack_chunk_number_tsns_gap_acked_100);
}
@ -3281,10 +3290,10 @@ dissect_nr_sack_chunk(packet_info *pinfo, tvbuff_t *chunk_tvb, proto_tree *chunk
/* Check validity */
if (start > end) {
expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_ERROR, "Malformed gap block.");
expert_add_info(pinfo, pi, &ei_sctp_sack_chunk_gap_block_malformed);
}
if (last_end > start) {
expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_WARN, "Gap blocks not in strict order.");
expert_add_info(pinfo, pi, &ei_sctp_sack_chunk_gap_block_out_of_order);
}
last_end = end;
}
@ -3299,7 +3308,7 @@ dissect_nr_sack_chunk(packet_info *pinfo, tvbuff_t *chunk_tvb, proto_tree *chunk
* number: it could be tuned.
*/
if (tsns_nr_gap_acked > 100)
expert_add_info_format(pinfo, pi, PI_SEQUENCE, PI_WARN, "More than 100 TSNs were nr-gap-acknowledged in this NR-SACK.");
expert_add_info(pinfo, pi, &ei_sctp_nr_sack_chunk_number_tsns_nr_gap_acked_100);
}
/* handle the duplicate TSNs */
@ -3706,8 +3715,7 @@ dissect_sctp_chunk(tvbuff_t *chunk_tvb,
chunk_item = proto_tree_add_text(sctp_tree, chunk_tvb, CHUNK_HEADER_OFFSET, reported_length, "%s chunk", val_to_str_const(type, chunk_type_values, "RESERVED"));
chunk_tree = proto_item_add_subtree(chunk_item, ett_sctp_chunk);
if (reported_length % 4)
expert_add_info_format(pinfo, chunk_item, PI_MALFORMED, PI_ERROR,
"Chunk length is not padded to a multiple of 4 bytes (length=%d).", reported_length);
expert_add_info_format_text(pinfo, chunk_item, &ei_sctp_chunk_length_bad, "Chunk length is not padded to a multiple of 4 bytes (length=%d).", reported_length);
if (tree) {
/* then insert the chunk header components into the protocol tree */
@ -3736,9 +3744,7 @@ dissect_sctp_chunk(tvbuff_t *chunk_tvb,
length_item = proto_tree_add_uint(chunk_tree, hf_chunk_length, chunk_tvb, CHUNK_LENGTH_OFFSET, CHUNK_LENGTH_LENGTH, length);
if (length > reported_length) {
expert_add_info_format(pinfo, length_item, PI_MALFORMED, PI_ERROR,
"Chunk length (%d) is longer than remaining data (%d) in the packet.",
length, reported_length);
expert_add_info_format_text(pinfo, length_item, &ei_sctp_chunk_length_bad, "Chunk length (%d) is longer than remaining data (%d) in the packet.", length, reported_length);
/* We'll almost certainly throw an exception shortly... */
}
@ -3982,7 +3988,7 @@ dissect_sctp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea
item = proto_tree_add_uint_format(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, checksum,
"Checksum: 0x%08x [incorrect Adler32, should be 0x%08x]",
checksum, calculated_adler32);
expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad SCTP checksum.");
expert_add_info(pinfo, item, &ei_sctp_bad_sctp_checksum);
}
hidden_item = proto_tree_add_boolean(sctp_tree, hf_checksum_bad, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, !(adler32_correct));
PROTO_ITEM_SET_HIDDEN(hidden_item);
@ -3995,7 +4001,7 @@ dissect_sctp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea
item = proto_tree_add_uint_format(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, checksum,
"Checksum: 0x%08x [incorrect CRC32C, should be 0x%08x]",
checksum, calculated_crc32c);
expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad SCTP checksum.");
expert_add_info(pinfo, item, &ei_sctp_bad_sctp_checksum);
}
hidden_item = proto_tree_add_boolean(sctp_tree, hf_checksum_bad, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, !(crc32c_correct));
PROTO_ITEM_SET_HIDDEN(hidden_item);
@ -4014,7 +4020,7 @@ dissect_sctp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea
item = proto_tree_add_uint_format(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, checksum,
"Checksum: 0x%08x [incorrect, should be 0x%08x (Adler32) or 0x%08x (CRC32C)]",
checksum, calculated_adler32, calculated_crc32c);
expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad SCTP checksum.");
expert_add_info(pinfo, item, &ei_sctp_bad_sctp_checksum);
}
hidden_item = proto_tree_add_boolean(sctp_tree, hf_checksum_bad, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, !(crc32c_correct || adler32_correct));
PROTO_ITEM_SET_HIDDEN(hidden_item);
@ -4268,6 +4274,22 @@ proto_register_sctp(void)
&ett_sctp_tsn_retransmitted
};
static ei_register_info ei[] = {
{ &ei_sctp_tsn_retransmitted, { "sctp.retransmission.expert", PI_SEQUENCE, PI_NOTE, "Retransmitted TSN", EXPFILL }},
{ &ei_sctp_retransmitted_after_ack, { "retransmitted_after_ack.expert", PI_SEQUENCE, PI_WARN, "This TSN was acked prior to this retransmission (reneged ack?).", EXPFILL }},
{ &ei_sctp_tsn_retransmitted_more_than_twice, { "sctp.retransmission.more_than_twice", PI_SEQUENCE, PI_WARN, "This TSN was retransmitted more than 2 times.", EXPFILL }},
{ &ei_sctp_parameter_padding, { "sctp.parameter_padding.expert", PI_MALFORMED, PI_NOTE, "The padding of this final parameter should be the padding of the chunk.", EXPFILL }},
{ &ei_sctp_parameter_length, { "sctp.parameter_length.bad", PI_MALFORMED, PI_ERROR, "Parameter length bad", EXPFILL }},
{ &ei_sctp_sack_chunk_adv_rec_window_credit, { "sctp.sack_a_rwnd.expert", PI_SEQUENCE, PI_NOTE, "Zero Advertised Receiver Window Credit", EXPFILL }},
{ &ei_sctp_sack_chunk_gap_block_malformed, { "sctp.sack_gap_block_malformed", PI_PROTOCOL, PI_ERROR, "Malformed gap block.", EXPFILL }},
{ &ei_sctp_sack_chunk_gap_block_out_of_order, { "sctp.sack_gap_block_out_of_order", PI_PROTOCOL, PI_WARN, "Gap blocks not in strict order.", EXPFILL }},
{ &ei_sctp_sack_chunk_number_tsns_gap_acked_100, { "sctp.sack_number_of_tsns_gap_acked.100", PI_SEQUENCE, PI_WARN, "More than 100 TSNs were gap-acknowledged in this SACK.", EXPFILL }},
{ &ei_sctp_nr_sack_chunk_number_tsns_gap_acked_100, { "sctp.nr_sack_number_of_tsns_gap_acked.100", PI_SEQUENCE, PI_WARN, "More than 100 TSNs were gap-acknowledged in this NR-SACK.", EXPFILL }},
{ &ei_sctp_nr_sack_chunk_number_tsns_nr_gap_acked_100, { "sctp.nr_sack_number_of_tsns_nr_gap_acked.100", PI_SEQUENCE, PI_WARN, "More than 100 TSNs were nr-gap-acknowledged in this NR-SACK.", EXPFILL }},
{ &ei_sctp_chunk_length_bad, { "sctp.chunk_length.bad", PI_MALFORMED, PI_ERROR, "Chunk length bad", EXPFILL }},
{ &ei_sctp_bad_sctp_checksum, { "sctp.checksum_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad SCTP checksum.", EXPFILL }},
};
static const enum_val_t sctp_checksum_options[] = {
{ "none", "None", SCTP_CHECKSUM_NONE },
{ "adler-32", "Adler 32", SCTP_CHECKSUM_ADLER32 },
@ -4276,6 +4298,9 @@ proto_register_sctp(void)
{ NULL, NULL, 0 }
};
module_t *sctp_module;
expert_module_t* expert_sctp;
/* Register the protocol name and description */
proto_sctp = proto_register_protocol("Stream Control Transmission Protocol", "SCTP", "sctp");
sctp_module = prefs_register_protocol(proto_sctp, NULL);
@ -4316,6 +4341,9 @@ proto_register_sctp(void)
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_sctp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_sctp = expert_register_protocol(proto_sctp);
expert_register_field_array(expert_sctp, ei, array_length(ei));
sctp_tap = register_tap("sctp");
/* subdissector code */
sctp_port_dissector_table = register_dissector_table("sctp.port", "SCTP port", FT_UINT16, BASE_DEC);

View File

@ -960,6 +960,17 @@ static gint ett_oampdu_lpbk_ctrl = -1;
static gint ett_ossppdu = -1;
static gint ett_itu_ossp = -1;
static expert_field ei_esmc_tlv_type_ql_type_not_first = EI_INIT;
static expert_field ei_esmc_tlv_type_not_timestamp = EI_INIT;
static expert_field ei_esmc_quality_level_invalid = EI_INIT;
static expert_field ei_esmc_tlv_ql_unused_not_zero = EI_INIT;
static expert_field ei_esmc_tlv_type_decoded_as_timestamp = EI_INIT;
static expert_field ei_esmc_tlv_type_decoded_as_ql_type = EI_INIT;
static expert_field ei_esmc_version_compliance = EI_INIT;
static expert_field ei_oampdu_event_length_bad = EI_INIT;
static expert_field ei_esmc_tlv_length_bad = EI_INIT;
static expert_field ei_esmc_reserved_not_zero = EI_INIT;
static const char initial_sep[] = " (";
static const char cont_sep[] = ", ";
@ -1660,9 +1671,7 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
if ((tvb_get_guint8(tvb, offset) >> 4) != ESMC_VERSION_1)
{
malformed = TRUE;
expert_add_info_format(pinfo, item_b, PI_MALFORMED, PI_ERROR
,"Version must be 0x%.1x claim compliance with Version 1 of this protocol"
,ESMC_VERSION_1);
expert_add_info_format_text(pinfo, item_b, &ei_esmc_version_compliance, "Version must be 0x%.1x claim compliance with Version 1 of this protocol", ESMC_VERSION_1);
}
/*stay at the same octet in tvb*/
}
@ -1687,8 +1696,7 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
if (reserved != 0x0)
{
malformed = TRUE;
expert_add_info_format(pinfo, item_b, PI_MALFORMED, PI_WARN
,"Reserved bits must be set to all zero on transmitter");
expert_add_info_format_text(pinfo, item_b, &ei_esmc_reserved_not_zero, "Reserved bits must be set to all zero on transmitter");
}
offset += 4;
}
@ -1716,11 +1724,8 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
if (type != ESMC_QL_TLV_TYPE)
{
malformed = TRUE;
expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_ERROR
,"TLV Type must be == 0x%.2x (QL) because QL TLV must be first in the ESMC PDU"
,ESMC_QL_TLV_TYPE);
expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_NOTE
,"Let's decode as if this is QL TLV");
expert_add_info_format_text(pinfo, item_c, &ei_esmc_tlv_type_ql_type_not_first, "TLV Type must be == 0x%.2x (QL) because QL TLV must be first in the ESMC PDU", ESMC_QL_TLV_TYPE);
expert_add_info(pinfo, item_c, &ei_esmc_tlv_type_decoded_as_ql_type);
}
offset += 1;
@ -1730,10 +1735,8 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
if (length != ESMC_QL_TLV_LENGTH)
{
malformed = TRUE;
expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_ERROR
,"QL TLV Length must be == 0x%.4x", ESMC_QL_TLV_LENGTH);
expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_NOTE
,"Let's decode this TLV as if Length has valid value");
expert_add_info_format_text(pinfo, item_c, &ei_esmc_tlv_length_bad, "QL TLV Length must be == 0x%.4x", ESMC_QL_TLV_LENGTH);
expert_add_info_format_text(pinfo, item_c, &ei_esmc_tlv_type_decoded_as_ql_type, "Let's decode this TLV as if Length has valid value");
}
offset += 2;
@ -1745,8 +1748,7 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
if (unused != 0x00)
{
malformed = TRUE;
expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_WARN
,"Unused bits of TLV must be all zeroes");
expert_add_info(pinfo, item_c, &ei_esmc_tlv_ql_unused_not_zero);
}
if (NULL != try_val_to_str(ql, esmc_quality_level_opt_1_vals))
{
@ -1755,8 +1757,7 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
else
{
item_c = proto_tree_add_item(tree_b, hf_esmc_quality_level_invalid, tvb, offset, 1, ENC_BIG_ENDIAN);
expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_WARN
,"Invalid SSM message, unknown QL code");
expert_add_info(pinfo, item_c, &ei_esmc_quality_level_invalid);
}
offset += 1;
}
@ -1794,11 +1795,8 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
if (type != ESMC_TIMESTAMP_TLV_TYPE)
{
malformed = TRUE;
expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_ERROR
,"TLV Type must be == 0x%.2x (Timestamp) because Timestamp Valid Flag is set"
,ESMC_TIMESTAMP_TLV_TYPE);
expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_NOTE
,"Let's decode as if this is Timestamp TLV");
expert_add_info_format_text(pinfo, item_c, &ei_esmc_tlv_type_not_timestamp, "TLV Type must be == 0x%.2x (Timestamp) because Timestamp Valid Flag is set", ESMC_TIMESTAMP_TLV_TYPE);
expert_add_info(pinfo, item_c, &ei_esmc_tlv_type_decoded_as_timestamp);
}
offset += 1;
@ -1808,11 +1806,8 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
if (length != ESMC_TIMESTAMP_TLV_LENGTH)
{
malformed = TRUE;
expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_ERROR
,"Timestamp TLV Length must be == 0x%.4x"
,ESMC_TIMESTAMP_TLV_LENGTH);
expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_NOTE
,"Let's decode this TLV as if Length has valid value");
expert_add_info_format_text(pinfo, item_c, &ei_esmc_tlv_length_bad, "Timestamp TLV Length must be == 0x%.4x", ESMC_TIMESTAMP_TLV_LENGTH);
expert_add_info_format_text(pinfo, item_c, &ei_esmc_tlv_type_decoded_as_timestamp, "Let's decode this TLV as if Length has valid value");
}
offset += 2;
@ -1827,8 +1822,7 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
item_c = proto_tree_add_item(tree_b, hf_esmc_tlv_ts_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
if (reserved != 0x0)
{
expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_WARN
,"Reserved bits must be set to all zero");
expert_add_info(pinfo, item_c, &ei_esmc_reserved_not_zero);
}
offset += 1;
}
@ -2532,8 +2526,7 @@ dissect_oampdu_event_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree
if (raw_octet < 2)
{
expert_add_info_format(pinfo, event_item, PI_MALFORMED, PI_ERROR,
"Event length should be at least 2");
expert_add_info_format_text(pinfo, event_item, &ei_oampdu_event_length_bad, "Event length should be at least 2");
}
else
{
@ -3523,6 +3516,22 @@ proto_register_slow_protocols(void)
};
static ei_register_info ei[] = {
{ &ei_esmc_version_compliance, { "slow.esmc.version.compliance", PI_MALFORMED, PI_ERROR, "Version must claim compliance with Version 1 of this protocol", EXPFILL }},
{ &ei_esmc_tlv_type_ql_type_not_first, { "slow.esmc.tlv_type.ql_type_not_first", PI_MALFORMED, PI_ERROR, "TLV Type must be QL because QL TLV must be first in the ESMC PDU", EXPFILL }},
{ &ei_esmc_tlv_type_decoded_as_ql_type, { "slow.esmc.tlv_type.decoded_as_ql_type", PI_UNDECODED, PI_NOTE, "Let's decode as if this is QL TLV", EXPFILL }},
{ &ei_esmc_tlv_length_bad, { "slow.esmc.tlv_length.bad", PI_MALFORMED, PI_ERROR, "QL TLV Length must be X", EXPFILL }},
{ &ei_esmc_tlv_ql_unused_not_zero, { "slow.esmc.tlv_ql_unused.not_zero", PI_MALFORMED, PI_WARN, "Unused bits of TLV must be all zeroes", EXPFILL }},
{ &ei_esmc_quality_level_invalid, { "slow.esmc.ql.invalid", PI_UNDECODED, PI_WARN, "Invalid SSM message, unknown QL code", EXPFILL }},
{ &ei_esmc_tlv_type_not_timestamp, { "slow.esmc.tlv_type.not_timestamp", PI_MALFORMED, PI_ERROR, "TLV Type must be == Timestamp because Timestamp Valid Flag is set", EXPFILL }},
{ &ei_esmc_tlv_type_decoded_as_timestamp, { "slow.esmc.tlv_type.decoded_as_timestamp", PI_UNDECODED, PI_NOTE, "Let's decode as if this is Timestamp TLV", EXPFILL }},
{ &ei_esmc_reserved_not_zero, { "slow.reserved_bits_must_be_set_to_all_zero", PI_PROTOCOL, PI_WARN, "Reserved bits must be set to all zero", EXPFILL }},
{ &ei_oampdu_event_length_bad, { "slow.oam.event.length.bad", PI_MALFORMED, PI_ERROR, "Event length should be at least 2", EXPFILL }},
};
expert_module_t* expert_slow;
/* Register the protocol name and description */
proto_slow = proto_register_protocol("Slow Protocols", "802.3 Slow protocols", "slow");
@ -3531,6 +3540,8 @@ proto_register_slow_protocols(void)
proto_register_field_array(proto_slow, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_slow = expert_register_protocol(proto_slow);
expert_register_field_array(expert_slow, ei, array_length(ei));
}

View File

@ -123,6 +123,23 @@ static gint ett_xmcp_attr_all = -1;
static gint ett_xmcp_attr = -1;
static gint ett_xmcp_attr_flag = -1;
static expert_field ei_xmcp_message_class_reserved = EI_INIT;
static expert_field ei_xmcp_attr_length_bad = EI_INIT;
static expert_field ei_xmcp_attr_error_number_out_of_range = EI_INIT;
static expert_field ei_xmcp_type_reserved_not_zero = EI_INIT;
static expert_field ei_xmcp_data_following_message_integrity = EI_INIT;
static expert_field ei_xmcp_msg_type_method_reserved = EI_INIT;
static expert_field ei_xmcp_xmcp_attr_servtrans_unknown = EI_INIT;
static expert_field ei_xmcp_attr_realm_incorrect = EI_INIT;
static expert_field ei_xmcp_new_session = EI_INIT;
static expert_field ei_xmcp_response_without_request = EI_INIT;
static expert_field ei_xmcp_length_bad = EI_INIT;
static expert_field ei_xmcp_error_response = EI_INIT;
static expert_field ei_xmcp_magic_cookie_incorrect = EI_INIT;
static expert_field ei_xmcp_attr_type_unknown = EI_INIT;
static expert_field ei_xmcp_session_termination = EI_INIT;
static expert_field ei_xmcp_attr_error_code_unusual = EI_INIT;
#define TCP_PORT_XMCP 4788
#define XMCP_MAGIC_COOKIE 0x7f5a9bc7
@ -437,8 +454,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
attr_length, ENC_NA);
/* Message-integrity should be the last attribute in the message */
if ((guint)(offset + get_xmcp_attr_padded_len(attr_length)) < tvb_reported_length(tvb)) {
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_WARN,
"Data following message-integrity");
expert_add_info(pinfo, attr_tree, &ei_xmcp_data_following_message_integrity);
}
break;
case XMCP_ERROR_CODE:
@ -458,8 +474,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
error_number = tvb_get_guint8(tvb, offset+3);
if (error_number > 99) {
expert_add_info_format(pinfo, it, PI_PROTOCOL, PI_WARN,
"Error number out of 0-99 range");
expert_add_info(pinfo, it, &ei_xmcp_attr_error_number_out_of_range);
} else {
/* Error code = error class + (error num % 100) */
error_code = (error_class * 100) + error_number;
@ -485,10 +500,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
case 477: /* Already Registered */
case 499: /* Miscellaneous Request Error */
case 500: /* Responder Error */
expert_add_info_format(pinfo, it, PI_RESPONSE_CODE, PI_WARN,
"Unusual error code (%u, %s)", error_code,
val_to_str_const(error_code, error_codes,
"Unknown"));
expert_add_info_format_text(pinfo, it, &ei_xmcp_attr_error_code_unusual, "Unusual error code (%u, %s)", error_code, val_to_str_const(error_code, error_codes, "Unknown"));
break;
default:
break;
@ -504,7 +516,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
(attr_length-4)));
break;
case XMCP_REALM:
proto_tree_add_item(attr_tree, xmcp_attr_realm, tvb, offset,
it = proto_tree_add_item(attr_tree, xmcp_attr_realm, tvb, offset,
attr_length, ENC_ASCII|ENC_NA);
{
guint8 *realm;
@ -512,8 +524,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
proto_item_append_text(attr_tree, ": %s", realm);
/* In XMCP the REALM string should always be "SAF" including the quotes */
if (attr_length != 5 || strncmp(realm, "\"SAF\"", attr_length)) {
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_WARN,
"Incorrect Realm");
expert_add_info(pinfo, it, &ei_xmcp_attr_realm_incorrect);
}
}
break;
@ -631,8 +642,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
switch (tvb_get_guint8(tvb, (offset+1))) {
case 0x01: /* IPv4 */
if (attr_length != 8) {
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_WARN,
"Malformed IPv4 address");
expert_add_info_format_text(pinfo, attr_tree, &ei_xmcp_attr_length_bad, "Malformed IPv4 address");
} else {
guint32 ip;
proto_tree_add_item(attr_tree, xmcp_attr_servtrans_ipv4, tvb,
@ -644,8 +654,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
break;
case 0x02: /* IPv6 */
if (attr_length != 20) {
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_WARN,
"Malformed IPv6 address");
expert_add_info_format_text(pinfo, attr_tree, &ei_xmcp_attr_length_bad, "Malformed IPv6 address");
} else {
struct e_in6_addr ipv6;
proto_tree_add_item(attr_tree, xmcp_attr_servtrans_ipv6, tvb,
@ -656,8 +665,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
}
break;
default:
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_WARN,
"Unknown transport type");
expert_add_info(pinfo, attr_tree, &ei_xmcp_xmcp_attr_servtrans_unknown);
break;
}
break;
@ -680,8 +688,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
case XMCP_FLAGS:
/* Flags is a series of type-value pairs */
if (attr_length % 4 != 0) {
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_WARN,
"Malformed Flags - length not divisible by 4");
expert_add_info_format_text(pinfo, attr_tree, &ei_xmcp_attr_length_bad, "Malformed Flags - length not divisible by 4");
}
{
guint16 flag_type, flag_value, current_offset = offset;
@ -808,8 +815,7 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
default:
proto_tree_add_item(attr_tree, xmcp_attr_value, tvb, offset,
attr_length, ENC_NA);
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_NOTE,
"Unrecognized attribute type 0x%x", attr_type);
expert_add_info(pinfo, attr_tree, &ei_xmcp_attr_type_unknown);
break;
}
if (attr_length % 4 != 0) {
@ -817,11 +823,9 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
(4 - (attr_length % 4)), ENC_NA);
}
if (attr_length < get_xmcp_attr_min_len(attr_type)) {
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_WARN,
"Length less than minimum for this attribute type");
expert_add_info_format_text(pinfo, attr_tree, &ei_xmcp_attr_length_bad, "Length less than minimum for this attribute type");
} else if (attr_length > get_xmcp_attr_max_len(attr_type)) {
expert_add_info_format(pinfo, attr_tree, PI_PROTOCOL, PI_WARN,
"Length exceeds maximum for this attribute type");
expert_add_info_format_text(pinfo, attr_tree, &ei_xmcp_attr_length_bad, "Length exceeds maximum for this attribute type");
}
}
@ -920,20 +924,16 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
xmcp_type_fields, ENC_BIG_ENDIAN);
if (msg_type & XMCP_TYPE_RESERVED) {
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"First two bits not zero");
expert_add_info(pinfo, ti, &ei_xmcp_type_reserved_not_zero);
}
if (xmcp_msg_type_class == XMCP_CLASS_RESERVED) {
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Reserved message class");
expert_add_info(pinfo, ti, &ei_xmcp_message_class_reserved);
} else if (xmcp_msg_type_class == XMCP_CLASS_RESPONSE_ERROR) {
expert_add_info_format(pinfo, ti, PI_RESPONSE_CODE, PI_NOTE,
"Error Response");
expert_add_info(pinfo, ti, &ei_xmcp_error_response);
}
if (xmcp_msg_type_method < 0x001 || xmcp_msg_type_method > 0x00b) {
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Reserved message method");
expert_add_info(pinfo, ti, &ei_xmcp_msg_type_method_reserved);
}
/*
@ -948,18 +948,14 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(xmcp_tree, hf_xmcp_length, tvb, 2, 2, ENC_BIG_ENDIAN);
msg_length = tvb_get_ntohs(tvb, 2);
if ((guint)(msg_length + XMCP_HDR_LEN) > tvb_reported_length(tvb)) {
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_ERROR,
"XMCP message length (%u-byte header + %u) exceeds "
"packet length (%u)",
XMCP_HDR_LEN, msg_length, tvb_reported_length(tvb));
expert_add_info_format_text(pinfo, ti, &ei_xmcp_length_bad, "XMCP message length (%u-byte header + %u) exceeds packet length (%u)", XMCP_HDR_LEN, msg_length, tvb_reported_length(tvb));
return;
}
/* ...a 4 byte magic cookie... */
ti = proto_tree_add_item(xmcp_tree, hf_xmcp_cookie, tvb, 4, 4, ENC_BIG_ENDIAN);
if (tvb_get_ntohl(tvb, 4) != XMCP_MAGIC_COOKIE) {
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Magic cookie not correct for XMCP");
expert_add_info(pinfo, ti, &ei_xmcp_magic_cookie_incorrect);
}
/* ...and a 12-byte transaction id */
@ -985,8 +981,7 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
PROTO_ITEM_SET_GENERATED(ti);
} else {
/* This is a response, but we don't know about a request for this response? */
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_NOTE,
"Response without corresponding request");
expert_add_info(pinfo, ti, &ei_xmcp_response_without_request);
}
}
@ -1026,8 +1021,7 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if ((offset + attr_length) > (XMCP_HDR_LEN + msg_length)) {
proto_item_append_text(ti, " (bogus, exceeds message length)");
expert_add_info_format(pinfo, attr_tree, PI_MALFORMED, PI_ERROR,
"Attribute length exceeds message length");
expert_add_info_format_text(pinfo, attr_tree, &ei_xmcp_attr_length_bad, "Attribute length exceeds message length");
break;
}
@ -1055,15 +1049,10 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else if (xmcp_msg_type_class == XMCP_CLASS_REQUEST ||
xmcp_msg_type_class == XMCP_CLASS_RESPONSE_SUCCESS) {
if (xmcp_msg_type_method == XMCP_METHOD_REGISTER) {
expert_add_info_format(pinfo, xmcp_tree, PI_SEQUENCE, PI_CHAT,
"New session - Register %s",
val_to_str_const(xmcp_msg_type_class, classes, ""));
expert_add_info_format_text(pinfo, xmcp_tree, &ei_xmcp_new_session, "New session - Register %s", val_to_str_const(xmcp_msg_type_class, classes, ""));
} else if (xmcp_msg_type_method == XMCP_METHOD_UNREGISTER ||
xmcp_msg_type_method == XMCP_METHOD_REG_REVOKE) {
expert_add_info_format(pinfo, xmcp_tree, PI_SEQUENCE, PI_CHAT,
"Session termination - %s %s",
val_to_str_const(xmcp_msg_type_method, methods, ""),
val_to_str_const(xmcp_msg_type_class, classes, ""));
expert_add_info_format_text(pinfo, xmcp_tree, &ei_xmcp_session_termination, "Session termination - %s %s", val_to_str_const(xmcp_msg_type_method, methods, ""), val_to_str_const(xmcp_msg_type_class, classes, ""));
}
}
}
@ -1340,13 +1329,36 @@ proto_register_xmcp(void)
&ett_xmcp_attr,
&ett_xmcp_attr_flag
};
static ei_register_info ei[] = {
{ &ei_xmcp_data_following_message_integrity, { "xmcp.data_following_message_integrity", PI_PROTOCOL, PI_WARN, "Data following message-integrity", EXPFILL }},
{ &ei_xmcp_attr_error_number_out_of_range, { "xmcp.attr.error.number.out_of_range", PI_PROTOCOL, PI_WARN, "Error number out of 0-99 range", EXPFILL }},
{ &ei_xmcp_attr_error_code_unusual, { "xmcp.attr.error.unusual", PI_RESPONSE_CODE, PI_WARN, "Unusual error code", EXPFILL }},
{ &ei_xmcp_attr_realm_incorrect, { "xmcp.attr.realm.incorrect", PI_PROTOCOL, PI_WARN, "Incorrect Realm", EXPFILL }},
{ &ei_xmcp_attr_length_bad, { "xmcp.attr.length.bad", PI_PROTOCOL, PI_WARN, "Malformed IPv4 address", EXPFILL }},
{ &ei_xmcp_xmcp_attr_servtrans_unknown, { "xmcp.attr.service.transport.unknown", PI_PROTOCOL, PI_WARN, "Unknown transport type", EXPFILL }},
{ &ei_xmcp_attr_type_unknown, { "xmcp.attr.type.unknown", PI_PROTOCOL, PI_NOTE, "Unrecognized attribute type", EXPFILL }},
{ &ei_xmcp_type_reserved_not_zero, { "xmcp.type.reserved.not_zero", PI_PROTOCOL, PI_WARN, "First two bits not zero", EXPFILL }},
{ &ei_xmcp_message_class_reserved, { "xmcp.message_class.reserved", PI_PROTOCOL, PI_WARN, "Reserved message class", EXPFILL }},
{ &ei_xmcp_error_response, { "xmcp.error_response", PI_RESPONSE_CODE, PI_NOTE, "Error Response", EXPFILL }},
{ &ei_xmcp_msg_type_method_reserved, { "xmcp.msg_type_method.reserved", PI_PROTOCOL, PI_WARN, "Reserved message method", EXPFILL }},
{ &ei_xmcp_length_bad, { "xmcp.length.bad", PI_PROTOCOL, PI_ERROR, "XMCP message length exceeds packet length", EXPFILL }},
{ &ei_xmcp_magic_cookie_incorrect, { "xmcp.cookie.incorrect", PI_PROTOCOL, PI_WARN, "Magic cookie not correct for XMCP", EXPFILL }},
{ &ei_xmcp_response_without_request, { "xmcp.response_without_request", PI_SEQUENCE, PI_NOTE, "Response without corresponding request", EXPFILL }},
{ &ei_xmcp_new_session, { "xmcp.new_session", PI_SEQUENCE, PI_CHAT, "New session - Register", EXPFILL }},
{ &ei_xmcp_session_termination, { "xmcp.session_termination", PI_SEQUENCE, PI_CHAT, "Session termination", EXPFILL }},
};
module_t *xmcp_module;
expert_module_t* expert_xmcp;
proto_xmcp = proto_register_protocol("eXtensible Messaging Client Protocol",
"XMCP", "xmcp");
proto_register_field_array(proto_xmcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_xmcp = expert_register_protocol(proto_xmcp);
expert_register_field_array(expert_xmcp, ei, array_length(ei));
/* Register XMCP configuration options */
xmcp_module = prefs_register_protocol(proto_xmcp, proto_reg_handoff_xmcp);