diff options
24 files changed, 330 insertions, 90 deletions
diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index 3daf9eeb7a..77c79703b3 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -77,6 +77,10 @@ static gint ett_ether = -1; static gint ett_addr = -1; static gint ett_eth_fcs = -1; +static expert_field ei_eth_invalid_lentype = EI_INIT; +static expert_field ei_eth_src_not_group = EI_INIT; +static expert_field ei_eth_fcs_bad = EI_INIT; + static dissector_handle_t fw1_handle; static dissector_handle_t data_handle; static heur_dissector_list_t heur_subdissector_list; @@ -311,7 +315,7 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, proto_tree_add_item(addr_tree, hf_eth_ig, tvb, 6, 3, ENC_BIG_ENDIAN); ti = proto_tree_add_item(fh_tree, hf_eth_invalid_lentype, tvb, 12, 2, ENC_BIG_ENDIAN); - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, + expert_add_info_format_text(pinfo, ti, &ei_eth_invalid_lentype, "Invalid length/type: 0x%04x (%d)", ehdr->type, ehdr->type); next_tvb = tvb_new_subset_remaining(tvb, 14); call_dissector(data_handle, next_tvb, pinfo, parent_tree); @@ -393,8 +397,7 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, if(addr_item){ addr_tree = proto_item_add_subtree(addr_item, ett_addr); if (tvb_get_guint8(tvb, 6) & 0x01) { - expert_add_info_format(pinfo, addr_item, PI_PROTOCOL, PI_WARN, - "Source MAC must not be a group address: IEEE 802.3-2002, Section 3.2.3(b)"); + expert_add_info(pinfo, addr_item, &ei_eth_src_not_group); } } proto_tree_add_ether(addr_tree, hf_eth_addr, tvb, 6, 6, src_addr); @@ -634,7 +637,7 @@ add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_bad, tvb, trailer_length, 2, TRUE); PROTO_ITEM_SET_GENERATED(item); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum"); + expert_add_info(pinfo, item, &ei_eth_fcs_bad); col_append_str(pinfo->cinfo, COL_INFO, " [ETHERNET FRAME CHECK SEQUENCE INCORRECT]"); } }else{ @@ -747,11 +750,21 @@ proto_register_eth(void) &ett_addr, &ett_eth_fcs }; + + static ei_register_info ei[] = { + { &ei_eth_invalid_lentype, { "arp.duplicate-address-detected", PI_PROTOCOL, PI_WARN, "Invalid length/type", EXPFILL }}, + { &ei_eth_src_not_group, { "arp.packet-storm-detected", PI_PROTOCOL, PI_WARN, "Source MAC must not be a group address: IEEE 802.3-2002, Section 3.2.3(b)", EXPFILL }}, + { &ei_eth_fcs_bad, { "arp.packet-storm-detected", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + module_t *eth_module; + expert_module_t* expert_eth; proto_eth = proto_register_protocol("Ethernet", "Ethernet", "eth"); proto_register_field_array(proto_eth, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_eth = expert_register_protocol(proto_eth); + expert_register_field_array(expert_eth, ei, array_length(ei)); /* subdissector code */ register_heur_dissector_list("eth", &heur_subdissector_list); diff --git a/epan/dissectors/packet-etherip.c b/epan/dissectors/packet-etherip.c index 379121734e..5eb9dc4941 100644 --- a/epan/dissectors/packet-etherip.c +++ b/epan/dissectors/packet-etherip.c @@ -39,6 +39,9 @@ static int hf_etherip_reserved = -1; static gint ett_etherip = -1; +static expert_field ei_etherip_ver_3 = EI_INIT; +static expert_field ei_etherip_reserved_0 = EI_INIT; + static dissector_handle_t eth_withoutfcs_handle; @@ -77,13 +80,13 @@ dissect_etherip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(etherip_tree, hf_etherip_ver, tvb, 0, 2, ENC_BIG_ENDIAN); if (version != 3) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Version must be 3"); + expert_add_info(pinfo, ti, &ei_etherip_ver_3); } ti = proto_tree_add_item(etherip_tree, hf_etherip_reserved, tvb, 0, 2, ENC_BIG_ENDIAN); if ((field & ETHERIP_RESERVE_MASK) != 0) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Reserved field must be 0"); + expert_add_info(pinfo, ti, &ei_etherip_reserved_0); } } @@ -109,10 +112,19 @@ proto_register_etherip(void) &ett_etherip, }; + static ei_register_info ei[] = { + { &ei_etherip_ver_3, { "etherip.ver.not3", PI_PROTOCOL, PI_WARN, "Version must be 3", EXPFILL }}, + { &ei_etherip_reserved_0, { "etherip.reserved.not0", PI_PROTOCOL, PI_WARN, "Reserved field must be 0", EXPFILL }}, + }; + + expert_module_t* expert_etherip; + proto_etherip = proto_register_protocol("Ethernet over IP", "ETHERIP", "etherip"); proto_register_field_array(proto_etherip, hf_etherip, array_length(hf_etherip)); proto_register_subtree_array(ett, array_length(ett)); + expert_etherip = expert_register_protocol(proto_etherip); + expert_register_field_array(expert_etherip, ei, array_length(ei)); register_dissector("etherip", dissect_etherip, proto_etherip); } diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index df315870e8..d846dea167 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -138,6 +138,8 @@ static gint ett_fctl = -1; static gint ett_fcbls = -1; static gint ett_fc_vft = -1; +static expert_field ei_fccrc = EI_INIT; + static dissector_table_t fcftype_dissector_table; static dissector_handle_t data_handle, fc_handle; @@ -1301,7 +1303,7 @@ dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { "[error: should be %8.8x]", crc, crc_computed); - expert_add_info_format(pinfo, it, PI_CHECKSUM, PI_ERROR, + expert_add_info_format_text(pinfo, it, &ei_fccrc, "Bad FC CRC %8.8x %8.x", crc, crc_computed); } @@ -1501,7 +1503,12 @@ proto_register_fc(void) &ett_fctl }; + static ei_register_info ei[] = { + { &ei_fccrc, { "fc.crc.bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + module_t *fc_module; + expert_module_t* expert_fc; /* FC SOF */ @@ -1532,6 +1539,8 @@ proto_register_fc(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_fc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_fc = expert_register_protocol(proto_fc); + expert_register_field_array(expert_fc, ei, array_length(ei)); /* subdissectors called through this table will find the fchdr structure * through pinfo->private_data diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c index 5df0b1a62a..eba442d25a 100644 --- a/epan/dissectors/packet-fcels.c +++ b/epan/dissectors/packet-fcels.c @@ -219,6 +219,9 @@ static gint ett_fcels_fcpflags = -1; static gint ett_fcels_prliloflags = -1; static gint ett_fcels_speedflags = -1; +static expert_field ei_fcels_src_unknown = EI_INIT; +static expert_field ei_fcels_dst_unknown = EI_INIT; + static const int *hf_fcels_estat_fields[] = { &hf_fcels_estat_resp, &hf_fcels_estat_seq_init, @@ -1972,7 +1975,7 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Check that the source address is, in fact, an FC address */ if (pinfo->src.type != AT_FC) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, ti, &ei_fcels_src_unknown, "Unknown source address type: %u", pinfo->src.type); return; @@ -2036,7 +2039,7 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Check that the source address is, in fact, an FC address */ if (pinfo->dst.type != AT_FC) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, ti, &ei_fcels_dst_unknown, "Unknown destination address type: %u", pinfo->dst.type); return; @@ -2662,10 +2665,20 @@ proto_register_fcels (void) &ett_fcels_speedflags, }; + + static ei_register_info ei[] = { + { &ei_fcels_src_unknown, { "fcels.src.type.unknown", PI_MALFORMED, PI_WARN, "Unknown source address type", EXPFILL }}, + { &ei_fcels_dst_unknown, { "fcels.dst.type.unknown", PI_MALFORMED, PI_WARN, "Unknown destination address type", EXPFILL }}, + }; + + expert_module_t* expert_fcels; + proto_fcels = proto_register_protocol("FC Extended Link Svc", "FC ELS", "fcels"); proto_register_field_array(proto_fcels, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_fcels = expert_register_protocol(proto_fcels); + expert_register_field_array(expert_fcels, ei, array_length(ei)); register_init_routine (&fcels_init_protocol); } diff --git a/epan/dissectors/packet-fcoe.c b/epan/dissectors/packet-fcoe.c index 8accf2eb8e..912a588fed 100644 --- a/epan/dissectors/packet-fcoe.c +++ b/epan/dissectors/packet-fcoe.c @@ -101,6 +101,8 @@ static int hf_fcoe_crc_good = -1; static int ett_fcoe = -1; static int ett_fcoe_crc = -1; +static expert_field ei_fcoe_crc = EI_INIT; + static dissector_handle_t data_handle; static dissector_handle_t fc_handle; @@ -221,7 +223,7 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "CRC: %8.8x " "[error: should be %8.8x]", crc, crc_computed); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, + expert_add_info_format_text(pinfo, item, &ei_fcoe_crc, "Bad FC CRC %8.8x %8.x", crc, crc_computed); } @@ -303,6 +305,12 @@ proto_register_fcoe(void) &ett_fcoe_crc }; + static ei_register_info ei[] = { + { &ei_fcoe_crc, { "fcoe.crc.bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_fcoe; + /* Register the protocol name and description */ proto_fcoe = proto_register_protocol("Fibre Channel over Ethernet", "FCoE", "fcoe"); @@ -311,6 +319,8 @@ proto_register_fcoe(void) * subtrees used */ proto_register_field_array(proto_fcoe, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_fcoe = expert_register_protocol(proto_fcoe); + expert_register_field_array(expert_fcoe, ei, array_length(ei)); fcoe_module = prefs_register_protocol(proto_fcoe, NULL); diff --git a/epan/dissectors/packet-fcoib.c b/epan/dissectors/packet-fcoib.c index 82f06e4b0e..7d5e649430 100644 --- a/epan/dissectors/packet-fcoib.c +++ b/epan/dissectors/packet-fcoib.c @@ -115,6 +115,8 @@ static int hf_fcoib_crc_good = -1; static int ett_fcoib = -1; static int ett_fcoib_crc = -1; +static expert_field ei_fcoib_crc = EI_INIT; + static dissector_handle_t data_handle; static dissector_handle_t fc_handle; @@ -289,7 +291,7 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U "CRC: %8.8x " "[error: should be %8.8x]", crc, crc_computed); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, + expert_add_info_format_text(pinfo, item, &ei_fcoib_crc, "Bad FC CRC %8.8x %8.x", crc, crc_computed); } @@ -372,6 +374,12 @@ proto_register_fcoib(void) &ett_fcoib_crc }; + static ei_register_info ei[] = { + { &ei_fcoib_crc, { "fcoib.crc.bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_fcoib; + /* Register the protocol name and description */ proto_fcoib = proto_register_protocol("Fibre Channel over Infiniband", "FCoIB", "fcoib"); @@ -380,6 +388,8 @@ proto_register_fcoib(void) * subtrees used */ proto_register_field_array(proto_fcoib, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_fcoib = expert_register_protocol(proto_fcoib); + expert_register_field_array(expert_fcoib, ei, array_length(ei)); fcoib_module = prefs_register_protocol(proto_fcoib, proto_reg_handoff_fcoib); diff --git a/epan/dissectors/packet-fix.c b/epan/dissectors/packet-fix.c index 7109dc70fb..b4044c43d0 100644 --- a/epan/dissectors/packet-fix.c +++ b/epan/dissectors/packet-fix.c @@ -63,6 +63,8 @@ static gint ett_unknow = -1; static gint ett_badfield = -1; static gint ett_checksum = -1; +static expert_field ei_fix_checksum_bad = EI_INIT; + static int hf_fix_data = -1; /* continuation data */ static int hf_fix_checksum_good = -1; static int hf_fix_checksum_bad = -1; @@ -362,7 +364,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) item = proto_tree_add_boolean(checksum_tree, hf_fix_checksum_bad, tvb, field_offset, tag->field_len, !sum_ok); PROTO_ITEM_SET_GENERATED(item); if (!sum_ok) - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum"); + expert_add_info(pinfo, item, &ei_fix_checksum_bad); } break; default: @@ -499,7 +501,12 @@ proto_register_fix(void) &ett_checksum, }; + static ei_register_info ei[] = { + { &ei_fix_checksum_bad, { "fix.checksum_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + module_t *fix_module; + expert_module_t* expert_fix; /* register re-init routine */ register_init_routine(&dissect_fix_init); @@ -514,6 +521,8 @@ proto_register_fix(void) proto_register_field_array(proto_fix, hf, array_length(hf)); proto_register_field_array(proto_fix, hf_FIX, array_length(hf_FIX)); proto_register_subtree_array(ett, array_length(ett)); + expert_fix = expert_register_protocol(proto_fix); + expert_register_field_array(expert_fix, ei, array_length(ei)); fix_module = prefs_register_protocol(proto_fix, fix_prefs); prefs_register_bool_preference(fix_module, "desegment", diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 43eb5f482c..e5f47fb420 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -87,6 +87,9 @@ static gint ett_frame = -1; static gint ett_flags = -1; static gint ett_comments = -1; +static expert_field ei_comments_text = EI_INIT; +static expert_field ei_arrive_time_out_of_range = EI_INIT; + static int frame_tap = -1; static dissector_handle_t data_handle; @@ -233,7 +236,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) comment_item = proto_tree_add_string_format(comments_tree, hf_comments_text, tvb, 0, -1, pinfo->fd->opt_comment, "%s", pinfo->fd->opt_comment); - expert_add_info_format(pinfo, comment_item, PI_COMMENTS_GROUP, PI_COMMENT, + expert_add_info_format_text(pinfo, comment_item, &ei_comments_text, "%s", pinfo->fd->opt_comment); @@ -245,8 +248,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) tree=NULL; if(pinfo->fd->flags.has_ts) { if(pinfo->fd->abs_ts.nsecs < 0 || pinfo->fd->abs_ts.nsecs >= 1000000000) - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_WARN, - "Arrival Time: Fractional second out of range (0-1000000000)"); + expert_add_info(pinfo, NULL, &ei_arrive_time_out_of_range); } } else { proto_tree *fh_tree; @@ -321,8 +323,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) " the valid range is 0-1000000000", (long) pinfo->fd->abs_ts.nsecs); PROTO_ITEM_SET_GENERATED(item); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, - "Arrival Time: Fractional second out of range (0-1000000000)"); + expert_add_info(pinfo, item, &ei_arrive_time_out_of_range); } item = proto_tree_add_time(fh_tree, hf_frame_shift_offset, tvb, 0, 0, &(pinfo->fd->shift_offset)); @@ -779,7 +780,13 @@ proto_register_frame(void) &ett_comments }; + static ei_register_info ei[] = { + { &ei_comments_text, { "frame.comment.expert", PI_COMMENTS_GROUP, PI_COMMENT, "Formatted comment", EXPFILL }}, + { &ei_arrive_time_out_of_range, { "frame.time_invalid.expert", PI_SEQUENCE, PI_NOTE, "Arrival Time: Fractional second out of range (0-1000000000)", EXPFILL }}, + }; + module_t *frame_module; + expert_module_t* expert_frame; if (hf_encap.hfinfo.strings == NULL) { int encap_count = wtap_get_num_encap_types(); @@ -804,6 +811,8 @@ proto_register_frame(void) proto_register_field_array(proto_frame, hf, array_length(hf)); proto_register_field_array(proto_frame, &hf_encap, 1); proto_register_subtree_array(ett, array_length(ett)); + expert_frame = expert_register_protocol(proto_frame); + expert_register_field_array(expert_frame, ei, array_length(ei)); register_dissector("frame",dissect_frame,proto_frame); /* You can't disable dissection of "Frame", as that would be diff --git a/epan/dissectors/packet-ftp.c b/epan/dissectors/packet-ftp.c index bf7bc072a4..22f2f4a47c 100644 --- a/epan/dissectors/packet-ftp.c +++ b/epan/dissectors/packet-ftp.c @@ -80,6 +80,9 @@ static int hf_ftp_epsv_port = -1; static gint ett_ftp = -1; static gint ett_ftp_reqresp = -1; +static expert_field ei_ftp_eprt_args_invalid = EI_INIT; +static expert_field ei_ftp_epsv_args_invalid = EI_INIT; + static dissector_handle_t ftpdata_handle; #define TCP_PORT_FTPDATA 20 @@ -826,8 +829,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *item; item = proto_tree_add_text(reqresp_tree, tvb, offset - linelen - 1, linelen, "Invalid EPRT arguments"); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, - "EPRT arguments must have the form: |<family>|<addr>|<port>|"); + expert_add_info(pinfo, item, &ei_ftp_eprt_args_invalid); } } @@ -877,8 +879,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *item; item = proto_tree_add_text(reqresp_tree, tvb, offset - linelen - 1, linelen, "Invalid EPSV arguments"); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, - "EPSV arguments must have the form (|||<port>|)"); + expert_add_info(pinfo, item, &ei_ftp_epsv_args_invalid); } } } @@ -1045,13 +1046,22 @@ proto_register_ftp(void) &ett_ftp_reqresp }; - proto_ftp = proto_register_protocol("File Transfer Protocol (FTP)", "FTP", - "ftp"); + static ei_register_info ei[] = { + { &ei_ftp_eprt_args_invalid, { "ftp.eprt.args_invalid", PI_MALFORMED, PI_WARN, "EPRT arguments must have the form: |<family>|<addr>|<port>|", EXPFILL }}, + { &ei_ftp_epsv_args_invalid, { "ftp.epsv.args_invalid", PI_MALFORMED, PI_WARN, "EPSV arguments must have the form (|||<port>|)", EXPFILL }}, + }; + + expert_module_t* expert_ftp; + + proto_ftp = proto_register_protocol("File Transfer Protocol (FTP)", "FTP", "ftp"); + register_dissector("ftp", dissect_ftp, proto_ftp); proto_ftp_data = proto_register_protocol("FTP Data", "FTP-DATA", "ftp-data"); register_dissector("ftp-data", dissect_ftpdata, proto_ftp_data); proto_register_field_array(proto_ftp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ftp = expert_register_protocol(proto_ftp); + expert_register_field_array(expert_ftp, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-gearman.c b/epan/dissectors/packet-gearman.c index f41b04fa46..8677ec8b14 100644 --- a/epan/dissectors/packet-gearman.c +++ b/epan/dissectors/packet-gearman.c @@ -69,6 +69,8 @@ static gint ett_gearman = -1; static gint ett_gearman_command = -1; static gint ett_gearman_content = -1; +static expert_field ei_gearman_pkt_type_unknown = EI_INIT; + static gboolean gearman_desegment = TRUE; static const int GEARMAN_COMMAND_HEADER_SIZE = 12; @@ -408,7 +410,7 @@ dissect_binary_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: if (size > 0) - expert_add_info_format(pinfo, content_item, PI_PROTOCOL, PI_WARN, "Unknown command"); + expert_add_info(pinfo, content_item, &ei_gearman_pkt_type_unknown); } col_set_fence(pinfo->cinfo, COL_INFO); @@ -518,12 +520,19 @@ proto_register_gearman(void) &ett_gearman_content }; + static ei_register_info ei[] = { + { &ei_gearman_pkt_type_unknown, { "gearman.pkt_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown command", EXPFILL }}, + }; + module_t *gearman_module; + expert_module_t* expert_gearman; proto_gearman = proto_register_protocol("Gearman Protocol", "Gearman", "gearman"); proto_register_field_array(proto_gearman, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_gearman = expert_register_protocol(proto_gearman); + expert_register_field_array(expert_gearman, ei, array_length(ei)); gearman_module = prefs_register_protocol(proto_gearman, NULL); prefs_register_bool_preference(gearman_module, "desegment", diff --git a/epan/dissectors/packet-gmhdr.c b/epan/dissectors/packet-gmhdr.c index c2acb58212..63e1adb68d 100644 --- a/epan/dissectors/packet-gmhdr.c +++ b/epan/dissectors/packet-gmhdr.c @@ -120,7 +120,7 @@ static gint ett_gmhdr = -1; static gint ett_srcport = -1; static gint ett_gmtrailer = -1; - +static expert_field ei_gmhdr_field_length_invalid = EI_INIT; static void dissect_gmtlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gmhdr_tree, guint offset, guint16 length) @@ -141,7 +141,7 @@ dissect_gmtlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gmhdr_tree, gui guint32 tv = tvb_get_ntohl(tvb, offset) >> 8; /* Only 24-bit field */ if (fl != 3) { - expert_add_info_format(pinfo, gmhdr_tree, PI_MALFORMED, PI_ERROR, "Field length %u invalid", fl); + expert_add_info_format_text(pinfo, gmhdr_tree, &ei_gmhdr_field_length_invalid, "Field length %u invalid", fl); break; } ti = proto_tree_add_item(gmhdr_tree, hf_gmhdr_srcport_g, tvb, offset, fl, ENC_BIG_ENDIAN); @@ -159,7 +159,7 @@ dissect_gmtlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gmhdr_tree, gui } case GMHDR_FTYPE_PKTSIZE: if (fl != 2) { - expert_add_info_format(pinfo, gmhdr_tree, PI_MALFORMED, PI_ERROR, "Field length %u invalid", fl); + expert_add_info_format_text(pinfo, gmhdr_tree, &ei_gmhdr_field_length_invalid, "Field length %u invalid", fl); break; } proto_tree_add_item(gmhdr_tree, hf_gmhdr_pktsize, tvb, offset, fl, ENC_BIG_ENDIAN); @@ -169,7 +169,7 @@ dissect_gmtlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gmhdr_tree, gui case GMHDR_FTYPE_TIMESTAMP_GPS: case GMHDR_FTYPE_TIMESTAMP_1588: if (fl != 8) { - expert_add_info_format(pinfo, gmhdr_tree, PI_MALFORMED, PI_ERROR, "Field length %u invalid", fl); + expert_add_info_format_text(pinfo, gmhdr_tree, &ei_gmhdr_field_length_invalid, "Field length %u invalid", fl); break; } ti = proto_tree_add_item(gmhdr_tree, hf_gmhdr_timestamp, tvb, offset, fl, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN); @@ -177,7 +177,7 @@ dissect_gmtlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gmhdr_tree, gui break; case GMHDR_FTYPE_FCS: { if (fl != 4) { - expert_add_info_format(pinfo, gmhdr_tree, PI_MALFORMED, PI_ERROR, "Field length %u invalid", fl); + expert_add_info_format_text(pinfo, gmhdr_tree, &ei_gmhdr_field_length_invalid, "Field length %u invalid", fl); break; } ti = proto_tree_add_item(gmhdr_tree, hf_gmhdr_origcrc, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -186,7 +186,7 @@ dissect_gmtlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gmhdr_tree, gui } case GMHDR_FTYPE_SRCPORT_H: { if (fl != 4) { - expert_add_info_format(pinfo, gmhdr_tree, PI_MALFORMED, PI_ERROR, "Field length %u invalid", fl); + expert_add_info_format_text(pinfo, gmhdr_tree, &ei_gmhdr_field_length_invalid, "Field length %u invalid", fl); break; } ti = proto_tree_add_item(gmhdr_tree, hf_gmhdr_srcport_h, tvb, offset, fl, ENC_BIG_ENDIAN); @@ -459,12 +459,19 @@ proto_register_gmhdr(void) static gint *gmtrailer_ett[] = { &ett_gmtrailer, }; + static ei_register_info ei[] = { + { &ei_gmhdr_field_length_invalid, { "gmhdr.field_length_invalid", PI_MALFORMED, PI_ERROR, "Field length invalid", EXPFILL }}, + }; + module_t *gmhdr_module; module_t *gmtrailer_module; + expert_module_t* expert_gmhdr; proto_gmhdr = proto_register_protocol("Gigamon Header", "GMHDR", "gmhdr"); proto_register_field_array(proto_gmhdr, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_gmhdr = expert_register_protocol(proto_gmhdr); + expert_register_field_array(expert_gmhdr, ei, array_length(ei)); proto_gmtrailer = proto_register_protocol("Gigamon Trailer", "GMTRAILER", "gmtrailer"); proto_register_field_array(proto_gmtrailer, gmtrailer_hf, array_length(gmtrailer_hf)); diff --git a/epan/dissectors/packet-gre.c b/epan/dissectors/packet-gre.c index 636f7dc81c..d96eeeb348 100644 --- a/epan/dissectors/packet-gre.c +++ b/epan/dissectors/packet-gre.c @@ -96,6 +96,8 @@ static gint ett_gre_wccp2_redirect_header = -1; static gint ett_3gpp2_attribs = -1; static gint ett_3gpp2_attr = -1; +static expert_field ei_gre_checksum_incorrect = EI_INIT; + static dissector_table_t gre_dissector_table; static dissector_handle_t data_handle; @@ -418,7 +420,7 @@ dissect_gre(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(it_checksum," [correct]"); } else { proto_item_append_text(it_checksum," [incorrect, should be 0x%04x]",in_cksum_shouldbe(cksum, computed_cksum)); - expert_add_info_format(pinfo, it_checksum, PI_MALFORMED, PI_WARN, "Incorrect GRE Checksum"); + expert_add_info(pinfo, it_checksum, &ei_gre_checksum_incorrect); } } @@ -721,10 +723,19 @@ proto_register_gre(void) &ett_3gpp2_attr, }; + + static ei_register_info ei[] = { + { &ei_gre_checksum_incorrect, { "gre.checksum.incorrect", PI_PROTOCOL, PI_WARN, "Incorrect GRE Checksum", EXPFILL }}, + }; + + expert_module_t* expert_gre; + proto_gre = proto_register_protocol("Generic Routing Encapsulation", "GRE", "gre"); proto_register_field_array(proto_gre, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_gre = expert_register_protocol(proto_gre); + expert_register_field_array(expert_gre, ei, array_length(ei)); /* subdissector code */ gre_dissector_table = register_dissector_table("gre.proto", diff --git a/epan/dissectors/packet-hartip.c b/epan/dissectors/packet-hartip.c index e344858b94..c5a8d05f67 100644 --- a/epan/dissectors/packet-hartip.c +++ b/epan/dissectors/packet-hartip.c @@ -68,6 +68,9 @@ static gint ett_hartip = -1; static gint ett_hartip_hdr = -1; static gint ett_hartip_body = -1; +static expert_field ei_hartip_data_none = EI_INIT; +static expert_field ei_hartip_data_unexpected = EI_INIT; + /* Command 0 response */ static int hf_hartip_pt_rsp_expansion_code = -1; static int hf_hartip_pt_rsp_expanded_device_type = -1; @@ -308,9 +311,9 @@ dissect_empty_body(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, ti = proto_tree_add_item(tree, hf_hartip_data, tvb, offset, bodylen, ENC_NA); if (bodylen == 0) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_NOTE, "No data"); + expert_add_info(pinfo, ti, &ei_hartip_data_none); } else { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Unexpected message body"); + expert_add_info(pinfo, ti, &ei_hartip_data_unexpected); } return bodylen; } @@ -1516,11 +1519,19 @@ proto_register_hartip(void) &ett_hartip_body }; + static ei_register_info ei[] = { + { &ei_hartip_data_none, { "hart_ip.data.none", PI_PROTOCOL, PI_NOTE, "No data", EXPFILL }}, + { &ei_hartip_data_unexpected, { "hart_ip.data.unexpected", PI_PROTOCOL, PI_WARN, "Unexpected message body", EXPFILL }}, + }; + module_t *hartip_module; + expert_module_t* expert_hartip; proto_hartip = proto_register_protocol("HART_IP Protocol", "HART_IP", "hart_ip"); proto_register_field_array(proto_hartip, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_hartip = expert_register_protocol(proto_hartip); + expert_register_field_array(expert_hartip, ei, array_length(ei)); hartip_module = prefs_register_protocol(proto_hartip, NULL); prefs_register_bool_preference(hartip_module, "desegment", diff --git a/epan/dissectors/packet-hdcp2.c b/epan/dissectors/packet-hdcp2.c index 11960cf9bb..54dc7b17dd 100644 --- a/epan/dissectors/packet-hdcp2.c +++ b/epan/dissectors/packet-hdcp2.c @@ -66,6 +66,9 @@ static int hf_hdcp2_l_prime = -1; static int hf_hdcp2_e_dkey_ks = -1; static int hf_hdcp2_r_iv = -1; +static expert_field ei_hdcp2_reserved_0 = EI_INIT; + + #define ID_AKE_INIT 2 #define ID_AKE_SEND_CERT 3 #define ID_AKE_NO_STORED_KM 4 @@ -174,13 +177,10 @@ dissect_hdcp2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U ptvcursor_add(cursor, hf_hdcp2_cert_n, N_LEN, ENC_NA); ptvcursor_add(cursor, hf_hdcp2_cert_e, E_LEN, ENC_BIG_ENDIAN); reserved = tvb_get_ntohs(tvb, ptvcursor_current_offset(cursor)); - proto_tree_add_text(cert_tree, tvb, + pi = proto_tree_add_text(cert_tree, tvb, ptvcursor_current_offset(cursor), 2, "reserved bytes"); if (reserved != 0) { - pi = proto_tree_add_text(cert_tree, tvb, - ptvcursor_current_offset(cursor), 2, "invalid value"); - expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_WARN, - "reserved bytes must be set to 0x0"); + expert_add_info(pinfo, pi, &ei_hdcp2_reserved_0); } ptvcursor_advance(cursor, 2); ptvcursor_add(cursor, hf_hdcp2_cert_rcv_sig, RCV_SIG_LEN, ENC_NA); @@ -284,7 +284,12 @@ proto_register_hdcp2(void) &ett_hdcp2_cert }; + static ei_register_info ei[] = { + { &ei_hdcp2_reserved_0, { "hdcp2.reserved.not0", PI_PROTOCOL, PI_WARN, "reserved bytes must be set to 0x0", EXPFILL }}, + }; + module_t *hdcp2_module; + expert_module_t* expert_hdcp2; msg_table = g_hash_table_new(g_direct_hash, g_direct_equal); for(i=0; i<array_length(msg_info); i++) { @@ -304,6 +309,8 @@ proto_register_hdcp2(void) proto_register_field_array(proto_hdcp2, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_hdcp2 = expert_register_protocol(proto_hdcp2); + expert_register_field_array(expert_hdcp2, ei, array_length(ei)); new_register_dissector("hdcp2", dissect_hdcp2, proto_hdcp2); } diff --git a/epan/dissectors/packet-hpfeeds.c b/epan/dissectors/packet-hpfeeds.c index 5c1727a08f..452f4fdcd8 100644 --- a/epan/dissectors/packet-hpfeeds.c +++ b/epan/dissectors/packet-hpfeeds.c @@ -58,6 +58,8 @@ static int hf_hpfeeds_errmsg = -1; static gint ett_hpfeeds = -1; +static expert_field ei_hpfeeds_opcode_unknown = EI_INIT; + static dissector_handle_t json_hdl; /* OPCODE */ @@ -271,7 +273,7 @@ dissect_hpfeeds_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; if (opcode >= array_length(opcode_vals) - 1) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, + expert_add_info_format_text(pinfo, ti, &ei_hpfeeds_opcode_unknown, "Unknown value %02x for opcode field", opcode); } @@ -414,7 +416,12 @@ proto_register_hpfeeds(void) &ett_hpfeeds }; + static ei_register_info ei[] = { + { &ei_hpfeeds_opcode_unknown, { "hpfeeds.opcode.unknown", PI_PROTOCOL, PI_WARN, "Unknown value for opcode field", EXPFILL }}, + }; + module_t *hpfeeds_module; + expert_module_t* expert_hpfeeds; proto_hpfeeds = proto_register_protocol ( "HPFEEDS HoneyPot Feeds Protocol", /* name */ @@ -424,6 +431,8 @@ proto_register_hpfeeds(void) proto_register_field_array(proto_hpfeeds, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_hpfeeds = expert_register_protocol(proto_hpfeeds); + expert_register_field_array(expert_hpfeeds, ei, array_length(ei)); hpfeeds_module = prefs_register_protocol(proto_hpfeeds, proto_reg_handoff_hpfeeds); prefs_register_bool_preference(hpfeeds_module, "desegment_hpfeeds_messages", diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 430ab5e3b5..c2ecb6cb7d 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -127,6 +127,9 @@ static gint ett_http_chunk_data = -1; static gint ett_http_encoded_entity = -1; static gint ett_http_header_item = -1; +static expert_field ei_http_chat = EI_INIT; +static expert_field ei_http_subdissector_failed = EI_INIT; + static dissector_handle_t data_handle; static dissector_handle_t media_handle; static dissector_handle_t websocket_handle; @@ -975,7 +978,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo, hdr_item = proto_tree_add_text(http_tree, tvb, offset, next_offset - offset, "%s", text); } - expert_add_info_format(pinfo, hdr_item, PI_SEQUENCE, PI_CHAT, "%s", text); + expert_add_info_format_text(pinfo, hdr_item, &ei_http_chat, "%s", text); if (reqresp_dissector) { if (tree) req_tree = proto_item_add_subtree(hdr_item, ett_http_request); else req_tree = NULL; @@ -1412,8 +1415,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo, */ dissected = call_dissector_only(handle, next_tvb, pinfo, tree, NULL); if (!dissected) - expert_add_info_format(pinfo, http_tree, PI_MALFORMED, PI_NOTE, - "HTTP body subdissector failed, trying heuristic subdissector"); + expert_add_info(pinfo, http_tree, &ei_http_subdissector_failed); } if (!dissected) { @@ -2920,6 +2922,12 @@ proto_register_http(void) &ett_http_encoded_entity, &ett_http_header_item }; + + static ei_register_info ei[] = { + { &ei_http_chat, { "http.chat", PI_SEQUENCE, PI_CHAT, "Formatted text", EXPFILL }}, + { &ei_http_subdissector_failed, { "http.subdissector_failed", PI_MALFORMED, PI_NOTE, "HTTP body subdissector failed, trying heuristic subdissector", EXPFILL }}, + }; + /* UAT for header fields */ static uat_field_t custom_header_uat_fields[] = { UAT_FLD_CSTRING(header_fields, header_name, "Header name", "HTTP header name"), @@ -2928,12 +2936,15 @@ proto_register_http(void) }; module_t *http_module; + expert_module_t* expert_http; uat_t* headers_uat; proto_http = proto_register_protocol("Hypertext Transfer Protocol", "HTTP", "http"); proto_register_field_array(proto_http, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_http = expert_register_protocol(proto_http); + expert_register_field_array(expert_http, ei, array_length(ei)); register_dissector("http", dissect_http, proto_http); http_module = prefs_register_protocol(proto_http, reinit_http); prefs_register_bool_preference(http_module, "desegment_headers", diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c index 2c6c4dbfb2..7fb678c41a 100644 --- a/epan/dissectors/packet-iec104.c +++ b/epan/dissectors/packet-iec104.c @@ -496,6 +496,9 @@ static gint ett_sco = -1; static gint ett_dco = -1; static gint ett_rco = -1; +static expert_field ei_iec104_short_asdu = EI_INIT; +static expert_field ei_iec104_apdu_min_len = EI_INIT; + /* Misc. functions for dissection of signal values */ /* ==================================================================== @@ -955,7 +958,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr ioa_item = proto_tree_add_uint(trSignal, hf_ioa, tvb, offset_start_ioa, 3, asdu_info_obj_addr); /* check length */ if( Len < (guint)(offset+3) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } offset += 3; /* step over IOA bytes */ @@ -969,7 +972,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* -------- Information object address */ /* check length */ if( Len < (guint)(offset+3) ) { - expert_add_info_format(pinfo, itSignal, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, itSignal, &ei_iec104_short_asdu); return; } ioa_item = get_InfoObjectAddress( &asdu_info_obj_addr, tvb, &offset, trSignal); @@ -981,7 +984,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_SP_NA_1: /* 1 Single-point information */ /* check length */ if( Len < (guint)(offset+1) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_SIQ( tvb, &offset, trSignal ); @@ -989,7 +992,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_DP_NA_1: /* 3 Double-point information */ /* check length */ if( Len < (guint)(offset+1) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_DIQ( tvb, &offset, trSignal ); @@ -997,7 +1000,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ST_NA_1: /* 5 Step position information */ /* check length */ if( Len < (guint)(offset+2) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_VTI( tvb, &offset, trSignal ); @@ -1006,7 +1009,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_BO_NA_1: /* 7 Bitstring of 32 bits */ /* check length */ if( Len < (guint)(offset+5) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_BSI( tvb, &offset, trSignal ); @@ -1015,7 +1018,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ME_NA_1: /* 9 Measured value, normalized value */ /* check length */ if( Len < (guint)(offset+3) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_NVA( tvb, &offset, trSignal ); @@ -1024,7 +1027,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ME_NB_1: /* 11 Measured value, scaled value */ /* check length */ if( Len < (guint)(offset+3) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_SVA( tvb, &offset, trSignal ); @@ -1033,7 +1036,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ME_NC_1: /* 13 Measured value, short floating point value */ /* check length */ if( Len < (guint)(offset+5) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_FLT( tvb, &offset, trSignal ); @@ -1042,7 +1045,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ME_ND_1: /* 21 Measured value, normalized value without quality descriptor */ /* check length */ if( Len < (guint)(offset+2) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_NVA( tvb, &offset, trSignal ); @@ -1050,7 +1053,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_SP_TB_1: /* 30 Single-point information with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+8) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_SIQ( tvb, &offset, trSignal ); @@ -1059,7 +1062,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_DP_TB_1: /* 31 Double-point information with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+8) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_DIQ( tvb, &offset, trSignal ); @@ -1068,7 +1071,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ST_TB_1: /* 32 Step position information with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+9) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_VTI( tvb, &offset, trSignal ); @@ -1078,7 +1081,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_BO_TB_1: /* 33 bitstring of 32 bit with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+12) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_BSI( tvb, &offset, trSignal ); @@ -1088,7 +1091,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ME_TD_1: /* 34 Measured value, normalized value with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+10) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_NVA( tvb, &offset, trSignal ); @@ -1098,7 +1101,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ME_TE_1: /* 35 Measured value, scaled value with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+10) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_SVA( tvb, &offset, trSignal ); @@ -1108,7 +1111,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case M_ME_TF_1: /* 36 Measured value, short floating point value with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+12) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_FLT( tvb, &offset, trSignal ); @@ -1118,7 +1121,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_SC_NA_1: /* 45 Single command */ /* check length */ if( Len < (guint)(offset+1) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_SCO( tvb, &offset, trSignal ); @@ -1126,7 +1129,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_DC_NA_1: /* 46 Double command */ /* check length */ if( Len < (guint)(offset+1) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_DCO( tvb, &offset, trSignal ); @@ -1134,7 +1137,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_RC_NA_1: /* 47 Regulating step command */ /* check length */ if( Len < (guint)(offset+1) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_RCO( tvb, &offset, trSignal ); @@ -1142,7 +1145,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_SE_NA_1: /* 48 Set point command, normalized value */ /* check length */ if( Len < (guint)(offset+3) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_NVAspt( tvb, &offset, trSignal ); @@ -1151,7 +1154,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_SE_NB_1: /* 49 Set point command, scaled value */ /* check length */ if( Len < (guint)(offset+3) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_SVAspt( tvb, &offset, trSignal ); @@ -1160,7 +1163,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_SE_NC_1: /* 50 Set point command, short floating point value */ /* check length */ if( Len < (guint)(offset+5) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_FLTspt( tvb, &offset, trSignal ); @@ -1169,7 +1172,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_BO_NA_1: /* 51 Bitstring of 32 bits */ /* check length */ if( Len < (guint)(offset+4) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_BSIspt( tvb, &offset, trSignal ); @@ -1177,7 +1180,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_SC_TA_1: /* 58 Single command with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+8) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_SCO( tvb, &offset, trSignal ); @@ -1186,7 +1189,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_DC_TA_1: /* 59 Double command with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+8) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_DCO( tvb, &offset, trSignal ); @@ -1195,7 +1198,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_RC_TA_1: /* 60 Regulating step command with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+8) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_RCO( tvb, &offset, trSignal ); @@ -1204,7 +1207,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_SE_TA_1: /* 61 Set point command, normalized value with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+10) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_NVAspt( tvb, &offset, trSignal ); @@ -1214,7 +1217,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_SE_TB_1: /* 62 Set point command, scaled value with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+10) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_SVAspt( tvb, &offset, trSignal ); @@ -1224,7 +1227,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_SE_TC_1: /* 63 Set point command, short floating point value with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+12) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_FLTspt( tvb, &offset, trSignal ); @@ -1234,7 +1237,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_BO_TA_1: /* 64 Bitstring of 32 bits with time tag CP56Time2a */ /* check length */ if( Len < (guint)(offset+11) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_BSIspt( tvb, &offset, trSignal ); @@ -1243,7 +1246,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr case C_CS_NA_1: /* 103 clock synchronization command */ /* check length */ if( Len < (guint)(offset+7) ) { - expert_add_info_format(pinfo, ioa_item, PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>"); + expert_add_info(pinfo, ioa_item, &ei_iec104_short_asdu); return; } get_CP56Time( tvb, &offset, trSignal ); @@ -1295,7 +1298,7 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr len = tvb_get_guint8(tvb, Off+ 1); if (len < APDU_MIN_LEN) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "APDU less than %d bytes", APDU_MIN_LEN); + expert_add_info_format_text(pinfo, ti, &ei_iec104_apdu_min_len, "APDU less than %d bytes", APDU_MIN_LEN); col_append_fstr( pinfo->cinfo, COL_INFO, "<ERR ApduLen=%u bytes> ", len); return; } @@ -1615,6 +1618,13 @@ proto_register_iec104asdu(void) &ett_rco }; + static ei_register_info ei[] = { + { &ei_iec104_short_asdu, { "iec104.short_asdu", PI_MALFORMED, PI_ERROR, "<ERR Short Asdu>", EXPFILL }}, + { &ei_iec104_apdu_min_len, { "iec104.apdu_min_len", PI_MALFORMED, PI_ERROR, "APDU less than bytes", EXPFILL }}, + }; + + expert_module_t* expert_iec104; + proto_iec104asdu = proto_register_protocol( "IEC 60870-5-104-Asdu", "104asdu", @@ -1622,6 +1632,8 @@ proto_register_iec104asdu(void) ); proto_register_field_array(proto_iec104asdu, hf_as, array_length(hf_as)); proto_register_subtree_array(ett_as, array_length(ett_as)); + expert_iec104 = expert_register_protocol(proto_iec104asdu); + expert_register_field_array(expert_iec104, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index 5ec1187f20..b219da2fbf 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -150,6 +150,8 @@ static int ett_imf_siolabel = -1; static int ett_imf_extension = -1; static int ett_imf_message_text = -1; +static expert_field ei_imf_unknown_param = EI_INIT; + struct imf_field { const char *name; /* field name - in lower case for matching purposes */ int *hf_id; /* wireshark field */ @@ -563,7 +565,7 @@ dissect_imf_siolabel(tvbuff_t *tvb, int offset, int length, proto_item *item, pa } else { sub_item = proto_tree_add_item(tree, hf_imf_siolabel_unknown, tvb, item_offset, item_length, ENC_ASCII|ENC_NA); - expert_add_info_format(pinfo, sub_item, PI_PROTOCOL, PI_WARN, "Unknown parameter"); + expert_add_info(pinfo, sub_item, &ei_imf_unknown_param); } if (end_offset != -1) { @@ -1202,6 +1204,10 @@ proto_register_imf(void) &ett_imf_message_text, }; + static ei_register_info ei[] = { + { &ei_imf_unknown_param, { "imf.unknown_param", PI_PROTOCOL, PI_WARN, "Unknown parameter", EXPFILL }}, + }; + static uat_field_t attributes_flds[] = { UAT_FLD_CSTRING(header_fields, header_name, "Header name", "IMF header name"), UAT_FLD_CSTRING(header_fields, description, "Description", "Description of the value contained in the header"), @@ -1227,12 +1233,15 @@ proto_register_imf(void) attributes_flds); module_t *imf_module; + expert_module_t* expert_imf; struct imf_field *f; proto_imf = proto_register_protocol(PNAME, PSNAME, PFNAME); proto_register_field_array(proto_imf, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_imf = expert_register_protocol(proto_imf); + expert_register_field_array(expert_imf, ei, array_length(ei)); /* Allow dissector to find be found by name. */ register_dissector(PFNAME, dissect_imf, proto_imf); diff --git a/epan/dissectors/packet-isis-lsp.c b/epan/dissectors/packet-isis-lsp.c index 8b579e58f5..100b13762b 100644 --- a/epan/dissectors/packet-isis-lsp.c +++ b/epan/dissectors/packet-isis-lsp.c @@ -124,6 +124,8 @@ static gint ett_isis_lsp_clv_rt_capable_IPv4_prefx = -1; /* CLV 242 */ static gint ett_isis_lsp_clv_grp_address_IPv4_prefx = -1; /* CLV 142 */ static gint ett_isis_lsp_clv_mt_cap_spbv_mac_address = -1; +static expert_field ie_isis_lsp_checksum_bad = EI_INIT; + static const value_string isis_lsp_istype_vals[] = { { ISIS_LSP_TYPE_UNUSED0, "Unused 0x0 (invalid)"}, { ISIS_LSP_TYPE_LEVEL_1, "Level 1"}, @@ -2642,7 +2644,7 @@ static void isis_lsp_checkum_additional_info(tvbuff_t * tvb, packet_info * pinfo offset, 2, !is_cksum_correct); PROTO_ITEM_SET_GENERATED(item); if (!is_cksum_correct) { - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum"); + expert_add_info(pinfo, item, &ie_isis_lsp_checksum_bad); col_append_str(pinfo->cinfo, COL_INFO, " [ISIS CHECKSUM INCORRECT]"); } } @@ -2955,6 +2957,14 @@ isis_register_lsp(int proto_isis) { &ett_isis_lsp_clv_mt_cap_spbv_mac_address }; + static ei_register_info ei[] = { + { &ie_isis_lsp_checksum_bad, { "isis.lsp.checksum_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_isis; + proto_register_field_array(proto_isis, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_isis = expert_register_protocol(proto_isis); + expert_register_field_array(expert_isis, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-iso7816.c b/epan/dissectors/packet-iso7816.c index c707f01878..354b98b18a 100644 --- a/epan/dissectors/packet-iso7816.c +++ b/epan/dissectors/packet-iso7816.c @@ -86,6 +86,8 @@ static int hf_iso7816_sel_file_ctrl = -1; static int hf_iso7816_sel_file_fci_req = -1; static int hf_iso7816_sel_file_occ = -1; +static expert_field ie_iso7816_atr_tck_not1 = EI_INIT; + #define ADDR_INTF "Interface" #define ADDR_CARD "Card" @@ -326,8 +328,7 @@ dissect_iso7816_atr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d else if (tck_len>1) { err_it = proto_tree_add_text(proto_tr, tvb, offset, tck_len, "Invalid TCK byte"); - expert_add_info_format(pinfo, err_it, PI_PROTOCOL, PI_WARN, - "TCK byte must either be absent or exactly one byte"); + expert_add_info(pinfo, err_it, &ie_iso7816_atr_tck_not1); } proto_item_set_len(proto_it, offset); @@ -830,10 +831,18 @@ proto_register_iso7816(void) &ett_iso7816_atr_td }; + static ei_register_info ei[] = { + { &ie_iso7816_atr_tck_not1, { "iso7816.atr_tck.not1", PI_PROTOCOL, PI_WARN, "TCK byte must either be absent or exactly one byte", EXPFILL }}, + }; + + expert_module_t* expert_arp; + proto_iso7816 = proto_register_protocol( "ISO/IEC 7816", "ISO 7816", "iso7816"); proto_register_field_array(proto_iso7816, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_arp = expert_register_protocol(proto_iso7816); + expert_register_field_array(expert_arp, ei, array_length(ei)); new_register_dissector("iso7816", dissect_iso7816, proto_iso7816); register_init_routine(iso7816_init); diff --git a/epan/dissectors/packet-iuup.c b/epan/dissectors/packet-iuup.c index 6bd4242580..88081ea25f 100644 --- a/epan/dissectors/packet-iuup.c +++ b/epan/dissectors/packet-iuup.c @@ -147,6 +147,9 @@ static gint ett_rfciinds = -1; static gint ett_payload = -1; static gint ett_payload_subflows = -1; +static expert_field ei_iuup_hdr_crc_bad = EI_INIT; +static expert_field ei_iuup_payload_crc_bad = EI_INIT; + static GHashTable* circuits = NULL; static dissector_handle_t data_handle = NULL; @@ -563,7 +566,7 @@ static void add_hdr_crc(tvbuff_t* tvb, packet_info* pinfo, proto_item* iuup_tree crc_item = proto_tree_add_item(iuup_tree,hf_iuup_hdr_crc,tvb,2,1,ENC_BIG_ENDIAN); if (crccheck) { proto_item_append_text(crc_item, "%s", " [incorrect]"); - expert_add_info_format(pinfo, crc_item, PI_CHECKSUM, PI_ERROR, "Bad checksum"); + expert_add_info(pinfo, crc_item, &ei_iuup_hdr_crc_bad); } } @@ -577,7 +580,7 @@ static void add_payload_crc(tvbuff_t* tvb, packet_info* pinfo, proto_item* iuup_ crc_item = proto_tree_add_item(iuup_tree,hf_iuup_payload_crc,tvb,2,2,ENC_BIG_ENDIAN); if (crccheck) { proto_item_append_text(crc_item, "%s", " [incorrect]"); - expert_add_info_format(pinfo, crc_item, PI_CHECKSUM, PI_ERROR, "Bad checksum"); + expert_add_info(pinfo, crc_item, &ei_iuup_payload_crc_bad); } } @@ -970,12 +973,19 @@ void proto_register_iuup(void) { &ett_payload_subflows }; - module_t* iuup_module; + static ei_register_info ei[] = { + { &ei_iuup_hdr_crc_bad, { "iuup.hdr.crc.bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + { &ei_iuup_payload_crc_bad, { "iuup.payload.crc.bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + module_t *iuup_module; + expert_module_t* expert_iuup; proto_iuup = proto_register_protocol("IuUP", "IuUP", "iuup"); proto_register_field_array(proto_iuup, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_iuup = expert_register_protocol(proto_iuup); + expert_register_field_array(expert_iuup, ei, array_length(ei)); register_dissector("iuup", dissect_iuup, proto_iuup); register_dissector("find_iuup", find_iuup, proto_iuup); diff --git a/epan/dissectors/packet-ixiatrailer.c b/epan/dissectors/packet-ixiatrailer.c index d5be265a7e..9a904475d1 100644 --- a/epan/dissectors/packet-ixiatrailer.c +++ b/epan/dissectors/packet-ixiatrailer.c @@ -60,6 +60,7 @@ static gint ett_ixiatrailer = -1; static int hf_ixiatrailer_timestamp = -1; static int hf_ixiatrailer_generic = -1; +static expert_field ei_ixiatrailer_field_length_invalid = EI_INIT; /* Format is as follows: - Time Sync source (1 byte) @@ -137,7 +138,7 @@ dissect_ixiatrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, voi case IXIATRAILER_FTYPE_TIMESTAMP_1588: case IXIATRAILER_FTYPE_TIMESTAMP_HOLDOVER: if (time_length != 8) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Field length %u invalid", time_length); + expert_add_info_format_text(pinfo, ti, &ei_ixiatrailer_field_length_invalid, "Field length %u invalid", time_length); break; } /* Timestamp */ @@ -173,11 +174,18 @@ proto_register_ixiatrailer(void) &ett_ixiatrailer }; + static ei_register_info ei[] = { + { &ei_ixiatrailer_field_length_invalid, { "ixiatrailer.field_length_invalid", PI_MALFORMED, PI_ERROR, "Field length invalid", EXPFILL }}, + }; + module_t *ixiatrailer_module; + expert_module_t* expert_ixiatrailer; proto_ixiatrailer = proto_register_protocol("Ixia Trailer", "IXIATRAILER", "ixiatrailer"); proto_register_field_array(proto_ixiatrailer, hf, array_length(hf)); proto_register_subtree_array(ixiatrailer_ett, array_length(ixiatrailer_ett)); + expert_ixiatrailer = expert_register_protocol(proto_ixiatrailer); + expert_register_field_array(expert_ixiatrailer, ei, array_length(ei)); ixiatrailer_module = prefs_register_protocol(proto_ixiatrailer, NULL); prefs_register_bool_preference(ixiatrailer_module, "summary_in_tree", diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 752135399a..5948e5fcd4 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -62,6 +62,8 @@ static gint ett_k12 = -1; static gint ett_port = -1; static gint ett_stack_item = -1; +static expert_field ei_k12_unmatched_stk_file = EI_INIT; + static dissector_handle_t k12_handle; static dissector_handle_t data_handle; static dissector_handle_t sscop_handle; @@ -262,7 +264,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) item = proto_tree_add_text(stack_tree,tvb,0,0, "Warning: stk file not matched in the 'K12 Protocols' table"); PROTO_ITEM_SET_GENERATED(item); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "unmatched stk file"); + expert_add_info(pinfo, item, &ei_k12_unmatched_stk_file); item = proto_tree_add_text(stack_tree,tvb,0,0, "Info: You can edit the 'K12 Protocols' table from Preferences->Protocols->k12xx"); @@ -432,6 +434,10 @@ proto_register_k12(void) &ett_stack_item }; + static ei_register_info ei[] = { + { &ei_k12_unmatched_stk_file, { "k12.unmatched_stk_file", PI_UNDECODED, PI_WARN, "unmatched stk file", EXPFILL }}, + }; + static uat_field_t uat_k12_flds[] = { UAT_FLD_CSTRING_ISPRINT(k12,match,"Match string", "A string that will be matched (a=A) against an .stk filename or the name of a port.\n" @@ -443,10 +449,13 @@ proto_register_k12(void) }; module_t *k12_module; + expert_module_t* expert_k12; proto_k12 = proto_register_protocol("K12xx", "K12xx", "k12"); proto_register_field_array(proto_k12, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_k12 = expert_register_protocol(proto_k12); + expert_register_field_array(expert_k12, ei, array_length(ei)); register_dissector("k12", dissect_k12, proto_k12); k12_uat = uat_new("K12 Protocols", diff --git a/epan/dissectors/packet-kink.c b/epan/dissectors/packet-kink.c index 3f6f9d2af8..110e0b3e19 100644 --- a/epan/dissectors/packet-kink.c +++ b/epan/dissectors/packet-kink.c @@ -78,6 +78,10 @@ static gint ett_payload_kink_error = -1; static gint ett_payload_not_defined = -1; static gint ett_decrypt_kink_encrypt = -1; +static expert_field ei_kink_payload_length_small = EI_INIT; +static expert_field ei_kink_payload_length_mismatch = EI_INIT; + + /* Define the kink type value */ #define KINK_TYPE_RESERVED 0 #define KINK_TYPE_CREATE 1 @@ -350,7 +354,7 @@ dissect_payload_kink_ap_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto ti = proto_tree_add_uint(payload_kink_ap_req_tree, hf_kink_payload_length, tvb, offset, 2, payload_length); if(payload_length <= PAYLOAD_HEADER){ - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "This Payload Length is too small"); + expert_add_info(pinfo, ti, &ei_kink_payload_length_small); } offset += 2; @@ -405,7 +409,7 @@ dissect_payload_kink_ap_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto ti = proto_tree_add_uint(payload_kink_ap_rep_tree, hf_kink_payload_length, tvb, offset, 2, payload_length); if(payload_length <= PAYLOAD_HEADER){ - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "This Payload Length is too small"); + expert_add_info(pinfo, ti, &ei_kink_payload_length_small); } offset += 2; @@ -460,7 +464,7 @@ dissect_payload_kink_krb_error(packet_info *pinfo, tvbuff_t *tvb, int offset, pr ti = proto_tree_add_uint(payload_kink_krb_error_tree, hf_kink_payload_length, tvb, offset, 2, payload_length); if(payload_length <= KINK_KRB_ERROR_HEADER){ - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "This Payload Length is too small"); + expert_add_info(pinfo, ti, &ei_kink_payload_length_small); } else { offset += 2; @@ -617,7 +621,7 @@ dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto ti = proto_tree_add_uint(payload_kink_isakmp_tree, hf_kink_payload_length, tvb, offset, 2, payload_length); if(payload_length <= PAYLOAD_HEADER){ - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "This Payload Length is too small"); + expert_add_info(pinfo, ti, &ei_kink_payload_length_small); } offset += 2; @@ -695,7 +699,7 @@ dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, prot ti = proto_tree_add_uint(payload_kink_encrypt_tree, hf_kink_payload_length, tvb, offset, 2, payload_length); if(payload_length <= PAYLOAD_HEADER){ - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "This Payload Length is too small"); + expert_add_info(pinfo, ti, &ei_kink_payload_length_small); } offset += 2; @@ -799,7 +803,7 @@ dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_ ti = proto_tree_add_uint(payload_kink_error_tree, hf_kink_payload_length, tvb, offset, 2, payload_length); if(payload_length != KINK_ERROR_LENGTH){ - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "This Payload Length is mismatch"); + expert_add_info(pinfo, ti, &ei_kink_payload_length_mismatch); } offset += 2; @@ -976,9 +980,18 @@ proto_register_kink(void) { }; + static ei_register_info ei[] = { + { &ei_kink_payload_length_small, { "kink.payload_length_small", PI_PROTOCOL, PI_WARN, "This Payload Length is too small", EXPFILL }}, + { &ei_kink_payload_length_mismatch, { "kink.payload_length_mismatch", PI_PROTOCOL, PI_WARN, "This Payload Length is mismatch", EXPFILL }}, + }; + + expert_module_t* expert_kink; + proto_kink = proto_register_protocol("Kerberized Internet Negotiation of Key", "KINK", "kink"); proto_register_field_array(proto_kink, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_kink = expert_register_protocol(proto_kink); + expert_register_field_array(expert_kink, ei, array_length(ei)); } |