From 7e8e5b347e43359fcb36e32f9ce998c49b8d9fae Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 25 May 2013 17:06:40 +0000 Subject: Batch of filterable expert_infos. svn path=/trunk/; revision=49581 --- epan/dissectors/packet-bfd.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'epan/dissectors/packet-bfd.c') diff --git a/epan/dissectors/packet-bfd.c b/epan/dissectors/packet-bfd.c index 5f4a380ecf..79c4e6177d 100644 --- a/epan/dissectors/packet-bfd.c +++ b/epan/dissectors/packet-bfd.c @@ -162,6 +162,9 @@ static gint ett_bfd = -1; static gint ett_bfd_flags = -1; static gint ett_bfd_auth = -1; +static expert_field ei_bfd_auth_len_invalid = EI_INIT; +static expert_field ei_bfd_auth_no_data = EI_INIT; + static gint hf_mep_type = -1; static gint hf_mep_len = -1; static gint hf_mep_global_id = -1; @@ -359,7 +362,7 @@ dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Length of authentication is invalid (%d)", auth_len); proto_item_append_text(auth_item, ": Invalid Authentication Section"); } - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, ti, &ei_bfd_auth_len_invalid, "Length of authentication section is invalid for Authentication Type: %s", val_to_str(auth_type, bfd_control_auth_type_values, "Unknown Authentication Type (%d)") ); } @@ -565,13 +568,9 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (bfd_length >= 28) { dissect_bfd_authentication(tvb, pinfo, bfd_tree); } else { - proto_item *ti = NULL; - if (tree) { - ti = proto_tree_add_text(bfd_tree, tvb, 24, bfd_length-24, + proto_item *ti = proto_tree_add_text(bfd_tree, tvb, 24, bfd_length-24, "Authentication: Length of the BFD frame is invalid (%d)", bfd_length); - } - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN, - "Authentication flag is set in a BFD packet, but no authentication data is present"); + expert_add_info(pinfo, ti, &ei_bfd_auth_no_data); } } @@ -894,6 +893,13 @@ proto_register_bfd(void) &ett_bfd_auth }; + static ei_register_info ei[] = { + { &ei_bfd_auth_len_invalid, { "bfd.auth.len.invalid", PI_MALFORMED, PI_WARN, "Length of authentication section is invalid", EXPFILL }}, + { &ei_bfd_auth_no_data, { "bfd.auth.no_data", PI_MALFORMED, PI_WARN, "Authentication flag is set in a BFD packet, but no authentication data is present", EXPFILL }}, + }; + + expert_module_t* expert_bfd; + /* Register the protocol name and description */ proto_bfd = proto_register_protocol("Bidirectional Forwarding Detection Control Message", "BFD Control", @@ -903,6 +909,8 @@ proto_register_bfd(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_bfd, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_bfd = expert_register_protocol(proto_bfd); + expert_register_field_array(expert_bfd, ei, array_length(ei)); } void -- cgit v1.2.1