diff options
author | Martin Mathieson <martin.mathieson@keysight.com> | 2021-03-06 13:07:51 +0000 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-03-09 19:14:29 +0000 |
commit | 2753c4c27e862d4d1eebd377232dd49662cf8667 (patch) | |
tree | 36c254b408629e52aa19067cff1a9034449622dc /epan | |
parent | ce786ed26528f8f39f28608afffab132909da6eb (diff) |
Expert info: check group and severity
Add a check for valid group and severity values, and fix violations foud.
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/file-btsnoop.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-bgp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-dof.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_gsup.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_r_uus1.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-lnet.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-lustre.c | 8 | ||||
-rwxr-xr-x | epan/dissectors/packet-oran.c | 2 | ||||
-rw-r--r-- | epan/expert.c | 31 |
9 files changed, 44 insertions, 13 deletions
diff --git a/epan/dissectors/file-btsnoop.c b/epan/dissectors/file-btsnoop.c index 55d9c36273..d584b40f29 100644 --- a/epan/dissectors/file-btsnoop.c +++ b/epan/dissectors/file-btsnoop.c @@ -341,7 +341,7 @@ proto_register_btsnoop(void) static ei_register_info ei[] = { { &ei_malformed_frame, { "btsnoop.malformed_frame", PI_PROTOCOL, PI_WARN, "Malformed Frame", EXPFILL }}, - { &ei_not_implemented_yet, { "btsnoop.not_implemented_yet", PI_PROTOCOL, PI_UNDECODED, "Not implemented yet", EXPFILL }}, + { &ei_not_implemented_yet, { "btsnoop.not_implemented_yet", PI_PROTOCOL, PI_WARN, "Not implemented yet", EXPFILL }}, { &ei_unknown_data, { "btsnoop.unknown_data", PI_PROTOCOL, PI_WARN, "Unknown data", EXPFILL }}, }; diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index a29b4e6c58..0b7a084815 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -12119,7 +12119,7 @@ proto_register_bgp(void) { &ei_bgp_cap_len_bad, { "bgp.cap.length.bad", PI_MALFORMED, PI_ERROR, "Capability length is wrong", EXPFILL }}, { &ei_bgp_cap_gr_helper_mode_only, { "bgp.cap.gr.helper_mode_only", PI_REQUEST_CODE, PI_CHAT, "Graceful Restart Capability supported in Helper mode only", EXPFILL }}, { &ei_bgp_notify_minor_unknown, { "bgp.notify.minor_error.unknown", PI_UNDECODED, PI_NOTE, "Unknown notification error", EXPFILL }}, - { &ei_bgp_route_refresh_orf_type_unknown, { "bgp.route_refresh.orf.type.unknown", PI_CHAT, PI_ERROR, "ORFEntry-Unknown", EXPFILL }}, + { &ei_bgp_route_refresh_orf_type_unknown, { "bgp.route_refresh.orf.type.unknown", PI_MALFORMED, PI_ERROR, "ORFEntry-Unknown", EXPFILL }}, { &ei_bgp_length_invalid, { "bgp.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }}, { &ei_bgp_prefix_length_invalid, { "bgp.prefix_length.invalid", PI_MALFORMED, PI_ERROR, "Prefix length is invalid", EXPFILL }}, { &ei_bgp_afi_type_not_supported, { "bgp.afi_type_not_supported", PI_PROTOCOL, PI_ERROR, "AFI Type not supported", EXPFILL }}, diff --git a/epan/dissectors/packet-dof.c b/epan/dissectors/packet-dof.c index 5035fc0824..a23a80c16f 100644 --- a/epan/dissectors/packet-dof.c +++ b/epan/dissectors/packet-dof.c @@ -11314,8 +11314,8 @@ static void dof_register_dpp_2(void) { { &ei_dpp2_dof_10_flags_zero, { "dof.dpp.v2.flags_zero", PI_UNDECODED, PI_ERROR, "DPS-10: Reserved flag bits must be zero.", EXPFILL } }, { &ei_dpp_default_flags, { "dof.dpp.v2.flags_included", PI_COMMENTS_GROUP, PI_NOTE, "Default flag value is included explicitly.", EXPFILL } }, - { &ei_dpp_explicit_sender_sid_included, { "dof.dpp.v2.sender_sid_included", PI_COMMENT, PI_NOTE, "Explicit SID could be optimized, same as sender.", EXPFILL } }, - { &ei_dpp_explicit_receiver_sid_included, { "dof.dpp.v2.receiver_sid_included", PI_COMMENT, PI_NOTE, "Explicit SID could be optimized, same as receiver.", EXPFILL } }, + { &ei_dpp_explicit_sender_sid_included, { "dof.dpp.v2.sender_sid_included", PI_PROTOCOL, PI_NOTE, "Explicit SID could be optimized, same as sender.", EXPFILL } }, + { &ei_dpp_explicit_receiver_sid_included, { "dof.dpp.v2.receiver_sid_included", PI_PROTOCOL, PI_NOTE, "Explicit SID could be optimized, same as receiver.", EXPFILL } }, #ifdef LIBGCRYPT_OK { &ei_dpp_no_security_context, { "dof.dpp.v2.no_context", PI_UNDECODED, PI_WARN, "No security context to enable packet decryption.", EXPFILL } }, #else diff --git a/epan/dissectors/packet-gsm_gsup.c b/epan/dissectors/packet-gsm_gsup.c index ffc23c0d29..1c4b8463ce 100644 --- a/epan/dissectors/packet-gsm_gsup.c +++ b/epan/dissectors/packet-gsm_gsup.c @@ -973,7 +973,7 @@ proto_register_gsup(void) { "gsup.sm_rp_oa.invalid", PI_PROTOCOL, PI_ERROR, "Malformed SM-RP-OA IE", EXPFILL } }, { &ei_gsup_ie_len_invalid, - { "gsup.ie.len.invalid", PI_PROTOCOL, PI_MALFORMED, + { "gsup.ie.len.invalid", PI_PROTOCOL, PI_ERROR, "Invalid Information Element Length", EXPFILL } }, }; diff --git a/epan/dissectors/packet-gsm_r_uus1.c b/epan/dissectors/packet-gsm_r_uus1.c index a6371bb287..7a6b283e12 100644 --- a/epan/dissectors/packet-gsm_r_uus1.c +++ b/epan/dissectors/packet-gsm_r_uus1.c @@ -849,7 +849,7 @@ proto_register_gsm_r_uus1(void) }; static ei_register_info ei[] = { - { &ei_gsm_r_uus1_not_implemented_yet, { "gsm-r-uus1.not_implemented_yet", PI_PROTOCOL, PI_UNDECODED, "Not implemented yet", EXPFILL }}, + { &ei_gsm_r_uus1_not_implemented_yet, { "gsm-r-uus1.not_implemented_yet", PI_UNDECODED, PI_NOTE, "Not implemented yet", EXPFILL }}, }; expert_module_t* expert_gsm_r_uus1; diff --git a/epan/dissectors/packet-lnet.c b/epan/dissectors/packet-lnet.c index 319c40e6c9..a52f18050d 100644 --- a/epan/dissectors/packet-lnet.c +++ b/epan/dissectors/packet-lnet.c @@ -1041,9 +1041,9 @@ proto_register_lnet(void) expert_module_t *expert_lnet; static ei_register_info ei[] = { { &ei_lnet_buflen, - { "lnet.bad_buflen", PI_ERROR, PI_MALFORMED, "Buffer length mis-match", EXPFILL } }, + { "lnet.bad_buflen", PI_MALFORMED, PI_ERROR, "Buffer length mis-match", EXPFILL } }, { &ei_lnet_type, - { "lnet.bad_type", PI_ERROR, PI_PROTOCOL, "LNET Type mis-match", EXPFILL } } + { "lnet.bad_type", PI_PROTOCOL, PI_ERROR, "LNET Type mis-match", EXPFILL } } }; proto_lnet = proto_register_protocol("Lustre Network", "LNet", "lnet"); diff --git a/epan/dissectors/packet-lustre.c b/epan/dissectors/packet-lustre.c index aa39f02898..c01c3bf7b4 100644 --- a/epan/dissectors/packet-lustre.c +++ b/epan/dissectors/packet-lustre.c @@ -8564,13 +8564,13 @@ proto_register_lustre(void) expert_module_t *expert_lustre; static ei_register_info ei[] = { { &ei_lustre_buflen, - { "lustre.bad_buflen", PI_ERROR, PI_MALFORMED, "Buffer length mis-match", EXPFILL } }, + { "lustre.bad_buflen", PI_MALFORMED, PI_ERROR, "Buffer length mis-match", EXPFILL } }, { &ei_lustre_badopc, - { "lustre.bad_opcode", PI_WARN, PI_PROTOCOL, "BAD OPCODE", EXPFILL } }, + { "lustre.bad_opcode", PI_PROTOCOL, PI_WARN, "BAD OPCODE", EXPFILL } }, { &ei_lustre_badmagic, - { "lustre.bad_magic", PI_WARN, PI_PROTOCOL, "BAD Magic Value", EXPFILL } }, + { "lustre.bad_magic", PI_PROTOCOL, PI_WARN, "BAD Magic Value", EXPFILL } }, { &ei_lustre_obsopc, - { "lustre.old_opcode", PI_NOTE, PI_DEPRECATED, "Deprecated Opcode", EXPFILL } }, + { "lustre.old_opcode", PI_DEPRECATED, PI_NOTE, "Deprecated Opcode", EXPFILL } }, }; proto_lustre = proto_register_protocol("Lustre", "lustre", "lustre"); diff --git a/epan/dissectors/packet-oran.c b/epan/dissectors/packet-oran.c index da2fe78964..95c690b023 100755 --- a/epan/dissectors/packet-oran.c +++ b/epan/dissectors/packet-oran.c @@ -1846,7 +1846,7 @@ proto_register_oran(void) { &ei_oran_invalid_bfw_iqwidth, { "oran_fh_cus.bfw_iqwidth_invalid", PI_MALFORMED, PI_ERROR, "Invalid IQ Width", EXPFILL }}, { &ei_oran_invalid_num_bfw_weights, { "oran_fh_cus.num_bf_weights_invalid", PI_MALFORMED, PI_ERROR, "Invalid number of BF Weights", EXPFILL }}, { &ei_oran_unsupported_bfw_compression_method, { "oran_fh_cus.unsupported_bfw_compression_method", PI_UNDECODED, PI_WARN, "Unsupported BFW Compression Method", EXPFILL }}, - { &ei_oran_invalid_sample_bit_width, { "oran_fh_cus.invalid_sample_bit_width", PI_NOTE, PI_ERROR, "Unsupported sample bit width", EXPFILL }} + { &ei_oran_invalid_sample_bit_width, { "oran_fh_cus.invalid_sample_bit_width", PI_UNDECODED, PI_ERROR, "Unsupported sample bit width", EXPFILL }} }; /* Register the protocol name and description */ diff --git a/epan/expert.c b/epan/expert.c index 51a6d382cf..8052d04047 100644 --- a/epan/expert.c +++ b/epan/expert.c @@ -353,6 +353,37 @@ expert_free_deregistered_expertinfos (void) static int expert_register_field_init(expert_field_info *expinfo, expert_module_t *module) { + /* Check for valid group and severity vals */ + switch (expinfo->group) { + case PI_CHECKSUM: + case PI_SEQUENCE: + case PI_RESPONSE_CODE: + case PI_REQUEST_CODE: + case PI_UNDECODED: + case PI_REASSEMBLE: + case PI_MALFORMED: + case PI_DEBUG: + case PI_PROTOCOL: + case PI_SECURITY: + case PI_COMMENTS_GROUP: + case PI_DECRYPTION: + case PI_ASSUMPTION: + case PI_DEPRECATED: + break; + default: + REPORT_DISSECTOR_BUG("Expert info for %s has invalid group=0x%08x\n", expinfo->name, expinfo->group); + } + switch (expinfo->severity) { + case PI_COMMENT: + case PI_CHAT: + case PI_NOTE: + case PI_WARN: + case PI_ERROR: + break; + default: + REPORT_DISSECTOR_BUG("Expert info for %s has invalid severity=0x%08x\n", expinfo->name, expinfo->severity); + } + expinfo->protocol = module->proto_name; /* if we always add and never delete, then id == len - 1 is correct */ |